Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to detect logoff and lock event from atl COM Service

How to detect logoff and lock event from atl COM Service

Scheduled Pinned Locked Moved C / C++ / MFC
c++comtutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chak
    wrote on last edited by
    #1

    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

    R 1 Reply Last reply
    0
    • C 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

      R Offline
      R Offline
      Robert Kuster
      wrote on last edited by
      #2

      Hi Chak. > How to detect logoff and lock event from atl COM Service It's easy with logoff - simply call SetConsoleCtrlHandler and catch the CTRL_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 the SendMessage 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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups