views:

894

answers:

4

I have a problem where the user has set their locale (German) which is different that the Language Windows was installed as (English). Is there a way to discover what language windows was installed to use vs. what locale the user has set? I should note the issue is I am creating a Share and I set the permissions based on the Locale so if the User has set the Locale to German the permission for "Everyone" is "Jeder" but if the OS is setup for English this will fail since the is not an Id for "Jeder"

Thanks

A: 

I imagine you could enumerate the language packs installed, but might not be able to retrieve what language was used during the install unless you have access to the install logs.

Chris Ballance
+1  A: 

Windows has the concept of the "UserLanguage" and the "SystemLanguage". What you are asking for is the SystemLanguage. Get that, and you'll have the correct answer.

Update: The Win32 function you want is GetSystemDefaultUILanguage()

Retrieves the language identifier for the system default UI language of the operating system, also known as the "install language" on Windows Vista and later.

http://msdn.microsoft.com/en-us/library/dd318123(VS.85).aspx

Note that Windows Installer can query the property "SystemLanguageId". (in case you're interested from an instller point of view)

William Leara
I'm using InstallAnywhere which doesn't appear to have access to SystemLanguageId. I can just do the registry lookup call instead.
Javamann
Not exactly what I was looking for but it pointed me to where the answer was (after 40 google searches)
Javamann
A: 

Why would you be coding against the word "Everyone" or "Jeder"? Isn't there a variable you can check?

Albert
Being windows I am sure this is.
Javamann
A: 

The question's title and the question itself are different issues. You're trying to create an "Everyone" SID, but you're going about it in a way that depends on the locale. The solution to your problem is to not use a locale-dependent method. Use the CreateWellKnownSid API. The MSDN page on CreateWellKnownSid even has code for creating an Everyone SID.

Michael Dunn
I am trying to set share permissions from InstallAnywhere and limited in options. Thanks for the pointer to the Windows API.
Javamann