nplumridge
asked on
Windows API, GetUserName is different with a Win2000 domain?
Hi,
I have a piece of software that uses the GetUserName API function to get the user name of the logged in user and then does a case-sensitive match against a field in a database. When our customer had their NT 4.0 domain this worked fine with both NT and 2000 clients. The function returned the user name as stored in User Manager, rather than what they typed (as the NT login is NOT case-sensitive).
Since moving to a Windows 2000 domain, the GetUserName function appears to return exactly what they typed, rather than what is entered in User Manager, and the lookup against our database is now failing.
Is this by design, and is there a workaround for it (other than making my software force the name returned to upper or lower case!)
Thanks for any help you can offer,
Neil.
I have a piece of software that uses the GetUserName API function to get the user name of the logged in user and then does a case-sensitive match against a field in a database. When our customer had their NT 4.0 domain this worked fine with both NT and 2000 clients. The function returned the user name as stored in User Manager, rather than what they typed (as the NT login is NOT case-sensitive).
Since moving to a Windows 2000 domain, the GetUserName function appears to return exactly what they typed, rather than what is entered in User Manager, and the lookup against our database is now failing.
Is this by design, and is there a workaround for it (other than making my software force the name returned to upper or lower case!)
Thanks for any help you can offer,
Neil.
why are you doing a case-sesitive match on data that is case-in-sensitive. nt usernames are not case sensitive so why treat them as though they are.......
ASKER
The name returned by GetUserName with an NT 4.0 doamin matched what was in User Manager, including the case. With the Windows 2000 domain it just returns whatever you type on the login dialog, with whatever case you type it in. I might just as well grab the USERNAME environment variable now.
I know I can just make the search case-insensitive, but I would like to know what has changed and why!
I know I can just make the search case-insensitive, but I would like to know what has changed and why!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.