Archive: HKCR\AppID registry write problem


HKCR\AppID registry write problem
Hi Guys,

I am writing a registry key to HKey_Class_Root\AppID directory.

Here is my script:

WriteRegStr HKCR "AppID\myregister" "(Default)" "myregistervalue"
The issue is, when I ran my NSIS script, windows process monitor (procmon.exe) showed the installer tried to open HKey_Class_Root\AppID\myregister registry key, got "NAME NOT FOUND" as return, and wrote to HKey_Current_User\Software\Classes\AppID\myregister instead.

Now when I looked in registry editor, the key was written to "HKey_Class_Root\AppID\myregister", which was the intended destination.

But when I ran the installed application, the application could not open the "HKey_Class_Root\AppID\myregister" registry key, which is inline with what windows process monitor (procmon.exe) showed during installation.

I am wondering what could possibly cause this. Any help would be appreciated.

You can't use "(Default)" for the default value.

Use..

WriteRegStr HKCR "AppID\myregister" "" "myregistervalue"
instead.

Zinthose:

Thanks. But the issue still persists.


Are you sure the app is reading the same value? Double check the registry keys. Is the application reading from a key named "(Default)" or is it reading the default key?

If you are wrapping an existing installer, like an MSI, changing the installation context could fix it. ALLUSERS=1

Is the application encountering a possible security context issue? Try running the installed application as an administrator and check.

Also, you could try and write to the HKLM classes as it is essentially the same thing.

WriteRegStrHKLM"SOFTWARE\Classes\AppID\myregister""""myregistervalue"


HKCR is actually a merged view of HKCU\software\classes and HKLM\software\classes, so in processs monitor, you might see reads for both if HKCU is empty etc


Hey thanks everyone. I checked for "default" variable name, and wrote to HKLM, it solved the problem:).