관리 메뉴

kisoo

window7 에서 드라이버와 어플간의 이벤트 공유시 주의사항 본문

01.About Programming /2.Kernel Lab

window7 에서 드라이버와 어플간의 이벤트 공유시 주의사항

JamesK78 2011. 3. 25. 15:14
http://msdn.microsoft.com/en-us/library/ms682396(v=vs.85).aspx

The name can have a "Global\" or "Local\" prefix to explicitly create the object in the global or session name space. The remainder of the name can contain any character except the backslash character (\). For more information, see Kernel Object Namespaces. Fast user switching is implemented using Terminal Services sessions. Kernel object names must follow the guidelines outlined for Terminal Services so that applications can support multiple users.


드라이버와 어플리케이션 간의 이벤트 객체 공유 시 이름을 지정 하라고 되어 있다.


대부분의 잘못되는 경우 다음과 같아 코딩 했을 것이다.
app.SharedEvent = CreateEvent(NULL, FALSE, FALSE, "myEvent");
if (SharedEvent == NULL) { }


wStatus= WaitForSingleObject(SharedEvent, INFINITE);

RtlInitUnicodeString( &uszProcessEventString,  L\\BaseNamedObjects\\myEvent );
SharedEvent = IoCreateNotificationEvent( &uszProcEventString, &hProcessHandle );
ObReferenceObject( SharedEvent );
KeSetEvent( SharedEvent, 0, FALSE );

Windows7에서는 Global Naming  을 명시적으로 해줘야 한다.

SharedEvent = CreateEvent(NULL, FALSE, FALSE, "Global\\SharedEvent");


Comments