开始学习内核编程中,蓝屏自然是不可少的,以后把遇到的蓝屏都记录下来,嘿嘿,防止以后再次犯同样的错误.
===============================================================
蓝屏信息:
kd> !analyze -v
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
IRQL_NOT_LESS_OR_EQUAL (a)
An attempt was made to access a pageable (or completely invalid) address at an
interrupt request level (IRQL) that is too high. This is usually
caused by drivers using improper addresses.
If a kernel debugger is available get the stack backtrace.
Arguments:
Arg1: 00000000, memory referenced
Arg2: 00000002, IRQL
Arg3: 00000000, bitfield :
bit 0 : value 0 = read operation, 1 = write operation
bit 3 : value 0 = not an execute operation, 1 = execute operation (only on chips which support this level of status)
Arg4: 80503759, address which referenced memory
Debugging Details:
------------------
READ_ADDRESS: 00000000
CURRENT_IRQL: 2
FAULTING_IP:
nt!_output+23
80503759 8a18 mov bl,byte ptr [eax]
DEFAULT_BUCKET_ID: DRIVER_FAULT
BUGCHECK_STR: 0xA
PROCESS_NAME: Idle
TRAP_FRAME: 80550b5c -- (.trap 0xffffffff80550b5c)
ErrCode = 00000000
eax=00000000 ebx=00000000 ecx=805510ec edx=00000000 esi=80550ea8 edi=805039e7
eip=80503759 esp=80550bd0 ebp=80550e30 iopl=0 nv up ei ng nz ac pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00010296
nt!_output+0x23:
80503759 8a18 mov bl,byte ptr [eax] ds:0023:00000000=??
Resetting default scope
LAST_CONTROL_TRANSFER: from 8053325b to 804e4592
STACK_TEXT:
80550710 8053325b 00000003 80550a6c 00000000 nt!RtlpBreakWithStatusInstruction
8055075c 80533d2e 00000003 00000000 80503759 nt!KiBugCheckDebugBreak+0x19
80550b3c 804e287f 0000000a 00000000 00000002 nt!KeBugCheck2+0x574
80550b3c 80503759 0000000a 00000000 00000002 nt!KiTrap0E+0x233
80550e30 80503880 80550e4c 00000000 805510ec nt!_output+0x23
80550e6c 80503954 80550ea8 00000200 00000000 nt!_vsnprintf+0x2f
805510c4 805039e3 805039e6 ffffffff 00000000 nt!vDbgPrintExWithPrefix+0x91
805510e0 f9fcfa43 00000000 81568d40 814c0fdc nt!DbgPrint+0x1a
805510fc 804e4d38 814c0130 814c0e70 814c0130 keybd_1!c2pReadComplete+0x63 [e:/code/built_driver/keybd1/test1.c @ 268]
8055112c f9d1c31c 00000000 81726d40 804db6d6 nt!IopfCompleteRequest+0xa2
80551148 f9abb776 0000000c 816c2b2c 814c0fb8 kbdclass!KeyboardClassServiceCallback+0x182
805511ac 804dcbd4 81726eec 01726c88 00000000 i8042prt!I8042KeyboardIsrDpc+0xf0
805511d0 804dcb4d 00000000 0000000e 00000000 nt!KiRetireDpcList+0x46
805511d4 00000000 0000000e 00000000 00000000 nt!KiIdleLoop+0x26
STACK_COMMAND: kb
FOLLOWUP_IP:
keybd_1!c2pReadComplete+63 [e:/code/built_driver/keybd1/test1.c @ 268]
f9fcfa43 83c404 add esp,4
FAULTING_SOURCE_CODE:
264:
265: //??¨°¨??3??¨′¨?D|ì?¨|?§?¨¨??
266: for (i = 0;i<buf_len;i++)
267: {
> 268: DbgPrint(("ctrl2cap: %2x/r/n",buf[i]));
269: }
270: }
271: g_C2pKeyCount--;
272: if (Irp->PendingReturned)
273: {
SYMBOL_STACK_INDEX: 8
SYMBOL_NAME: keybd_1!c2pReadComplete+63
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: keybd_1
IMAGE_NAME: keybd_1.sys
DEBUG_FLR_IMAGE_TIMESTAMP: 4a5c1cb9
FAILURE_BUCKET_ID: 0xA_keybd_1!c2pReadComplete+63
BUCKET_ID: 0xA_keybd_1!c2pReadComplete+63
Followup: MachineOwner
---------
=================================================================
原因:
266: for (i = 0;i<buf_len;i++)
267: {
> 268: DbgPrint(("ctrl2cap: %2x/r/n",buf[i]));
269: }
因为 DbgPrint(("ctrl2cap: %2x/r/n",buf[i]));中多了一对小括号,导致变成逗号表达式,所以导致出错,
原来的代码本来是 DbgPrint("ctrl2cap: %2x/r/n",buf[i]);,因为习惯了KdPrint,所以不自觉的加了2对括号在里面,囧......