views:

746

answers:

4

I have several VB6 ActiveX server exe files which need to be registered on install before they can be used.

I have tried using Heat to extract the information but it only generates a file element.

These files can be registered by calling them with the /regserver switch and unregister by calling them with the /unregserver switch. I understand this is not the correct way to this. Instead I should add the registry keys and other required elements to my wix source.

My question is how do I find out what registry keys and other element I require to register these ActiveX exe files. Seeing as Heat seems unable to harvest this information.

A: 

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>
jeffamaphone
+1  A: 

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 :-)

Wim Coenen
+2  A: 

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).

wqw
A: 

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%5Fanalyze.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 I want to offer you to send me the EXE files (and any dependencies required to make them launch). I can then 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.

Glytzhkof