GetUserNameEx returns BOOLEAN (zero if failed, non-zero if succeeded) and not an error code.
See How to correctly use GetLastError