9 Aug
2023
9 Aug
'23
1:44 p.m.
Hans Leidekker (@hans) commented about programs/whoami/main.c:
}
-int __cdecl wmain(int argc, WCHAR *argv[]) +static BOOL get_user_name(EXTENDED_NAME_FORMAT name_format, WCHAR **name) { - WCHAR *buf = NULL; - ULONG size = 0; + ULONG size; BOOL result;
- if (argc > 1) + result = GetUserNameExW(name_format, NULL, &size); + if (result || GetLastError() != ERROR_MORE_DATA) { - int i; + ERR("GetUserNameExW expected ERROR_MORE_DATA, error %ld\n", GetLastError()); Printing these errors isn't very useful. One catch-all ERR() like you have when get_user_name() fails should be enough.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3473#note_41796