Use OpenWindowStation(“winsta0”,…) and give the handle to
GetUserObjectInformation, This gives you the SID associated with
the Window Station. Use LookupAccountSid to get the user name.
Hope that helps,
Holger
-----Ursprungliche Nachricht-----
Von: xxxxx@pictel.com [mailto:xxxxx@pictel.com]
Gesendet: Mittwoch, 26. September 2001 03:01
An: NT Developers Interest List
Betreff: [ntdev] How to get an user name on NT/2000 from the Windows
Service?I am creating a Windows Service on the NT/2000 platform and I
need to get a
current logged user name. Windows function to use to get this one is
GetUserName(), but since I am running as a service, user name
is always
SYSTEM and domain is NT AUTHORITY.So far I tried to get a Token from the current thread or the
process and
then get an user information from it, which will help me to
get an User
Name from the user’s SID. Unfortunately, it is the same as the
one from the
GetUserName() function.Any idea on how to get the name of the user that is currently
logged in?Thanks
Fedja
You are currently subscribed to ntdev as: xxxxx@david-gmbh.de
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com