Search code examples
registryinno-setuppascalscript

Why is it not recommended to use HKCR registry root key in Inno Setup?


I have to write a value to the HKEY_CLASSES_ROOT key. In order to do that I would write:

RegWriteStringValue(HKCR, '<Root>', '<SubKey>', '<Value>');

But when I looked in the documentation I saw this:

Using HKCR is not recommended, use HKA with the Subkey parameter set to "Software\Classes" instead.

I'd like to know what's the difference between the two?

Also, I've noticed that in the examples in the documentation they use HKEY_AUTO instead of HKA. Are those the same?


Solution

  • It is probably based on Microsoft recommendations for avoiding use of HKEY_CLASSES_ROOT:

    It is primarily intended for compatibility with the registry in 16-bit Windows.

    To change the settings for the interactive user, store the changes under HKEY_CURRENT_USER\Software\Classes rather than HKEY_CLASSES_ROOT.

    To change the default settings, store the changes under HKEY_LOCAL_MACHINE\Software\Classes

    Processes running in a security context other than that of the interactive user should not use the HKEY_CLASSES_ROOT key with the registry functions.