4

I have the following WiX code that registers a COM server component

<Component Id="ServerComponent" Guid="<someguid>">
    <File Id="comserverid" Name="comserver.exe" Source="path_to_com_server" DiskId="1" Checksum="yes" >
        <TypeLib Id="{<TYPELIBGUID>}" Description="ComServer 1.0 Type Library"  HelpDirectory="INSTALLLOCATION"  Language="0" MajorVersion="1" MinorVersion="0">
            <AppId Description="ComServer" Id="{<APPIDGUID>}}">
                <Class Id="{<SOMECLASSGUID>}" Context="LocalServer32" Description="ComServerClass Class" ThreadingModel="apartment" Advertise="no">
                    <ProgId Id="ComServer.ComServerClass.1" Description="ComServerClass Class">
                        <ProgId Id="ComServer.ComServerClass" Description="ComServerClass Class" />
                    </ProgId>
                </Class>
            </AppId>                                
        </TypeLib>
    </File>
    <RegistryValue Root="HKCR" Key="AppID\comserver.exe" Name="AppID" Value="{<APPIDGUID>}" Type="string" Action="write" />
</Component>

And it successfully registers the server, but when I the run program in "run as" mode, the program didn't see the COM server.

Please advice - how I should change the WIX code

Update: The answer is - run WiX script with elevated permissions or run comserver.exe /regserver with elevated permissions, but it doesn't work. I think that the script above is useful, so I leave question as is and create a slightly different question

Wolf
  • 9,679
  • 7
  • 62
  • 108
se_pavel
  • 2,181
  • 1
  • 28
  • 42
  • 1
    What happens if you manually register COM server `comserver.exe /regserver`? Can you use COM object from your program? I suspect that the problem is not in WIX but in your COM server. – Jacob Seleznev Aug 14 '12 at 13:41
  • You might want to increase your accepte rate to solicit more answers. – Christopher Painter Aug 14 '12 at 14:21
  • comserver.exe /regserver under user with admin rights executed sucessfully, HKLM values are correct, but I can't get interface of the COM object – se_pavel Aug 15 '12 at 17:11

1 Answers1

2

Check the value of your ALLUSERS property. You should be defining it to 1 or 2 if you want a per-machine install. If it installs as per-user the registry updates will be written to HKCU instead of HKLM. ( HKCR can point to either HKCU\Software\Classes or HKLM\Software\Classes depending on the scope of the installation ).

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • I want to avoid this, because my program planned to be installed only per user, not per machine. – se_pavel Aug 14 '12 at 15:39
  • I see you accepted the answer but I don't follow your goals. If you want to install per-user, why would you expect the COM server to exist for another user profile? – Christopher Painter Aug 14 '12 at 19:30
  • @ChristopherPainter Most probably caused by the *`"run us"`* aspect of the question: the COM server registration is done for the normal user, but the client program is run as the user with the admin rights. – Wolf Aug 05 '16 at 11:02