All I want to do is extract a NT username from the registry or a system variable or wherever, how can I do this? How do I properly use GetEnvironmentVariable() properly?
Printable View
All I want to do is extract a NT username from the registry or a system variable or wherever, how can I do this? How do I properly use GetEnvironmentVariable() properly?
What about GetUserName
You can use
BOOL GetUserName(
LPTSTR lpBuffer, // name buffer
LPDWORD nSize // size of name buffer
);
If the buffer is too small, the function fails GetLastError returns ERROR_MORE_DATA. The nSize parameter receives the required buffer size.
Thanks it works!