LocalSystem is people, too!

by Michael S. Kaplan, published on 2007/10/18 10:16 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/10/18/5508827.aspx


Glenn asks:

Hey Michael...

I have a question about the culture info and these settings in the registry. Seeing you have posted a lot of info about this on your blog I was hoping you could help me out a bit :) The question :

I was wondering if I could somehow change the settings of following Registry : HKEY_USERS\.DEFAULT\Control Panel\Internation by means of the use of a CultureInfo I've created in C# using a LCID ?

In other words can I manipulate this through use of any .Net class ? Or do I really have to copy all values ?

Any thoughts ?

Greets
Glenn

There is no .NET way to modify this account's settings (basically the LocalSystem account), though there is one programmatic way: if you have code running in that account you can call SetLocaleInfo (which does really stink but can be useful in this scenario) to update settings.

Note that this will only work for the "current user" of the LocalSystem account, which is what this registry key contains. And although the registry is undocumented, the SetLocaleInfo functionality is not.

Of course, impersonation is (generally speaking) out of the question for security reasons, so you do have to be running within the account; perhaps you were there anyway. Though caution is warranted in that case, because you are exposing the surface area a bit in case there is any flaw or vulnerability in your code. So be very careful about running as such a privileged user!

 

This post brought to you by ƺ (U+01ba, a.k.a. LATIN SMALL LETTER EZH WITH TAIL)


no comments

referenced by

2011/09/01 There is no spoon^H^H^H^Hystem calendar

go to newer or older post, or back to index or month or day