Search code examples
c#wixregistryinstallationwix3.5

Registry For All Users


I create a per machine installer for a dll.

The registry is created properly under HKEY_LOCAL_MACHINE.

The class definition under HKEY_CLASSES_ROOT is creates only for the user who installed the program. The rest of the users on the same machine are missing this registry.

From this my conclusion id thata the HKEY_CLASSES_ROOT is individual per user. Where is the registry that keeps the classes data for all users?

EDIT : This is how I define the COM registry for the local machine:

<Class Id="{1AF5E2B9-CC02-368F-A879-1DF3F538D71A}" Context="InprocServer32" Description="AdminAddins.MyClass" ThreadingModel="both" ForeignServer="mscoree.dll">
        <ProgId Id="AdminAddins.MyClass" Description="AdminAddins.MyClass" />
</Class>  

<File Id="fil08256E64C10A4B2F5423A768ECB9A473" Name="AdminAddins.dll" KeyPath="yes" Source="..\AdminAddins\bin\Release\AdminAddins.dll" />

<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{1AF5E2B9-CC02-368F-A879-1DF3F538D71A}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{1AF5E2B9-CC02-368F-A879-1DF3F538D71A}\InprocServer32\1.0.5300.19297" Name="Class" Value="AdminAddins.MyClass" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{1AF5E2B9-CC02-368F-A879-1DF3F538D71A}\InprocServer32\1.0.5300.19297" Name="Assembly" Value="AdminAddins, Version=1.0.5300.19297, Culture=neutral, PublicKeyToken=null" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{1AF5E2B9-CC02-368F-A879-1DF3F538D71A}\InprocServer32\1.0.5300.19297" Name="RuntimeVersion" Value="v2.0.50727" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{1AF5E2B9-CC02-368F-A879-1DF3F538D71A}\InprocServer32\1.0.5300.19297" Name="CodeBase" Value="file:///[#fil08256E64C10A4B2F5423A768ECB9A473]" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{1AF5E2B9-CC02-368F-A879-1DF3F538D71A}\InprocServer32" Name="Class" Value="AdminAddins.MyClass" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{1AF5E2B9-CC02-368F-A879-1DF3F538D71A}\InprocServer32" Name="Assembly" Value="AdminAddins, Version=1.0.5300.19297, Culture=neutral, PublicKeyToken=null" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{1AF5E2B9-CC02-368F-A879-1DF3F538D71A}\InprocServer32" Name="RuntimeVersion" Value="v2.0.50727" Type="string" Action="write" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\CLSID\{1AF5E2B9-CC02-368F-A879-1DF3F538D71A}\InprocServer32" Name="CodeBase" Value="file:///[#fil08256E64C10A4B2F5423A768ECB9A473]" Type="string" Action="write" />

Solution

  • From MSDN:

    Class registration and file name extension information is stored under both the HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER keys. The HKEY_LOCAL_MACHINE\Software\Classes key contains default settings that can apply to all users on the local computer.

    The HKEY_CURRENT_USER\Software\Classes key contains settings that apply only to the interactive user. The HKEY_CLASSES_ROOT key provides a view of the registry that merges the information from these two sources. HKEY_CLASSES_ROOT also provides this merged view for applications designed for previous versions of Windows.

    This looks useful too:

    To change the default settings, store the changes under HKEY_LOCAL_MACHINE\Software\Classes. If you write keys to a key under HKEY_CLASSES_ROOT, the system stores the information under HKEY_LOCAL_MACHINE\Software\Classes. If you write values to a key under HKEY_CLASSES_ROOT, and the key already exists under HKEY_CURRENT_USER\Software\Classes, the system will store the information there instead of under HKEY_LOCAL_MACHINE\Software\Classes.