How to write in a registry key own by TrustedInstaller

前端 未结 3 1930
[愿得一人]
[愿得一人] 2021-02-19 17:21

In order to install a new property page into the Active Directory SnapIn, I need to write into the following registry key of W2K8 R2 (as documented by Microsoft)

HKEY_LO

3条回答
  •  遥遥无期
    2021-02-19 17:47

    If you run program as an administrator (don't forget to enable 'requireAdministrator' as the UAC execution level in the manifest) or any other user having SE_RESTORE_NAME privilege you can enable the privilage and then use RegCreateKeyEx with REG_OPTION_BACKUP_RESTORE flag. You can use the same flag in RegOpenKeyEx (see ulOptions parameter), but it is undocumented and I would recommend you better to use RegCreateKeyEx instead. The key handle returned can be used to set the value with respect of RegSetValueEx for example. In the way you will be able to set any registry key. If you additionally enable SE_BACKUP_NAME privilege you will be able to read any registry key (for example from HKEY_LOCAL_MACHINE\SECURITY or HKEY_LOCAL_MACHINE\SAM\SAM).

提交回复
热议问题