Current user? API vs Registry

  • Thread starter Thread starter Tim Bedford
  • Start date Start date
T

Tim Bedford

Hi,
I need to get the name of the user currently interactively logged on. I've
got two solutions:
Read the value held in HKLM\\SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion\\Winlogon\\DefaultUserName or:
Get the last name read from a call to NetWkstaUserEnum.
Which is the better bet?
I haven't seen it confirmed in any Microsoft documentation that the last
value from NetWkstaUserEnum will always be the currently logged on user but
testing it suggests that this is the case. But I've also seen it mentioned
that storing the current username in the Registry can be disabled (How is
this done? Is it an admin only thing?).
thanks,

Tim
 
Tim,

Hi. Did you ever get this working? Did you find a
workarounfd?

Lisa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top