📄 multi-add-slic.asm
字号:
;//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
; Vista Multi-Add-SLIC Module [硬盘版]
; 功能:为了实现Microsoft Vista的免激活(OEM形式的激活),该模块给BIOS添加上相应的SLIC。只需要再使用对应Vista版本
; 的OEM版的KEY和对应SLIC中的品牌的证书,就可以实现Microsoft Vista的免激活。
;
; 声明:本模块开发者开拔该模块,是为了方便某些主板的用户给BIOS添加SLIC功能,并非是为了鼓励使用盗版!
; 如经济许可,请支持正版!
;
; 开发者:
; 核心技术 XBXCC @VistaFans
; SLIC添加功能实现[A M I] dkpnop[nopworld] @VistaFans
;//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
use16 ; 16-bit by default
ROM_BLOCK = 0ch ;block
ROM_SIZE = ROM_BLOCK * 512
PCI_VENDOR_ID = 01011h ;VirtualPC=[VID= 1011 h, DID= 0009 h] vmware(amd am79c970a)=[1022h,2000h]
PCI_DEVICE_ID = 00009h ;
PCI_CLASS_CODE0 = 02h
PCI_CLASS_CODE1 = 00h
PCI_CLASS_CODE2 = 00h
MSG1_SHOW_DELAY = 20h ; the delay time after Show MSG1 ! Delay Time = MSG1_SHOW_DELAY *55ms
ENTER_PRESS_KEY = 3fh ;Key = F5
HD_BlockNum = 0ah ;HARD DRIVE OFFSET 1000H
DAP_LEN = 10h ;DiskAddrPack的长度 (10H或者18H)
pci_rom_header_start:
pci_rom_signature dw 0AA55H ;Always equal to AA55h
pci_rom_init_size db ROM_BLOCK ;Size in 512 byte blocks
;pci_rom_init_entry dd ? ;JMP instruction (entry point for init)
CALL INIT ;绝对不可以一个retf了事,不然,会在BIOS
RETF ;的BOOT设置中看不到PnPIC_Prod_STR所代表的内容
pci_rom_reserved db 11h dup (00h)
pci_rom_data_struc_ptr dw pci_rom_data_struc_start ;Offset of PCI ROM Data Structure
pci_rom_pnp_struc_ptr dw pci_pnp_inst_check_start ;offset of PCI ROM PnP Data Structure
;pci_rom_header_end
times (0x10-($ mod 0x10)) db 0
pci_rom_data_struc_start:
pcird_signature dd 'PCIR' ;Should equal to PCIR_SIGNATURE
pcird_vendid dw PCI_VENDOR_ID ;PCI Vendor ID
pcird_devid dw PCI_DEVICE_ID ;PCI Device ID
pcird_vpd_ptr dw 0000h ;Pointer to Vital Product Data struc
pcird_struc_len dw 0018h ;Length of this structure (18h)
pcird_struc_rev db 00h ;Revision number of this structure (00)
pcird_base_type db PCI_CLASS_CODE0 ;Class code - base type
pcird_sub_type db PCI_CLASS_CODE1 ;Class code - sub type
pcird_if_type db PCI_CLASS_CODE2 ;Class code - interface type
pcird_image_len dw ROM_BLOCK ;Length of this ROM image/512
pcird_code_rev dw 0000h ;Vendor defined rev level of ROM code
pcird_code_type db 00h ;Type of code in image (see equ's below)
pcird_indicator db 80h ;Indocator flags (see equ's below)
pcird_reserved dw 0000h
;pci_rom_data_struc_end
times (0x10-($ mod 0x10)) db 0
pci_pnp_inst_check_start:
PnPIC_Signature db '$PnP'
PnPIC_Revision db 01h ;01=PCI 2.0
PnPIC_Length db 02 ;2*16h
PnPIC_ControlFlags dw 0000h ;offset to next header (0 = none)
PnPIC_Reserved db 00h ;reserved data
PnPIC_CheckSum db 00h ;PnP structure checksum
PnPIC_Dev_Identifier dd 00000000h ;device identifier
PnPIC_Manu_STR_Offset dw PnPIC_Manu_STR ;pointer to manufacturer string
PnPIC_Prod_STR_Offset dw PnPIC_Prod_STR ;pointer to productname string
PnPIC_Dev_Class_Code_0 db PCI_CLASS_CODE0 ;Class code - base type
PnPIC_Dev_Class_Code_1 db PCI_CLASS_CODE1 ;Class code - sub typ
PnPIC_Dev_Class_Code_2 db PCI_CLASS_CODE2 ;Class code - interface type
PnPIC_Dev_Indicator db 0e4h ;device indicators (64h - shadowable,cacheable,not only for boot,IPL device)
PnPIC_Boot_Conn_Vector dw 0000h ;boot connection vector (0-none)
PnPIC_Disconn_Vetor dw 0000h ;disconnect vector (0-none)
PnPIC_Bootstrar_Vetor dw BOOTSTRAP ;bootstrap entry vector (0-none)
PnPIC_Reserved_DATA dw 0000h ;reserved data
PnPIC_Info_Vector dw 0000h ;static resource info vector (0-none)
;pci_pnp_inst_check_end
PREV_CHKSUM = 0
repeat 20H ;20H= 重复次数
load CHKSUM byte from pci_pnp_inst_check_start+%-1
CHKSUM = (PREV_CHKSUM + CHKSUM) mod 0x100
PREV_CHKSUM = CHKSUM
end repeat
store byte (0x100-CHKSUM) at (pci_pnp_inst_check_start+9h)
times (0x10-($ mod 0x10)) db 0
;************************************************************************************
PCI_ADD_SLIC_MODULE_NAME equ "SLIC Mod"
PnPIC_Manu_STR DB "China",00h ;后面一定要加00h,这代表字符串结束!
PnPIC_Prod_STR DB PCI_ADD_SLIC_MODULE_NAME,00h ;在BIOS的BOOT设置中看到的字符串!
;////////////////////////////////////////////////////////////////////////////////////////////////////////
WCRLF: ;输出换行符
pusha ;入口:无 ; 出口:无
mov ax,0e0dh
xor bl,bl
int 10h
mov al,0ah
int 10h
popa
retn
;//////////////////////////////////////////////////////////////////////////////////
WRITE: ;将SI所指向的内容显示出来
pusha ;入口:si ; 出口:无
WRITE_loop_1:
mov al,[cs:si]
cmp al,0h
je WRITE_exit
call DISPLAY_AL
inc si
jmp WRITE_loop_1
WRITE_exit:
popa
retn
DISPLAY_AL: ;将al中的内容,当作一个字符,并直接显示出来。
pusha ;入口:al ; 出口:无
mov ah,0eh ;AH=0xE,写字符到光标处,光标进一
xor bl,bl ;前台彩色 0 (黑白)
int 10h
popa
retn
;////////////////////////////////////////////////////////////////////////////////////////
DELAY: ;实现延迟的功能
pushf ;入口:ah ; 出口:无
push ax
push es ;延迟的时间长度为 AH * 55 ms
sti ;pause, put number of 55ms idle ticks in AH
push 00h ;enable interrupts otherwise timer will not be updated
pop es ;00=segment of timer
add ah,[es:046ch] ;add ticks to required delay
DLY_1: cmp ah,[es:046ch] ;compare current and required value
jne DLY_1 ;if not then repeat
pop es ;The DELAY code is copied from ROMOS
pop ax
popf
retn
CLEAR_SCREEN: ;清屏
pusha ;入口:无 ; 出口:无
mov ah,0fh
int 10h
mov ah,0
int 10h
popa
retn
display_al_str: ;将AL中的内容,以字符串的形式显示出来
pusha ;入口:al ; 出口:无
xor dx,dx
mov dl,al
shr dl,4h
and al,0fh
mov dh,al
mov al,dl
call convert
mov ah,0eh
xor bl,bl
int 10h
mov al,dh
call convert
mov ah,0eh
xor bl,bl
int 10h
popa
retn
convert: ;
cmp al,0ah
jge @a
add al,30h
retn
@a: add al,37h
retn
RW_HD_DATA: ;读/写 保存在硬盘的保留扇区(第一个硬盘,0柱面,0磁头,10扇区)
push ebx ;入口:dh,eax ; 出口:eax
push eax ;dh=02/03 表示 读/写
xor ebx,ebx
mov bx,0ae00h
cmp dh,02h
jne @RW_HD
pop eax
mov dh,42h
call @RW_PUB
jb RW_R_ER
jmp RW_R
@RW_HD: pop eax
movzx ecx,al
mov dword [bx],43494c53h
mov [bx+4h],ecx
mov dh,43h
call @RW_PUB
@RW_EXT:pop ebx
retn
RW_R_ER:
mov al,10h ;AL=10H,表示默认用ASUS的SLIC,并且不再显示设置的画面。除非开机后按F5!!
stc
jmp @RW_EXT
RW_R: mov ecx,[bx+4h]
mov al,cl
clc
jmp @RW_EXT
RW_NoSign:
mov ecx,43494c53h ;这里对扇区做标记,自己方便用WINHEX查看。43494c53h = SLIC 的反写。
mov [bx],ecx
jmp @RW_HD
@RW_PUB:
;-----------------------------------------------------
; struct DiskAddrPack
; PacketSize db 10h
; Reserved db 00h
; BlockCount dw ?
; BufferAddr dd ?
; BlockNum dq ?
; ends
;---------------------------------------------------
cli ;下面使用的扩展int 13h来读/写硬盘
mov si,0ae00h-DAP_LEN
mov ax,0010h
mov [si],ax
mov ax,0001h ;读一个扇区
mov [si+2h],ax
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -