My driver crashes the system when the system is sent to sleep. here's the analysis of the minidump:
*******************************************************************
0: kd> !analyze -v
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
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 kernel debugger is available get stack backtrace.
Arguments:
Arg1: 9bb4988c, memory referenced
Arg2: 00000002, IRQL
Arg3: 00000000, value 0 = read operation, 1 = write operation
Arg4: 90bd8759, address which referenced memory
Debugging Details:
READ_ADDRESS: GetPointerFromAddress: unable to read from 83583848
Unable to read MiSystemVaType memory at 83562e20
9bb4988c
CURRENT_IRQL: 2
FAULTING_IP:
vjoy!vJoyGetPositionData+43 [c:\winddk\vjoy-2\driver\sys\driver.c @ 565]
90bd8759 8b400c mov eax,dword ptr [eax+0Ch]
CUSTOMER_CRASH_COUNT: 1
DEFAULT_BUCKET_ID: VISTA_DRIVER_FAULT
BUGCHECK_STR: 0xD1
PROCESS_NAME: System
LAST_CONTROL_TRANSFER: from 90bd8adf to 90bd8759
STACK_TEXT:
83541ae0 90bd8adf 87c55a50 8764f1d8 00000001 vjoy!vJoyGetPositionData+0x43 [c:\winddk\vjoy-2\driver\sys\driver.c @ 565]
83541b04 90bdcb5d 783a5b50 00000001 83541b30 vjoy!RtlStringCbLengthW+0x1b [c:\winddk\6000\inc\ddk\ntstrsafe.h @ 6089]
83541b14 8ae3b53a 789a9a98 83541ba0 00000000 vjoy!vJoyCompleteReadReport+0x9b [c:\winddk\vjoy-2\driver\sys\driver.c @ 512]
WARNING: Stack unwind information not available. Following frames may be wrong.
83541b30 8ae3b984 83541b7c 83494019 876565c0 Wdf01000+0x2a53a
83541b38 83494019 876565c0 87656560 3a0ea8e4 Wdf01000+0x2a984
83541b7c 83493fbd 83544d20 83541ca8 00000002 nt!KiProcessTimerDpcTable+0x50
83541c68 83493e7a 83544d20 83541ca8 00000000 nt!KiProcessExpiredTimerList+0x101
83541cdc 8349200e 00001ea3 8842f918 8354e380 nt!KiTimerExpiration+0x25c
83541d20 83491e38 00000000 0000000e 00000000 nt!KiRetireDpcList+0xcb
83541d24 00000000 0000000e 00000000 00000000 nt!KiIdleLoop+0x38
STACK_COMMAND: kb
FOLLOWUP_IP:
vjoy!vJoyGetPositionData+43 [c:\winddk\vjoy-2\driver\sys\driver.c @ 565]
90bd8759 8b400c mov eax,dword ptr [eax+0Ch]
SYMBOL_STACK_INDEX: 0
SYMBOL_NAME: vjoy!vJoyGetPositionData+43
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: vjoy
IMAGE_NAME: vjoy.sys
DEBUG_FLR_IMAGE_TIMESTAMP: 50065fa4
FAILURE_BUCKET_ID: 0xD1_vjoy!vJoyGetPositionData+43
BUCKET_ID: 0xD1_vjoy!vJoyGetPositionData+43
Followup: MachineOwner
*******************************************************************
The crash is at the last line in the following code:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (!pDevContext->positions[i])
return;
HidReport->InputReport.CollectionId = id;
WdfWaitLockAcquire(pDevContext->positionLock, NULL);
HidReport->InputReport.bAxisX = pDevContext->positions[i]->ValX;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Some background:
This code is constantly called by a timer and is perfectly functional. When it is called during the 'going to sleep' process (That is, leaving state D0 I believe) it causes a crash.
Am I right in assuming that the correct solution is to stop the timer when leaving state D0? Any other suggestions?
Thank you guys