开发者

Windows registry keys for applications for all users in machine

If I install an application on windows XP and that application writes some keys to HKCU registry , then will those keys be copied to HKCU for other users?

I tried installing one application and verified some keys getting created in HKCU. Now I logged in into another user and I can find same keys in HKCU for that user.

Both the users were in same Administrator group.

I repeated the same steps in VMWare image of windows xp but I was not able to find the registry keys in other users in vmware image.

I want to know that is it wind开发者_开发技巧ows feature to copy all registry keys in HKCU of all users?


No, and that's a very good thing. There are corporate machines in big companies that are usable by 100.000 other users (no joke). HKCU is roaming there. If an application would pull in all those 100.000 profiles from across the world, literally, administrators would be more than a little angry.

Note that HKCU usually is a link to HKEY_USERS\S-1-5-21-{UserID}


There are one nice feature of Windows which can be used to implement the scenario which are very close to what you need. The name of the feature is "Active Setup". The feature use many administrators of corporate network to make some customization of the installed software which will be done with respect of changes in the user profile or HKCU.

After introducing of Internet Explorer 4 (I hope it was IE4) Microsoft find out that sometime one need be able to run small setups which can modify HKCU setting or modify some files from the user profile. So Microsoft made some components of IE4 which do this. Later the components (the Active Setup) was the part of the Windows operation system.

Since the time one can use following registry keys to do this

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\[Guid]

and

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Active Setup\Installed Components\[Guid]

The main setup of a software run in administrative context and create HKLM key SOFTWARE\Microsoft\Active Setup\Installed Components\[Guid] with some values. The most important are the REG_EXPAND_SZ value with the name StubPath and the Version value. The StubPath define the path to the mini-setup which should be run if the user login and he don't has SOFTWARE\Microsoft\Active Setup\Installed Components\[Guid] in his HKCU part. After the run of the mini-setup it make the copy of SOFTWARE\Microsoft\Active Setup\Installed Components\[Guid] values from HKLM to HKCU, so the setup will not be started at the next login. So the HKLM values define the mini-setup and HKCU values are used for verification whether the mini-setup must be run/re-run. If one increase the value of the Version value in HKLM part, the mini-setup will be re-run once and the HKCU value of Version will be updated.

So the main software setup can not only create some HKCU settings, but also for example export it in the reg-file and it can use regedit.exe /s TheRegFile.reg as the value of StubPath.

If can read here short description of the Active Setup.


No you can't do this. What's more it would be a giant security hole if you could. Profiles are private to each user.


No. There is no such feature. HKCU is stored in a file in the user's profile. Applications that keep data per user in the registry create the data on the first run for that user.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜