能力值:
( LV2,RANK:10 )
2 楼
顺便再贴个WINDBG读取DUMP文件调试信息
kd> !analyze -v
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
PAGE_FAULT_IN_NONPAGED_AREA (50)
Invalid system memory was referenced. This cannot be protected by try-except,
it must be protected by a Probe. Typically the address is just plain bad or it
is pointing at freed memory.
Arguments:
Arg1: f79f8180, memory referenced.
Arg2: 00000000, value 0 = read operation, 1 = write operation.
Arg3: 805b64b4, If non-zero, the instruction address which referenced the bad memory
address.
Arg4: 00000000, (reserved)
Debugging Details:
------------------ Could not read faulting driver name
READ_ADDRESS: f79f8180
FAULTING_IP:
nt!ObpCaptureObjectName+c6
805b64b4 f3a5 rep movs dword ptr es:[edi],dword ptr [esi]
MM_INTERNAL_CODE: 0
CUSTOMER_CRASH_COUNT: 1
DEFAULT_BUCKET_ID: DRIVER_FAULT
BUGCHECK_STR: 0x50
PROCESS_NAME: System
LAST_CONTROL_TRANSFER: from 805b6641 to 805b64b4
STACK_TEXT:
f7922b94 805b6641 e100d600 f7922d4c f7922c18 nt!ObpCaptureObjectName+0xc6
f7922be8 805b0ab6 865eb0f0 e100d600 e100d600 nt!ObpCaptureObjectCreateInformation+0x135
f7922c2c 805ba669 f7922d24 865eb0f0 e100d600 nt!ObOpenObjectByName+0x62
f7922c84 8053d808 f7922d44 00010000 f7922d24 nt!NtOpenSymbolicLinkObject+0x73
f7922c84 804fec71 f7922d44 00010000 f7922d24 nt!KiFastCallEntry+0xf8
f7922d08 8056917c f7922d44 00010000 f7922d24 nt!ZwOpenSymbolicLinkObject+0x11
f7922d3c f79f76d6 f7922d4c 85f735a8 001a0018 nt!IoDeleteSymbolicLink+0x3c
f7922d58 80576633 861256e8 f6f6cb84 8055b1fc 2!HelloDDKUnload+0x46 [c:\share\2\driver.cpp @ 324]
f7922d74 80534dd0 f6f6cb84 00000000 865b5640 nt!IopLoadUnloadDriver+0x19
f7922dac 805c5a28 f6f6cb84 00000000 00000000 nt!ExpWorkerThread+0x100
f7922ddc 80541fa2 80534cd0 00000001 00000000 nt!PspSystemThreadStartup+0x34
00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16 STACK_COMMAND: kb
FOLLOWUP_IP:
2!HelloDDKUnload+46 [c:\share\2\driver.cpp @ 324]
f79f76d6 8b55fc mov edx,dword ptr [ebp-4]
FAULTING_SOURCE_CODE:
320:
321: //¨¦?3y¡¤?o?¨¢¡ä?¨®
322: UNICODE_STRING pLinkName = pDevExt->ustrSymLinkName;
323: IoDeleteSymbolicLink(&pLinkName);
> 324: pNextObj = pNextObj->NextDevice;
325: IoDeleteDevice( pDevExt->pDevice );
326: }
327: }
328:
329: /************************************************************************ SYMBOL_STACK_INDEX: 7
SYMBOL_NAME: 2!HelloDDKUnload+46
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: 2
IMAGE_NAME: 2.sys
DEBUG_FLR_IMAGE_TIMESTAMP: 4b0a068f
FAILURE_BUCKET_ID: 0x50_2!HelloDDKUnload+46
BUCKET_ID: 0x50_2!HelloDDKUnload+46
Followup: MachineOwner
---------
能力值:
( LV2,RANK:10 )
3 楼
检查下pDevExt->ustrSymLinkName中的length ,buffer这些字段的值是否被破坏了。我感觉是这个问题
能力值:
( LV2,RANK:10 )
4 楼
但是如果不加入那些字符串函数的测试
并不会出现蓝屏问题
能力值:
( LV12,RANK:230 )
5 楼
Invalid system memory was referenced. 卸载函数里面换成这个吧
PDEVICE_OBJECT deviceObject = pDriverObject->DeviceObject;
UNICODE_STRING uniWin32NameString;
RtlInitUnicodeString( &uniWin32NameString, L"\\??\\HelloDDK" );
IoDeleteSymbolicLink( &uniWin32NameString );
if ( deviceObject != NULL )
{
IoDeleteDevice( deviceObject );
}
pDevExt->pDevice = pDevObj;
pDevExt->ustrDeviceName = devName;
中pDevObj,devName都是局部变量,作用范围只是在函数体内,一旦函数体执行完,pDevExt->pDevice ,pDevExt->ustrDeviceName就不知道指向哪里了,,并且pDevExt->ustrDeviceName = devName最好采用RtlCopyUnicodeString这些函数。。。。。
能力值:
( LV2,RANK:10 )
6 楼
我是初学者 这个是在驱动技术详解里的例子代码
根据我看网络其他驱动的例子
感觉他卸载函数不大对 放在循环体内 但是也说不出个所以然
我自己写代码会采取你的建议 谢谢
测试了下 蓝屏确实和这个有关系
因为之前未添加字符串测试函数并未暴露蓝屏的问题
所以我一直以为在字符串测试函数上有问题 不过他的字符串测试函数也有一些问题
使用ExAllocatePool分配内存 却使用RtlFreeUnicodeString不知道是否可行
我查看帮助 RtlFreeUnicodeString应该是只针对RtlAnsiStringToUnicodeString 或者 RtlUpcaseUnicodeString分配的内存.
hljleo 朋友所说的
“pDevExt->pDevice = pDevObj;
pDevExt->ustrDeviceName = devName;
中pDevObj,devName都是局部变量”
那么使用 IoCreateDevice(......,&newDeviceObject); newDeviceObject岂不是要使用全局变量?
能力值:
( LV2,RANK:10 )
7 楼
帮楼主顶,顺便看下自己KX