简体   繁体   中英

add item to key in registry with vb or c# AND get Administrative Access

I want add item to a key in registry and find "CreateSubKey" command but point is this command create sub key not item to a key. for example path of "Computer\\HKEY_USERS.DEFAULT\\Control Panel\\International" has about 40 item and 3 sub key. I want add item to "\\International" not sub key.

another problem is that when I want add subkey to another users in "Computer\\HKEY_USERS" path ,I got error "cant access other user registry" .how could I handle that with code without login as admin in windows?

LOOK AT PICTURE: enter image description here best regards.

Create the key you are interested in and then set the values :

RegistryKey rk = Registry.Users.CreateSubKey("DEFAULT\\Control Panel\\International");
rk.SetValue("a number", 42);
rk.SetValue("my string", "fiftythree");

You have to be elevated administrator to modify keys in roots other than CurrentUser. Normal users are not allowed to modify machine settings nor the settings of other users.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM