Hi,all
How to share Event between two Kernel drivers?
Thanks for you help.
Crasher Guo
Hi
first create an event in App mode an name it such as “TestEvent” then in
your driver use following code:
first define this struct:
typedef struct _DEVICE_EXTENSION{
HANDLE m_KernelHandle;
PKEVENT m_KernelEvent;
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
then set “DeviceExtensionSize” param of IoCreateDevice with
“sizeof(DEVICE_EXTENSION)”
as result your event object can used across of your driver
then wherever you need to Open User mode Event call following functions
PDEVICE_EXTENSION deviceExtension =
(PDEVICE_EXTENSION)DeviceObject->DeviceExtension;
UNICODE_STRING EventNameUnicodeString;
RtlInitUnicodeString(&EventNameUnicodeString,
L"\BaseNamedObjects\TestEvent");
deviceExtension->m_KernelEvent=IoCreateSynchronizationEvent(&EventNameUnicodeString,
&deviceExtension->m_KernelHandle);
then you can simply call the:
KeSetEvent(deviceExtension->m_KernelEvent,0,FALSE);
or
KeResetEvent(deviceExtension->m_KernelEvent,0,TRUE);
Good Luck.
Hi again
sorry for prev reply
because i don’t why i thought you want share App and Kernel event
So
To share an event betwean two driver you can do same.
Good Luck.
Hi,Mohammad Tarhsaz
Thanks for you reply!
Now it worked well.
======= 2003-08-15 09:12:00 You wrote=======
Hi again
sorry for prev reply
because i don’t why i thought you want share App and Kernel event
So
To share an event betwean two driver you can do same.Good Luck.
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@sinfors.com.cn
To unsubscribe send a blank email to xxxxx@lists.osr.com
= = = = = = = = = = = = = = = = = = = =
Crasher Guo
xxxxx@sinfors.com.cn
2003-08-16