I have found that on Windows 7 64 bit, on a machine with a domain name, GetUserNameEx( 3, .... ) which should get the extended name format DisplayName (==3), into a buffer, works fine.

However, it does not work on Windows 7 32 bit, vm that is on a workgroup, rather than on a domain, it returns ERROR\_NONE\_MAPPED.

How do you read the person's friendly name "Fred Smith", for example, in a way that works on Windows? GetUserNameEx is manifestly broken. Actually, not broken, I'm told, just not intended to work for users who are not on a domain. Why not, I wonder, since the local SAM information exists? And there appears to be no other direct API to do this.

If Windows gives you ERROR\_NONE\_MAPPED, you are out of luck, and probably not on a domain. So this is not exactly a friendly area of the API.

[It is possible, it looks like, to call NetUserGetInfo, to read the local SAM info, when not on a domain, but you need to know the user name and password first, and then it will maybe look up the friendly name.]

[RElated Question: does not mention the problem here](https://stackoverflow.com/questions/3438634/how-to-get-logged-in-users-full-name-in-windows)