Hello Everyone:
http://www.osronline.com/article.cfm?id=108
Follow this article, I tried to create a share event in driver for
User-Mode app and driver. But when I tried to use OpenEvent or
CreateEvent to access the event object. I got 0x00000005 error ( Access
Deny) . If I created the event in User-Mode app and open it in driver,
both driver and app can access it without problem.
Here attached parts codes, please help me : Thank you in advance!
Driver Part:
RtlInitUnicodeString(&EventName, L"\BaseNamedObjects\ShareEvent");
SharedEvent = IoCreateNotificationEvent(&EventName, &
SharedEventHandle);
if (SharedEvent != NULL) {
ntStatus = STATUS_SUCCESS;
} else {
ntStatus = STATUS_UNSUCCESSFUL;
}
KeClearEvent(SharedEvent);
ntStatus = ObReferenceObjectByHandle( SharedEventHandle,
EVENT_ALL_ACCESS,
NULL,
KernelMode,
&EventHandle,
NULL );
App part:
// m_Handle = OpenEvent( EVENT_ALL_ACCESS,TRUE,“ShareEvent”);
m_Handle = CreateEvent( NULL,TRUE,FALSE,“ShareEvent”);
Best Regards
Haikun
2006-3-9