Hi all,

I wrote a some code to detection timeout using KeSetTimer as following:

KTIMER kTimer;

KeInitializeTimer( &kTimer );


BOOL CheckTimeout( LARGE_INTEGER DueTime )
KeSetTimer( &m_kTestTimer, DueTime, NULL );
while ( ! HardwareIsReady() )
if ( TRUE == KeReadStateTimer( &m_kTestTimer ) )
Status = CS_HARDWARE_TIMEOUT; // tineout !!!
return TRUE;
KeCancelTimer( &m_kTestTimer );
return FALSE;

These code works fine at PASSIVE_LEVEL. (ie I've got the timeout error )

I use the same code at DISPATCH_LEVEL and I get stucked in while() loop.
It looks like the timer object never get signaled.

What I have done wrong ???
If it is the case how can I detect timeout at DPC level

Thanks for helps,