Register ActiveX exe server using WiX

吃可爱长大的小学妹 提交于 2019-11-30 22:39:29

I had the same problem with tallow from WiX 2.0 and had to implement registry harvesting for out-of-proc servers. Here is the patched tallow. Would be nice to merge the ProcessWithInjectedDll class to Heat and probably converge to the main trunk at some point.

Beware that lots of cruft from VB6 runtime gets in the generated registry keys. The generated output is unusable without some tweaking. That's when CleanupRegInclude.vbs can be useful.

Last but not least, absolute filenames and paths are useless. You have to use #YourComponent and $YourComponent instead (check the MSI documentation).

ActiveX controls are just COM objects. The minimum amount of registration you need to do is something like this:

  <RegistryKey Root="HKCR" Action="createAndRemoveOnUninstall" Key="CLSID\{YOUR-GUID-HERE}">
    <RegistryKey Action="createAndRemoveOnUninstall" Key="InprocServer32">
      <RegistryValue Action="write" Value="[INSTALLDIR]YOUR-DLL-HERE.dll" Type="string"/>
      <RegistryValue Action="write" Name="ThreadingModel" Value="Apartment" Type="string"/>
    </RegistryKey>
  </RegistryKey>

You may want to register a Prog ID:

    <RegistryKey Action="createAndRemoveOnUninstall" Key="ProgID">
      <RegistryValue Action="write" Value="YOUR.PROGIDHERE" Type="string"/>
    </RegistryKey>

how do I find out what registry keys and other element I require to register these ActiveX exe files

In general, you can discover registry changes like this:

  1. Bring the registry in a clean state, e.g. use myapp.exe /unregserver

  2. Create a dump of the registry content like this

    c:\WINDOWS\system32\reg.exe export dump1.reg
    
  3. Run the command that will change the registry, e.g. myapp.exe /regserver

  4. Create another dump2.reg of the registry.

  5. Find the differences between dump1.reg and dump2.reg with a diffing tool (e.g. TortoiseSVN adds a "diff" command to the explorer context menu when you have two files selected)

There might be some noise in the differences that you should ignore. A typical example is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\RNG\Seed. This registry key is used by the windows CryptoAPI to store continuously gathered entropy. Incidentally, this key sometimes shows up in MSI packages generated by commercial setup generators. This seems to indicate that they use a similar registry-sniffing technique :-)

I thought heat.exe had been updated to be able to harvest COM EXE files, but I guess it might not have been implemented yet.

I normally use a tool called RegSpy / RegSpy 2 to extract COM info from DCOM EXE files: http://www.installsite.org/pages/en/tt_analyze.htm#RegSpy.

Using the above tool will give you a reg file, but you will still need to convert to WIX format. To get the reg file you go:

regspy2.exe myfile.exe >> myfile.reg

I don't think there is a way to automatically convert a reg file to wxs format (I remember writing a basic converter a while ago, but don't have it here). To make this easy you can extract the info required using Installshield or Wise For Windows Installer, build an MSI and then disassemble the msi to Wix format using the dark.exe (wix decompiler). The resulting Wix markup can then be added to your project.

perlyking

I tried both heat and the regspy mentioned by @Glytzhkof but found that neither did a complete extract of all the relevant registry info for my COM server. I did however find a utility - RegSpyUI - that sort of ships with InstallShield which did a lovely job. Described in more detail here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!