Question for KeSetEvent and KeReadStateEvent

Question for KeSetEvent and KeReadStateEvent

Post by hatepau » Fri, 24 Jun 2005 21:57:54


Hi all

I have write follow code in my DPC

ASSERT( KeReadStateEvent((PKEVENT)pdx->WriteEvent[nIndex]) == 0);
KeSetEvent((PKEVENT) pdx->WriteEvent[nIndex], (KPRIORITY) 0, FALSE);
ASSERT( KeReadStateEvent((PKEVENT)pdx->WriteEvent[nIndex]) != 0);
Why sometimes I will get a assert when third line run??

Thanks a lot
 
 
 

Question for KeSetEvent and KeReadStateEvent

Post by Maxim S. S » Sat, 25 Jun 2005 01:08:55


If this is the auto-reset event and the waiter was awakened by KeSetEvent -
then the event will be auto-closed and the third line will assert.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
XXXX@XXXXX.COM
http://www.yqcomputer.com/

 
 
 

Question for KeSetEvent and KeReadStateEvent

Post by Mark Rodd » Sat, 25 Jun 2005 09:35:25


And the code segment provided by the OP is just broken. Perhaps the OP
should explain what the code was supposed to be doing.


KeReadStateEvent is a near-useless api.

--

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com
 
 
 

Question for KeSetEvent and KeReadStateEvent

Post by hatepau » Sat, 25 Jun 2005 14:22:04

Sorry for too less info^^"""

The event is Created by AP and is a manual-reset event

hEventInput = CreateEvent(NULL, TRUE, FALSE, NULL);

I use DeviceIoCortol to share this event with my Driver

ObReferenceObjectByHandle(pSetEvent->hEvent, EVENT_ALL_ACCESS,
*ExEventObjectType, pIrp->RequestorMode, &pEvent, NULL);

When a interrupt come in ,I will signal the event to tell AP something

How can I sure the event is signal??

Thanks Mark and Maxim?
 
 
 

Question for KeSetEvent and KeReadStateEvent

Post by Mark Rodd » Sat, 25 Jun 2005 21:52:24


> Thanks Mark and Maxim? >
You just set it and trust that the operating system functions as
specified. Your second assert can be hit because there is no guarantee
that you will get to the second read event state before your user mode
thread has handled and reset the event.
--

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com
 
 
 

Question for KeSetEvent and KeReadStateEvent

Post by Alexander » Sun, 11 Jun 2006 12:49:14

Remember you CANNOT call KeSetEvent from an ISR.

If you need to read event state, your design may be prone to race
conditions. Why do you think you need to read event state?



Sorry for too less info^^"""

The event is Created by AP and is a manual-reset event

hEventInput = CreateEvent(NULL, TRUE, FALSE, NULL);

I use DeviceIoCortol to share this event with my Driver

ObReferenceObjectByHandle(pSetEvent->hEvent, EVENT_ALL_ACCESS,
*ExEventObjectType, pIrp->RequestorMode, &pEvent, NULL);

When a interrupt come in ,I will signal the event to tell AP something

How can I sure the event is signal??

Thanks Mark and Maxim?