阅读:1427回复:5
完成例程在什么情况下会在DISPATCH_LEVEL上执行?
在<Windows WDM设备驱动程序开发指南中>有一句话说,完成例程有时在PASSVIE_LEVEL上执行,有时在DISPATCH_LEVEL上执行.大虾能不能说一下,在什么情况下是在DISPATCH_LEVEL上执行呢?
|
|
沙发#
发布于:2007-03-30 12:07
没有规律,因为你不知道下面的驱动都做了些什么......
|
|
|
板凳#
发布于:2007-03-30 15:27
标准做法:完成例程里唤醒另外一个例程
|
|
地板#
发布于:2007-03-30 16:17
反汇编一下IoCompleteRequest就知道了。
|
|
地下室#
发布于:2007-04-01 03:08
.text:00456921 __stdcall IoCompleteRequest(x, x) proc near
.text:00456921 .text:00456921 arg_0 = dword ptr 8 .text:00456921 arg_4 = byte ptr 0Ch .text:00456921 .text:00456921 mov edi, edi .text:00456923 push ebp .text:00456924 mov ebp, esp .text:00456926 mov dl, [ebp+arg_4] .text:00456929 mov ecx, [ebp+arg_0] .text:0045692C call _pIofCompleteRequest .text:00456932 pop ebp .text:00456933 retn 8 .text:00456933 .text:00456933 __stdcall IoCompleteRequest(x, x) endp ![]() |
|
|
5楼#
发布于:2007-04-01 03:10
INIT:005CB6F3 __stdcall IopSetIoRoutines() proc near ; CODE XREF: IoInitSystem(x)+ECp
INIT:005CB6F3 xor eax, eax INIT:005CB6F5 cmp _pIofCallDriver, eax INIT:005CB6FB jnz short loc_5CB707 INIT:005CB6FB INIT:005CB6FD mov _pIofCallDriver, offset IopfCallDriver(x,x) INIT:005CB6FD INIT:005CB707 INIT:005CB707 loc_5CB707: ; CODE XREF: IopSetIoRoutines()+8j INIT:005CB707 cmp _pIofCompleteRequest, eax INIT:005CB70D jnz short loc_5CB719 INIT:005CB70D INIT:005CB70F mov _pIofCompleteRequest, offset IopfCompleteRequest(x,x) .text:0040CC01 __fastcall IopfCompleteRequest(x, x) proc near .text:0040CC01 ; CODE XREF: IoPerfCompleteRequest(x,x)+88p .text:0040CC01 ; IoPerfCompleteRequest(x,x)+B8p .text:0040CC01 ; PAGEVRFY:0059334Ep .text:0040CC01 ; PAGEVRFY:loc_5933C4p .text:0040CC01 ; DATA XREF: IoPerfReset()+1Bo .text:0040CC01 ; IopSetIoRoutines()+1Co .text:0040CC01 .text:0040CC01 var_C = dword ptr -0Ch .text:0040CC01 var_8 = dword ptr -8 .text:0040CC01 var_1 = byte ptr -1 .text:0040CC01 .text:0040CC01 ; FUNCTION CHUNK AT .text:004116FC SIZE 00000051 BYTES .text:0040CC01 ; FUNCTION CHUNK AT .text:00411862 SIZE 0000000D BYTES .text:0040CC01 ; FUNCTION CHUNK AT .text:004227D8 SIZE 0000002F BYTES .text:0040CC01 ; FUNCTION CHUNK AT .text:00428107 SIZE 00000025 BYTES .text:0040CC01 ; FUNCTION CHUNK AT .text:004290BB SIZE 00000023 BYTES .text:0040CC01 ; FUNCTION CHUNK AT .text:0042DF21 SIZE 0000000E BYTES .text:0040CC01 ; FUNCTION CHUNK AT .text:00444F26 SIZE 0000002F BYTES .text:0040CC01 ; FUNCTION CHUNK AT .text:00444F5F SIZE 0000000B BYTES .text:0040CC01 .text:0040CC01 mov edi, edi .text:0040CC03 push ebp .text:0040CC04 mov ebp, esp .text:0040CC06 sub esp, 10h .text:0040CC09 push ebx .text:0040CC0A push esi .text:0040CC0B mov esi, ecx .text:0040CC0D mov cl, [esi+23h] .text:0040CC10 mov [ebp+var_8], edx .text:0040CC13 mov dl, [esi+22h] .text:0040CC16 xor ebx, ebx .text:0040CC18 inc dl .text:0040CC1A cmp cl, dl .text:0040CC1C push edi .text:0040CC1D mov [ebp+var_C], ebx .text:0040CC20 jg sub_444F81 .text:0040CC20 .text:0040CC26 cmp word ptr [esi], 6 .text:0040CC2A jnz sub_444F81 .text:0040CC2A .text:0040CC30 mov edi, [esi+60h] .text:0040CC33 inc cl .text:0040CC35 cmp cl, dl .text:0040CC37 lea eax, [edi+24h] .text:0040CC3A mov [esi+23h], cl .text:0040CC3D mov [esi+60h], eax .text:0040CC40 jg short loc_40CCA6 .text:0040CC40 .text:0040CC42 add edi, 3 .text:0040CC42 .text:0040CC45 .text:0040CC45 loc_40CC45: ; CODE XREF: IopfCompleteRequest(x,x)+A3j .text:0040CC45 mov dl, [edi] .text:0040CC47 and dl, 1 .text:0040CC4A cmp [esi+18h], ebx .text:0040CC4D mov [ebp+var_1], dl .text:0040CC50 mov [esi+21h], dl .text:0040CC53 mov dl, [edi] .text:0040CC55 jl loc_411862 .text:0040CC55 .text:0040CC5B test dl, 40h .text:0040CC5E jnz loc_40CD05 .text:0040CC5E .text:0040CC64 .text:0040CC64 loc_40CC64: ; CODE XREF: IopfCompleteRequest(x,x)+4C63j .text:0040CC64 ; IoCancelIrp(x)+1705Cj .text:0040CC64 cmp [esi+24h], bl .text:0040CC67 jnz loc_42DF21 .text:0040CC67 .text:0040CC6D .text:0040CC6D loc_40CC6D: ; CODE XREF: IopfCompleteRequest(x,x)+21323j .text:0040CC6D cmp [ebp+var_1], bl .text:0040CC70 jnz loc_4192A1 .text:0040CC70 .text:0040CC76 .text:0040CC76 loc_40CC76: ; CODE XREF: IopCompleteRequest(x,x,x,x,x)+229j .text:0040CC76 ; IopCompleteRequest(x,x,x,x,x)+233j .text:0040CC76 mov [edi-2], bl .text:0040CC79 mov [edi-1], bl .text:0040CC7C mov [edi], bl .text:0040CC7E mov [edi+1], ebx .text:0040CC81 mov [edi+5], ebx .text:0040CC84 mov [edi+9], ebx .text:0040CC87 mov [edi+0Dh], ebx .text:0040CC8A mov [edi+15h], ebx .text:0040CC8A .text:0040CC8D .text:0040CC8D loc_40CC8D: ; CODE XREF: IopfCompleteRequest(x,x)+13Cj .text:0040CC8D add dword ptr [esi+60h], 24h .text:0040CC91 mov eax, [esi+60h] .text:0040CC94 add edi, 24h .text:0040CC97 inc byte ptr [esi+23h] .text:0040CC9A mov dl, [esi+22h] .text:0040CC9D mov cl, [esi+23h] .text:0040CCA0 inc dl .text:0040CCA2 cmp cl, dl .text:0040CCA4 jle short loc_40CC45 .text:0040CCA4 .text:0040CCA6 .text:0040CCA6 loc_40CCA6: ; CODE XREF: IopfCompleteRequest(x,x)+3Fj .text:0040CCA6 test byte ptr [esi+8], 8 .text:0040CCAA jnz loc_4227D8 .text:0040CCAA .text:0040CCB0 cmp dword ptr [esi+18h], 104h .text:0040CCB7 jz loc_4290BB .text:0040CCB7 .text:0040CCBD .text:0040CCBD loc_40CCBD: ; CODE XREF: IopfCompleteRequest(x,x)+1C4C0j .text:0040CCBD ; IopfCompleteRequest(x,x)+38335j .text:0040CCBD ; IopfCompleteRequest(x,x)+38341j .text:0040CCBD mov eax, [esi+54h] .text:0040CCC0 cmp eax, ebx .text:0040CCC2 jnz sub_4171C0 .text:0040CCC2 .text:0040CCC8 .text:0040CCC8 loc_40CCC8: ; CODE XREF: sub_4171C0+Aj .text:0040CCC8 mov eax, [esi+8] .text:0040CCCB test ax, 402h .text:0040CCCF jnz loc_4116FC .text:0040CCCF .text:0040CCD5 mov edi, [esi+4] .text:0040CCD5 .text:0040CCD8 .text:0040CCD8 loc_40CCD8: ; CODE XREF: MmUnlockPages(x)+121j .text:0040CCD8 cmp edi, ebx .text:0040CCDA jnz loc_41B283 .text:0040CCDA .text:0040CCE0 test byte ptr [esi+9], 8 .text:0040CCE4 jz loc_4192C8 .text:0040CCE4 .text:0040CCEA cmp [esi+21h], bl .text:0040CCED jnz loc_4192C8 .text:0040CCED .text:0040CCF3 cmp dword ptr [esi+18h], 104h .text:0040CCFA jz loc_4290CC .text:0040CCFA .text:0040CD00 .text:0040CD00 loc_40CD00: ; CODE XREF: IopfCompleteRequest(x,x)+142j .text:0040CD00 ; IopfCompleteRequest(x,x)+4B28j .text:0040CD00 ; IopfCompleteRequest(x,x)+4B40j .text:0040CD00 ; IopCompleteRequest(x,x,x,x,x)+221j .text:0040CD00 ; IopfCompleteRequest(x,x)+15BF0j .text:0040CD00 ; IopfCompleteRequest(x,x)+15C01j ... .text:0040CD00 pop edi .text:0040CD01 pop esi .text:0040CD02 pop ebx .text:0040CD03 leave .text:0040CD04 retn .text:0040CD04 .text:0040CD05 ; --------------------------------------------------------------------------- .text:0040CD05 .text:0040CD05 loc_40CD05: ; CODE XREF: IopfCompleteRequest(x,x)+5Dj .text:0040CD05 ; IopfCompleteRequest(x,x)+4C69j .text:0040CD05 ; IopfCompleteRequest(x,x)+21329j .text:0040CD05 mov [edi-2], bl .text:0040CD08 mov [edi-1], bl .text:0040CD0B mov [edi], bl .text:0040CD0D mov [edi+1], ebx .text:0040CD10 mov [edi+5], ebx .text:0040CD13 mov [edi+9], ebx .text:0040CD16 mov [edi+0Dh], ebx .text:0040CD19 mov [edi+15h], ebx .text:0040CD1C mov al, [esi+22h] .text:0040CD1F inc al .text:0040CD21 cmp [esi+23h], al .text:0040CD24 jz loc_411746 .text:0040CD24 .text:0040CD2A mov eax, [esi+60h] .text:0040CD2D mov eax, [eax+14h] .text:0040CD2D .text:0040CD30 .text:0040CD30 loc_40CD30: ; CODE XREF: IopfCompleteRequest(x,x)+4B47j .text:0040CD30 push dword ptr [edi+1Dh] .text:0040CD33 push esi .text:0040CD34 push eax .text:0040CD35 call dword ptr [edi+19h] .text:0040CD38 cmp eax, 0C0000016h .text:0040CD3D jnz loc_40CC8D .text:0040CD3D .text:0040CD43 jmp short loc_40CD00 .text:0040CD43 .text:0040CD43 __fastcall IopfCompleteRequest(x, x) endp |
|
|