I am trying to get the list of all the users logged on to a WinNT/2k/XP box.
What I am about to use is NetWkstaUserEnum from the NetAPI lib - is that the
best way?
Also, is there a way to hook into windows logon to be notified when new
users log on and existing users log off? Alternatively I could call
NetWkstaUserEnum periodically, but that's cumbersome.
thx,
Alen
Eugene Gershnik - 24 Jun 2004 22:10 GMT
> I am trying to get the list of all the users logged on to a
> WinNT/2k/XP box. What I am about to use is NetWkstaUserEnum from
> the NetAPI lib - is that the best way?
As per MSDN this API lists interactive, service and batch logons only. If
you want more than that the best way is
LsaEnumerateLogonSessions
LsaGetLogonSessionData
> Also, is there a way to hook into windows logon to be notified when
> new users log on and existing users log off?
Yes and no. Yes because there is a way to hook into anything Windows does
including LsaApLogonUserXXX that does the actual job. (I once wrote a
product that did exactly that). No because this isn't what I would call
normal application design.
Could you tell why do you need this information? In my experience 9 times
out of 10 this is unnecessary.
--
Eugene
Victor Pereira - 26 Jun 2004 18:43 GMT
Hi, can i use LsaGetLogonSessionData to check if my user had logged on a
Netware ?
Thanks,
VP
> > I am trying to get the list of all the users logged on to a
> > WinNT/2k/XP box. What I am about to use is NetWkstaUserEnum from
[quoted text clipped - 19 lines]
> --
> Eugene
Eugene Gershnik - 27 Jun 2004 07:50 GMT
> Hi, can i use LsaGetLogonSessionData to check if my user had logged
> on a Netware ?
Check AuthenticationPackage member of SECURITY_LOGON_SESSION_DATA. My guess
is that it will contain a name of some netware authentication package (maybe
NETWARE_AUTHENTICATION_PACKAGE_V1_0).
--
Eugene
Raj - 28 Jun 2004 12:03 GMT
> I am trying to get the list of all the users logged on to a WinNT/2k/XP box.
> What I am about to use is NetWkstaUserEnum from the NetAPI lib - is that the
[quoted text clipped - 3 lines]
> users log on and existing users log off? Alternatively I could call
> NetWkstaUserEnum periodically, but that's cumbersome.
You can implement "WinLogon notification package" (nothing but a simple DLL) to monitor and respond to Winlogon events.
In order for your package to receive event notifications from Winlogon, you must register -- the name of the package, the names of the event handler functions in the package, the DLL responsible for implementing the package
I hope this is the best way to hook logon/off events.
- &Raj.
> thx,
> Alen