Re: Get real logon user from windows services

From: Valery Pryamikov (Valery_at_nospam.harper.no)
Date: 07/18/04

  • Next message: Jonathan Pierce: "Re: Obfuscator and Decompiler"
    Date: Sun, 18 Jul 2004 16:51:33 +0200
    
    

    Hi,
    The problem is that it could be many currently logged on users (if your
    server has one or more terminal sessions open) or it could be no currently
    logged on users.
    Windows services are alwais started in session 0 (global namespace).
    if terminal client session is open against your server - they will be
    running in other sessions 1,2,...x.
    If you are interesting to get logged on user identities, you can try to
    enumeration shell processes and get this information from shell process
    token. You can check my old CreateProcessAsUser sample
    http://www.harper.no/valery/oldsite/CreateProcessAsUser.zip
    where I do exatly this - check wich process is registered to run as shell,
    enumerate processes (session 0 only), find shell process and retrieve
    process token.

    -Valery.
    http://www.haprer.no/valery

    "Bui Pham Minh Tri" <minhtri@pyramid-consulting.com> wrote in message
    news:%232%23%23AqIbEHA.2340@TK2MSFTNGP09.phx.gbl...
    I have written a windows service, but when I use
    System.Security.Principal.WindowsIdentity.GetCurrent().Name to get the
    current logon user, it returned NT AUTHOURITY\SYSTEM. How can I get the name
    of current logon user, for example DOMAIN\user?
    Thanks for any solutions.


  • Next message: Jonathan Pierce: "Re: Obfuscator and Decompiler"

    Relevant Pages

    • Re: WTSQueryUserToken Equivilent Pre-XP
      ... > user in a specified TS Session. ... > WTSQueryUserToken function for this... ... > _current_ session used to be to find the shell process by ... > some means (e.g. finding the Progman window) and Open the ...
      (microsoft.public.platformsdk.security)
    • WTSQueryUserToken Equivilent Pre-XP
      ... user in a specified TS Session. ... WTSQueryUserToken function for this... ... _current_ session used to be to find the shell process by ... some means (e.g. finding the Progman window) and Open the ...
      (microsoft.public.platformsdk.security)
    • Re: RWW Timing
      ... I understand that you want to monitor when and how ... > to an internal Windows XP or Terminal Server computer. ... SBS creates a connection to the internal client on port 3389 which is ... But it can not tell which one session from the RWW, ...
      (microsoft.public.windows.server.sbs)
    • Re: Restricting TS USers
      ... MCSE, CCEA, Microsoft MVP - Terminal Server ... Terminal Services and Microsoft Windows Server 2003 Service Pack ... the remote session does not end immediately. ...
      (microsoft.public.windows.terminal_services)
    • Re: ASP sessionstate
      ... :>: so it is a clientside issue. ... ASP doesn't know or care what browser it ... but then it is not a new session. ... :> How can a Response.Write write to the server screen? ...
      (microsoft.public.inetserver.asp.general)

  • Quantcast