cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
bperret065
Level 3

RegDBSetKeyValue error ACCESS_DENIED on HKCU\...\Policies subkey

In a basic MSI project,

I want to create a subkey in HKCU\SOFTWARE\Policies
(the whole key is HKCU\SOFTWARE\Policies\Microsoft\Edge\ExtensionInstallForcelist (*) )
Then I want to set a value and its data under this key.

1°) I create the subkey within a Component. this step is good: the subkey is well installed.

2°) Then i set the value by an InstallScript Custom Action.
the function code contains a call to RegDBSetKeyValueEx with the specified key (*).

This step runs into an error:
The problem is that RegDBSetKeyValueEx fails to update the data
with error ACCESS_DENIED.

The custom action is run in deffered context.

Can I call directly the Win32 API RegSetKeyValue with my script  instead?
https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regsetkeyvaluea

What is the prototype to declare in my script ?

Thanks.

Labels (1)
0 Kudos
(0) Replies