一个VxD的问题,有兴趣的看看(谢谢_STLer!)
我用如下参数调用DeviceIoControl函数,
invoke DeviceIoControl,hVxD,1,addr InBuffer,8,NULL,NULL,NULL,NULL
===
注意:第一个参数为用CreateFile打开某个VxD的返回值,用sice看过,返回值正确,hVxD=0x00000008,
第二个参数为1,
我的VxD中对w32_DeviceIoControl消息进行了处理,处理代码如下:
VxD_PAGEABLE_CODE_SEG ;可分页代码段
BeginProc OnDeviceIoControl
assume esi:ptr DIOCParams
.if [esi].dwIoControlCode==DIOC_Open ; 如果为DIOC_Open,返回0,程序选;择了这个分支
xor eax,eax
.elseif [esi].dwIoControlCode==1 ;这是我希望的分支,
mov edi,[esi].lpvInBuffer
;-----------------------------------
; copy the message title to buffer
;-----------------------------------
VMMCall _lstrlen, <[edi]>
inc eax
push eax
VMMCall _HeapAllocate,<eax,HEAPZEROINIT>
mov pTitle,eax
pop eax
VMMCall _lstrcpyn,<pTitle,[edi],eax>
;-----------------------------------
; copy the message text to buffer
;-----------------------------------
VMMCall _lstrlen, <[edi+4]>
inc eax
push eax
VMMCall _HeapAllocate,<eax,HEAPZEROINIT>
mov pMessage,eax
pop eax
VMMCall _lstrcpyn,<pMessage,[edi+4],eax>
mov edi,pTitle
mov ecx,pMessage
mov eax,MB_OK
VMMCall Get_Sys_VM_Handle
VxDCall SHELL_sysmodal_Message ;我们期望的消息显示?
VMMCall _HeapFree,pTitle,0
VMMCall _HeapFree,pMessage,0
xor eax,eax
.endif
ret
EndProc OnDeviceIoControl
VxD_PAGEABLE_CODE_ENDS
问题:为什么DeviceIoControl()函数始终返回0?为什么?我如何确定,我的VxD是否真的收到w32_DeviceIoControl消息,sice如何拦截此消息,
谢谢您的回复!
_STLer (ax_0007@163.net)