详细流程:
重现在DriverEntry例程中随意改动EBX的值引起BSODD
Microsoft (R) Windows Debugger Version 6.8.0004.0 X86
Copyright (c) Microsoft Corporation. All rights reserved.
Opened \\.\pipe\com_1
Waiting to reconnect...
Connected to Windows XP 2600 x86 compatible target, ptr64 FALSE
Kernel Debugger connection established. (Initial Breakpoint requested)
Symbol search path is: D:\WINDDK\Symbols;d:\WINDOWS\Symbols
Executable search path is: E:\汇编编程\WIN32ASM\SOFT
Windows XP Kernel Version 2600 (Service Pack 2) UP Free x86 compatible
Product: WinNt, suite: TerminalServer SingleUserTS
Built by: 2600.xpsp_sp2_qfe.070227-2300
Kernel base = 0x804d8000 PsLoadedModuleList = 0x8055b820
Debug session time: Thu Mar 6 19:33:10.109 2008 (GMT+8)
System Uptime: 0 days 0:03:25.828
Break instruction exception - code 80000003 (first chance)
... ...
kd> t
HellowDDK!DriverEntry+0xee:
faf6f3e7 68f2f6f6fa push offset HellowDDK!szMsgDispathM (faf6f6f2)
kd> u
HellowDDK!DriverEntry+0xee [E:\汇编编程\WIN32ASM\SOFT\HellowDDK.asm @ 157]:
faf6f3e7 68f2f6f6fa push offset HellowDDK!szMsgDispathM (faf6f6f2)
faf6f3ec e817010000 call HellowDDK!DbgPrint (faf6f508)
faf6f3f1 83c404 add esp,4
faf6f3f4 8b4508 mov eax,dword ptr [ebp+8]
faf6f3f7 c740388ef4f6fa mov dword ptr [eax+38h],offset HellowDDK!CalledIofCompleteRequest (faf6f48e)
faf6f3fe c7403a8ef4f6fa mov dword ptr [eax+3Ah],offset HellowDDK!CalledIofCompleteRequest (faf6f48e)
faf6f405 c74046a9f4f6fa mov dword ptr [eax+46h],offset HellowDDK!CalledDeviceControl (faf6f4a9)
faf6f40c c740342cf4f6fa mov dword ptr [eax+34h],offset HellowDDK!UnLoadedDrive (faf6f42c)
kd> u
HellowDDK!DriverEntry+0x11a [E:\汇编编程\WIN32ASM\SOFT\HellowDDK.asm @ 168]:
faf6f413 e8a9000000 call HellowDDK!DebugShowRegisterInformation (faf6f4c1)
faf6f418 6840f6f6fa push offset HellowDDK!szMsgRun (faf6f640)
faf6f41d e8e6000000 call HellowDDK!DbgPrint (faf6f508)
faf6f422 83c404 add esp,4
faf6f425 8b45fc mov eax,dword ptr [ebp-4]
faf6f428 c9 leave
faf6f429 c20800 ret 8
HellowDDK!UnLoadedDrive [E:\汇编编程\WIN32ASM\SOFT\HellowDDK.asm @ 177]:
faf6f42c 55 push ebp
kd> g faf6f429
Hellow Msg: The Driver is Dispathing Major Function !
Hellow Msg: The Code's Curent Address EIP = FAF6F413, More Information:
Hellow Msg: EAX = 811AE7E0 ECX = 80500073 EDX = 00000037 EBX = FAE3482B
Hellow Msg: ESP = F823BC60 EBP = F823BC7C ESI = E10A08CC EDI = 811AE7E0
Hellow Msg: The Driver is Runing !
HellowDDK!DriverEntry+0x130:
faf6f429 c20800 ret 8
kd> t
nt!IopLoadDriver+0x66c:
805a3ead 3bc3 cmp eax,ebx
kd> u
nt!IopLoadDriver+0x66c:
805a3ead 3bc3 cmp eax,ebx
805a3eaf 8b8d68ffffff mov ecx,dword ptr [ebp-98h]
805a3eb5 8945ac mov dword ptr [ebp-54h],eax
805a3eb8 8901 mov dword ptr [ecx],eax
805a3eba 0f8ce7430400 jl nt!IopLoadDriver+0x67b (805e82a7)
805a3ec0 895da0 mov dword ptr [ebp-60h],ebx
805a3ec3 8b45a0 mov eax,dword ptr [ebp-60h]
805a3ec6 8d448738 lea eax,[edi+eax*4+38h]
805a3eca 3918 cmp dword ptr [eax],ebx
805a3ecc 0f84e1430400 je nt!IopLoadDriver+0x690 (805e82b3)
kd> G
*** Fatal System Error: 0x0000007e
(0xC0000005,0x805A3ECA,0xF88CABC4,0xF88CA8C0)
All arguments are widened to 32 bits when they are passed. Return values are also widened to 32 bits and returned in the EAX register, except for 8-byte structures, which are returned in the EDX:EAX register pair. Larger structures are returned in the EAX register as pointers to hidden return structures. Parameters are pushed onto the stack from right to left. Structures that are not PODs will not be returned in registers.
The compiler generates prolog and epilog code to save and restore the ESI, EDI, EBX, and EBP registers, if they are used in the function