diff --git a/system/username.c b/system/username.c new file mode 100644 index 0000000..7fe82ee --- /dev/null +++ b/system/username.c @@ -0,0 +1,20 @@ +#include +#include +#include + +int wmain(void) { + + wchar_t username[UNLEN+1]; + DWORD len = sizeof(username) / sizeof(wchar_t); + + int r = GetUserNameW(username, &len); + + if (r == 0) { + wprintf(L"Failed to get username %ld", GetLastError()); + return 1; + } + + wprintf(L"User name: %ls\n", username); + + return 0; +}