MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: /Schedule[Next]: ServiceControl
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Source Code->Commands->SelfRegister

The "SelfRegister" Command

This command is used to perform self registration and unregistration similar to that performed by the "REGSVR32.EXE" command.

The "File" and "Files" commands both have a "SelfReg" parameter which can invoke this command. Not only is this a single step operation but you also don't need to know the file's key.

The windows installer documentation states that this does not support ".EXE" files. To handle EXE files you could use the "ExeCa" command, once to register with "/REGSERVER" and again to unregister with "/UNREGSERVER".

The processing of the "SelfReg" table is table is undocumented so the order of registration is uncertain. If one of your registrations requires another registration to have already occurred then you must use the "order" parameter to ensure this ordering. You could use "Dependency Walker" to check for this as it shows dependent DLLs etc.

This command takes these parameters:

Error Handling

Windows Installer detects errors (registration only) for unordered self registrations however by default this command uses "msiexec.exe" for ordered registrations and this does not allow errors to be detected (another one to thank Bill for...).

It is possible to configure this command to use other registration executables such as "REGSVR32.EXE" which does appear to return meaningful return codes allowing you to alter the custom action type to check for errors.

Main Options

Please see the "options for commands" section of the manual.

#define? SELFREG_REGISTER_BY_SEQ                   RegisterComPlus      ;;All Ordered Registrations must be complete before this action
#define? SELFREG_UNREGISTER_FROM_SEQ               UnregisterComPlus    ;;No ordered unregistration at or before here
#define? SELFREG_ORDERED_CA_TYPE                   &H0C62               ;;As per MS MSI.CHM example (3170) - MSIEXEC.EXE doesn't return meaningful RC (more MS crap)!?
#define? SELFREG_ORDERED_REXXEXP_REGISTRATION      '"[SystemFolder]msiexec.exe" /y "[#' || {$FileKeyVar} || ']"'  ;;You could use "regsvr32.exe" which returns RC info...
#define? SELFREG_ORDERED_REXXEXP_UNREGISTRATION    '"[SystemFolder]msiexec.exe" /z "[#' || {$FileKeyVar} || ']"'
#define? SELFREG_ORDERED_KEY_PREFIX_REGISTRATION   Sr.R.                                                          ;;Start of Custom Action Name
#define? SELFREG_ORDERED_KEY_PREFIX_UNREGISTRATION Sr.U.                                                          ;;Start of Custom Action Name

EXAMPLE

<$Component "SomeFiles" Create="Y" Directory_="INSTALLDIR">
   ;--- Unordered -----------------------------------------------------------
   <$File SOURCE="SomeDll.DLL" RowKey="SomeDLL.DLL" KeyPath="Y" EXLIST="MY_DDLS">
   <$SelfRegister "SomeDLL.DLL">        ;;Not component specific - just keeping related items together

   ;--- We need these to occur in order -------------------------------------
   <$File SOURCE="SomeDLLOther1.DLL" RowKey="SomeDLLOther1.DLL" EXLIST="MY_DDLS">
   <$File SOURCE="SomeDLLOther2.DLL" RowKey="SomeDLLOther2.DLL" EXLIST="MY_DDLS">
   <$SelfRegister "SomeDLLOther1.DLL" Order="next">
   <$SelfRegister "SomeDLLOther2.DLL" Order="next">

   ;--- We have some other DLLS we wish to pick up... -----------------------
   <$Files "*.dll" EXLIST="MY_DDLS">        ;;All DLLS except those already handled.
<$/Component>


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006 & 2007 for the Windows SDK (Windows Installer) area.This external link was OK when tested at 9 Sep 2008Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: /Schedule[Next]: ServiceControl


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday September 13 2008 at 2:32pm
Visit MAKEMSI's Home PageThis external link was OK when tested at 28 Aug 2008

HTML page dated Mon, 29 Jan 2007 00:11:11 GMT
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006 & 2007 for the Windows SDK (Windows Installer) area.This external link was OK when tested at 9 Sep 2008