locked
Problem in Capture the Image of Desktop when User Log Off. Is it correct Calling CreateProcessAsUserAPI? RRS feed

  • Question



  • I have an exe to capture the image of a desktop.
    I start that  application  from Service . In service code , I m Using  CreateProcessAsUser()  API.
    The exe works fine when a user has already logged in a computer.
    However the exe fails to capture the desktop image if the user log out (In Log Off State).

    Not Only Vista, even XP also,  Fails to capture the Image of Desktop in the state of Log Off.

    Why Not capture the image when User Log Off ?
    Is wrong way to calling
    CreateProcessAsUser()  API  in Log Off state?
    if not so, give  some  idea!!


    (I follow the below steps in service code:
  • Get the Active Console SessionId using WTSGetActiveConsoleSessionId
  • Since I need to launch the application under a system account, I use the token from Winlogon, since Winlogon runs under the system account. So I obtain the process ID of Winlogon and Duplicate the token.
  • Then I make sure I sent the startupinfo parameter to winsta0\Default since I need to launch my process there.
  • Then I use CreateProcessAsUser with Winlogon's duplicate token.)


    Thanks in Advance,
    VinothKumar.R




Monday, January 7, 2008 12:28 PM

All replies

  • Didn't you already post something similar in another thread using Kings.Reuben as the author?

    In any case, when the user is logged off, the "Default" desktop is not visible.

    The "Winlogon" desktop is active at that time.

     

    Thursday, January 10, 2008 1:23 AM
  • Hi Eric!
    Thanks for ur Reply!
    Ya, Both are working on same issue!
     I got that.Now the Problem is , when user switch Default Desktop to Winlogon Desktop, the Application is Not working!
    i.e when Again i restart the service , the Appliction work properly!
    How to Notify the Desktop Changes?
    Friday, January 11, 2008 8:39 AM
  • I hope that the answers provided on the other thread helped.

    Detecting desktop switches beyond the logon/logoff monitoring is more complicated and on top of it not published information so I can't comment on this (but you could find some information on the net).

    Monday, January 14, 2008 7:21 PM