How to detect logoff and lock event from atl COM Service
-
I have a atl com service that need to do something on windows log off and lock event. I created a winlogon dll to sendmessage to service for the above events. STA Service is not getting those messages. How to detect logoff and lock event from atl COM Service:zzz::confused: Chak
-
I have a atl com service that need to do something on windows log off and lock event. I created a winlogon dll to sendmessage to service for the above events. STA Service is not getting those messages. How to detect logoff and lock event from atl COM Service:zzz::confused: Chak
Hi Chak. > How to detect logoff and lock event from atl COM Service It's easy with logoff - simply call
SetConsoleCtrlHandler
and catch theCTRL_LOGOFF_EVENT
. Lock events are trickier. I guess the easiest way to catch them is via a Winlogon Notification Package[^]. Note: Because the notification Dll gets loaded by Winlogon and because Winlogon is running under the local System account (your COM Service probably isn't?), you can't use theSendMessage
API as a means of IPC communication between them. Try memory mapped files or named pipes instead. Also, set the Impersonate[^] reg-value of your notification Dll to 1 or modify the Dacl of your memory mapped file/named pipe appropriately (check this: A NotQuiteNullDacl Class[^]). RK PS: This were just presumptions from the top of my head -> for the exact behavior/terminology and implementation check the MSDN documentation.