views:

35

answers:

1

I am using French Localized Windows Operating system.

I am using GetUserName() Windows API to get current logged in username for the process.

On French Windows it returns "Système" instead of "System" for the Service process. Because of this our System Software failing in a specific scenario.

Is there any way to get English UserName on French Windows ?

+2  A: 

I might be mixing up the accounts now, but I think you should be comparing using the SIDs rather than the usernames. For example, the Local System account always have SID S-1-5-18.

You can find a list of standard SIDs here: Well-known security identifiers in Windows operating systems

And if you need to go from account name to SID you can use the LookupAccountName API (maybe easier ways of doing it, but that was the first one I could think off).

ho1
according to MSDN on `LocalSystem` ( http://msdn.microsoft.com/en-us/library/ms684190(VS.85).aspx ) even though the user name is localized, you *should* be able to use .\LocalSystem as an account name, just not for `LookupAccountName` since Local System isn't recognized by the security subsystem
Yoni H
@Yoni: Though I think the problem is that he's not "using" it, but rather is trying to compare it against a string. But I forgot that you can't "look up" `Local System`.
ho1