📄 pcidp.asm
字号:
BeginProc PCIDP_PNP_New_Device
push edx ;parameter 'LoadType'
push ebx ;parameter 'hDevnode'
call OFFSET32 _PnPNewDevice
add esp, 8 ;restore the stack
;eax ;contains the status code
stc ;set carry flag even when status is success
ret ;return to caller
EndProc PCIDP_PNP_New_Device
;******************************************************************************
;
; PCIDP_DeviceIocontrol
;
; DESCRIPTION:
;
;==============================================================================
BeginProc PCIDP_DeviceIocontrol
push esi ;parameter 'Params'
call OFFSET32 _DeviceIocontrol
add esp, 4 ;restore the stack
;eax ;contains the status code
clc ;clear carry flag always
ret ;return to caller
EndProc PCIDP_DeviceIocontrol
;******************************************************************************
;
; PCIDPISR
;
; DESCRIPTION: This the VID_Hw_Int_Proc entry as a result of a
; VCIDP_Virtualize_IRQ.
;
;==============================================================================
BeginProc _PCIDPISR, High_Freq
; Published as using EAX, EBX, ECX, EDX, ESI, and flags so we don't have to
; save any registers.
; Save registers
push eax
push ebx
push ecx
push edx
push esi
; Save parameter 'IRQHandle.
push eax
push edx ;parameter 'HWRefData'
push eax ;parameter 'IRQHandle'
call OFFSET32 _PCIDPISR_C
add esp, 8 ;restore the stack
test eax, eax ;contains the status code
jz PCIDPISR_1 ;skip if not status success
;Schedule the system VM to handle the deferred interrupt processing.
mov esi, OFFSET32 _PCIDPForDpcIsr
mov edx, eax ;HW reference data
VMMCall Schedule_Global_Event
; Tell the VIPCD to end this interrupt since we handled it.
pop eax ;get saved parameter 'IRQHandle'
VxDcall VPICD_Phys_EOI
clc ;the interrupt has been handled
jmp PCIDPISR_DONE ;return to caller
PCIDPISR_1:
pop eax ;clear stack of saved parameter 'IRQHandle'
stc ;tell caller the interrupt wasn't handled
;return to caller
; Restore the saved registers.
PCIDPISR_DONE:
pop esi
pop edx
pop ecx
pop ebx
pop eax
ret
EndProc _PCIDPISR
;******************************************************************************
;
; PCIDPForDpcIsr
;
; DESCRIPTION: EventCallback as a result of a Schedule_VM_Event.
;
;==============================================================================
BeginProc _PCIDPForDpcIsr
; Published as using EAX, EBX, ECX, EDX, ESI, and EDI so we don't have to
; save any registers.
push edx ;parameter 'HWRefData'
call OFFSET32 _PCIDPForDpcIsr_C
add esp, 4 ;restore the stack
clc ;
ret ;return to caller
EndProc _PCIDPForDpcIsr
;******************************************************************************
;
; VWIN32_CloseVxDHandleW
;
; DESCRIPTION: C wrapper to dynamically link to VMM service
; _VWIN32_CloseVxDHandle. C Syntax: VWIN32_CloseVxDHandle(ULONG event).
; The call from C will place this parameter on the stack. We need to pass it
; to _VWIN32_CloseVxDHandle in a register then invoke the service via VxDCall.
;
;==============================================================================
BeginProc _VWIN32_CloseVxDHandleW
mov eax, [esp+4] ;get the 'event' parameter to pass to the service
VxDCall _VWIN32_CloseVxDHandle
ret ;return to the caller
EndProc _VWIN32_CloseVxDHandleW
;******************************************************************************
;
; VWIN32_SetWin32EventW
;
; DESCRIPTION: C wrapper to dynamically link to VMM service
; _VWIN32_SetWin32Event. C Syntax: VWIN32_SetWin32Event(ULONG event).
; The call from C will place this parameter on the stack. We need to pass it
; to _VWIN32_SetWin32Event in a register then invoke the service via VxDCall.
;
;==============================================================================
BeginProc _VWIN32_SetWin32EventW
mov eax, [esp+4] ;get the 'event' parameter to pass to the service
VxDCall _VWIN32_SetWin32Event
ret ;return to the caller
EndProc _VWIN32_SetWin32EventW
;******************************************************************************
;
; Binary to ASCII Hex
; dl - in : binary byte
; dx - out: ASCII hex work (dh - high order, dl - low order)
;
; DESCRIPTION: Translate a binary byte to to an ASCII hex 2 byte.
;
;==============================================================================
BeginProc Binary_to_ASCII_Hex
push ax ;save ax
mov al, dl ;get a copy of the binary value
shr al, 4 ;shift out low nibble
add al, 030h ;add in ASCII offset for decimal values
cmp al, 03Ah ;check for hexidecimal values
jb HEX1 ;skip to the next nibble if decimal
add al, 07h ;add in ASCII offset for hex values
HEX1:
mov ah, al ;save high ASCII nibble
mov al, dl ;get a copy of the binary value
and al, 0Fh ;mask out high nibble
add al, 030h ;add in ASCII offset for decimal values
cmp al, 03Ah ;check for hexidecimal values
jb HEX2 ;skip to the next nibble if decimal
add al, 07h ;add in ASCII offset for hex values
HEX2:
mov dh, al ;place low ASCII nibble
mov dl, ah ;place high ASCII nibble
pop ax ;restore ax
ret ;return to calling routine
EndProc Binary_to_ASCII_Hex
;******************************************************************************
;
; _DWORD_to_ASCII_Hex
;
; DESCRIPTION: C wrapper to invoke DWORD_to_ASCII_Hex.
; Syntax: DWORD_to_ASCII_Hex(DWORD value, char* message).
;
;
;==============================================================================
BeginProc _DWORD_to_ASCII_Hex
push edx
push ecx
mov edx, [esp+12] ;binary longword - 'value'
mov ecx, [esp+16] ;address to place ASCII Hex - 'message'
call DWORD_to_ASCII_Hex
pop ecx
pop edx
ret
EndProc _DWORD_to_ASCII_Hex
;******************************************************************************
;
; DWORD to ASCII Hex
; edx - in : binary longword
; ecx - in : address to place ASCII Hex
;
; DESCRIPTION: Translate a binary longword to to an ASCII hex 8 byte.
;
;==============================================================================
BeginProc DWORD_to_ASCII_Hex
push eax ;save eax
mov eax, edx ;save DWORD
shr edx, 24 ;hi byte of DWORD
call Binary_to_ASCII_Hex ;
mov [ecx], dx ;place in buffer
inc ecx
inc ecx
mov edx, eax ;retrieve DWORD
shr edx, 16 ;mid2 byte
call Binary_to_ASCII_Hex ;
mov [ecx], dx
inc ecx
inc ecx
mov edx, eax ;retrieve DWORD
shr edx, 8 ;mid1 byte
call Binary_to_ASCII_Hex ;
mov [ecx], dx
inc ecx
inc ecx
mov edx, eax ;retrieve DWORD
call Binary_to_ASCII_Hex ;
mov [ecx], dx
inc ecx
inc ecx
pop eax
ret
EndProc DWORD_to_ASCII_Hex
;******************************************************************************
;
; _Message_Box
;
; DESCRIPTION: C wrapper to invoke Message_Box.
; Syntax: Message_Box(char* message).
;
;
;==============================================================================
BeginProc _Message_Box
push ebx
push ecx
mov ecx, [esp+12] ;message string - 'message'
mov ebx, [VM]
call Message_Box
pop ecx
pop ebx
ret
EndProc _Message_Box
;******************************************************************************
;
; Message_Box
; ebx - in : virtual machine handle
; ecx - in : OFFSET32 of message string
;
; DESCRIPTION: Send a message to the user via SHELL_Message.
;
;
;==============================================================================
BeginProc Message_Box
; save some registers.
push eax
push edi
push esi
push edx
xor eax, eax ;message box flags:
or eax, MB_OK ; OK button
; ebx ;virtual machine handle (provided by caller)
; ecx ;pointer to message text (provided by caller)
xor edi, edi ;pointer to caption text (none)
xor esi, esi ;pointer to callback procedure (none)
xor edx, edx ;pointer to reference data (none)
VxDCall SHELL_SYSMODAL_Message ;use windows' MessageBox
; restore registers.
pop edx
pop esi
pop edi
pop eax
ret ;return to caller
EndProc Message_Box
VxD_CODE_ENDS
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -