|
![]() |
| 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:
Like all MSI identifiers it is case sensitive and if an unknown value is used the "MSI validation" step should generate an "ICE03" error with text similar to "Not a valid foreign key; Table: SelfReg, Column: File_, Key(s): SomeKey.DLL".
All Unordered registrations are performed before any ordered ones and their unregistrations occur after all ordered unregistrations.
After the script completes the value supplied on this parameter is used to sort all ordered registration requests into the order they should occur.
As Windows Installer doesn't natively supported
"ordered registrations" these populate the
"CustomAction"
and
"InstallExecuteSequence"
tables.
| 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>
![]() | ![]() |