Board index » delphi » delphi & Services under NT

delphi & Services under NT

Hi to you all,

I'm writing a service for winnt, can anyone tell me howto get the
currently logged on username from the system. When i try the GetUsername
API i get the accountname under wich the service runs (SYSTEM).

thanks...
M.

 

Re:delphi & Services under NT


Quote
Martijn Rotteveel wrote:
> Hi to you all,

> I'm writing a service for winnt, can anyone tell me howto get the
> currently logged on username from the system. When i try the GetUsername
> API i get the accountname under wich the service runs (SYSTEM).

You can try to read it from registry :
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\DefaultUserName

I think that this parameter is the currently logged on user.

Jari

Other Threads