by Michael S. Kaplan, published on 2007/08/08 07:12 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/08/08/4291958.aspx
One can get into trouble when one mixes metaphors....
Take for example the GetSystemDefaultLCID function from the Win32 API, which as the documentation claims will "Returns the locale identifier for the system default locale." We know that this is the language for non-Unicode programs, which is not entirely relevant here so we'll ignore that for a moment.
Then take the GetUserDefaultLCID function, also from the Win32 API. It is documented that it "Returns the locale identifier for the user default locale." This will be done for the current user, or sometimes an impersonated user if that user's profile is available (for more on that issues see my old post Impersonation and NLS).
Okay, now what happens if you are running code in a service that is running under the "LocalSystem" account, also known as SYSTEM.
The current user is the system, so shouldn't that mean that GetSystemDefaultLCID and GetUserDefaultLCID should return the same thing?
Well, it turns out they don't. Because the user locale of the system account is not the system locale, at all. They are entirely separate and unrelated....
This post brought to you by δ (U+03b4, a.k.a. GREEK SMALL LETTER DELTA)
# Mike Dimmick on 8 Aug 2007 11:59 AM:
It's the locale of the default user profile, isn't it? As I recall, the only way to change that in the UI (in XP and 2003) is to click the checkbox under 'Default user account settings' on the Advanced tab of Regional and Language Options.
My recollection is that it's not possible to edit this setting through the regular UI in Windows 2000 (might be possible in TweakUI!)
# Michael S. Kaplan on 8 Aug 2007 12:52 PM:
Indeed, it is -- no direct way to change though I think you could use the unattend support running under the system account in Win2000....
neeraj on 15 Jun 2010 7:27 AM:
how do we set the system accounts locale then?
Michael S. Kaplan on 15 Jun 2010 7:31 AM:
See the earlier comments about this, which explain how to do this on >= Windows XP.
ciscogambo on 13 Jul 2010 1:19 PM:
Changing the locale of the system account...
On Windows Server 2003 there is a checkbox "Apply all settings to the current user account and to the default user profile" found on Regional and Language Options - Advanced tab.
On Windows Server 2008 there is a button "Change system locale" on the Regional and Language Options - Administrative tab.
Michael S. Kaplan on 13 Jul 2010 2:57 PM:
Actually, in Server 2008 and Server 2008 R2, it is the "Copy Settings" button that does the same thing. NOT the other button you mention...
2008/08/05 On describing poorly (and on not listening)
go to newer or older post, or back to index or month or day