locked
MSI - Create keys under HKLM RRS feed

  • Question

  • In Visual Studio, when creating a Setup project (for an MSI installer), is it possible to instruct it to create keys under HKLM? Can it be done through the Registry section or does it have to be done through code in a custom action?

    • Edited by George Takei Wednesday, November 27, 2013 5:16 PM
    Tuesday, November 26, 2013 5:38 PM

Answers

  • Are you creating them with your own code or with the Registry IDE view in the setup project?

    Phil Wilson

    • Marked as answer by George Takei Wednesday, November 27, 2013 5:22 PM
    Tuesday, November 26, 2013 7:13 PM
  • It should work ok from the IDE, but keep in mind that security rules are still applied - a limited user cannot create keys in HKLM (which is restricted) just because it's an install.  Custom actions can also create them with the same limitations, but there's no point if the IDE will do it, and using the IDE Registry view ensures that they will be removed on uninstall on a failed install.

    Phil Wilson

    • Marked as answer by George Takei Thursday, November 28, 2013 4:37 PM
    Wednesday, November 27, 2013 6:33 PM
  • On a 64 bit system, the tree structure in visual studio: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlook\Addins

    is taken as:

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\Outlook\Addins

    It does create keys under HKLM (assuming permissions and all that) but not in the location given. I was looking in the wrong place. I made the mistake of thinking, because I meticulously reconstructed the exact tree structure and carefully checked that the location in VS matched exactly with the location in the registry, it would give a shit at all.

    • Marked as answer by George Takei Thursday, November 28, 2013 4:37 PM
    Thursday, November 28, 2013 4:36 PM

All replies

  • Are you creating them with your own code or with the Registry IDE view in the setup project?

    Phil Wilson

    • Marked as answer by George Takei Wednesday, November 27, 2013 5:22 PM
    Tuesday, November 26, 2013 7:13 PM
  • IDE

    Tuesday, November 26, 2013 8:54 PM
  • Hi George Takei,

    Could you please make sure you've read this page:

    http://msdn.microsoft.com/en-us/library/windows/desktop/aa371168(v=vs.85).aspx

    And check the following:

    Constant Hexadecimal Decimal Root key
    (none) - 0x001 -1 If this is a per-user installation, the registry value is written under HKEY_CURRENT_USER

    If this is a per-machine installation, the registry value is written under HKEY_LOCAL_MACHINE. Note that a per-machine installation is specified by setting the  ALLUSERS  property to 1.

    msidbRegistryRootClassesRoot 0x000 0 HKEY_CLASSES_ROOT

    The installer writes or removes the value from the HKCU\Software\Classes hive during  installation in the per-user installation context.

    The installer writes or removes the value from the HKLM\Software\Classes hive during  per-machine installations.

    msidbRegistryRootCurrentUser 0x001 1 HKEY_CURRENT_USER
    msidbRegistryRootLocalMachine 0x002 2 HKEY_LOCAL_MACHINE
    msidbRegistryRootUsers 0x003 3 HKEY_USERS

    Regards,

     



    Barry Wang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, November 27, 2013 10:12 AM
  • It should work ok from the IDE, but keep in mind that security rules are still applied - a limited user cannot create keys in HKLM (which is restricted) just because it's an install.  Custom actions can also create them with the same limitations, but there's no point if the IDE will do it, and using the IDE Registry view ensures that they will be removed on uninstall on a failed install.

    Phil Wilson

    • Marked as answer by George Takei Thursday, November 28, 2013 4:37 PM
    Wednesday, November 27, 2013 6:33 PM
  • On a 64 bit system, the tree structure in visual studio: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlook\Addins

    is taken as:

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\Outlook\Addins

    It does create keys under HKLM (assuming permissions and all that) but not in the location given. I was looking in the wrong place. I made the mistake of thinking, because I meticulously reconstructed the exact tree structure and carefully checked that the location in VS matched exactly with the location in the registry, it would give a shit at all.

    • Marked as answer by George Takei Thursday, November 28, 2013 4:37 PM
    Thursday, November 28, 2013 4:36 PM