locked
creating a window on top of winlogon window from a service RRS feed

  • Question

  • hi,

    i need to create a window at winlogon time from my service. after reading various topics on this forum and elsewhere, i found the following way that supposedly works:

     

    DWORD id = WTSGetActiveConsoleSessionId ();

    ImpersonateSelf (SecurityImpersonation);

    OpenProcessToken (GetCurrentProcess (), TOKEN_ALL_ACCESS, &token);

    DuplicateTokenEx (token, MAXIMUM_ALLOWED, NUILL, SecurityImpersonation, TokenPrimary, &token);

    SetTokenInformation (token, TokenSessionId, &id, sizeof (id));

    CreateProcessAsUser (token, cmdline, cmdargs, NULL, FALSE, 0, NULL, NULL, &si, &pi);

    RevertToSelf ();

     

    then, from the created process i can create my window. it all works fine except for one thing - the created window is visible at the user's desktop, only after a user logs on (although the process is created successfully before user logon). tried it with both xp and windows 7, behavior is the same. this is not good enough for me; i need to see the window at logon time. does anyone have any idea how to fix this to do what i want? thanks in advance!

     

     

    Thursday, March 10, 2011 1:14 PM