Search code examples
windowslocalecase-sensitive

What locale does Windows use to check usernames?


User names on Windows are case-insensitive (but case-preserving), so you can log in both as UserName and uSERnAME. However, "case" is different for different locales — which locale does Windows use to decide that the supplied user name is the same as one in the account database?

I believe it is the Invariant Locale, and that doesn't depend on anything in the "Language and Regional Options" dialog, but I may be wrong. In any case, I would appreciate something like an MSDN article for confirmation (or refutation).


Solution

  • Windows uses "UpCase and Binary Compare" approach to compare file names (see Comparing Unicode file names the right way and Win32 File Name Comparison), so there's a high chance that user names follow the same comparison rules (user folders created under "Users" folder are part of the file system). Comparison using invariant locale should be pretty close to it, but I'm not sure.

    User locale, user UI locale etc. are definitely not used, because that would make opersting system objects depend on user settings.