The "RegistryImport" Command |
This command is used to import a ".reg" file in "REGEDIT4" format. This sort of file can be created by "REGEDIT.EXE".
This command is handy if you wish to perform the translation for every build (perhaps someone supplies the REGEDIT4 file to you as a way of supplying updates), however if it is a once off process and you'd like to do it once (and/or the contents includes values you need to "tweek") then have a look at the "Registry Conversion" section of this document.
Please see the "options for commands" section of the manual for generic configuration details on how these options can be altered:
#define? REGIMPORT_DIE_ON_UNKNOWN_HIVES Y #define? DEFAULT_REGIMPORT_SPECIALFOLDER_TRANSLATIONS Y #define? REGIMPORT_DEFAULT_COMPONENT_EXP 'REGIMPORT_' || {$HiveVar} ;--- These should contain rexx code, they are passed the NAMES of variables containing the data --- #define? REGIMPORT_REXXCODE_HOOK_FILELINE_MANIPULATION ;;Gets passed "LINEVAR", called very soon afrer line from file read. #define? REGIMPORT_REXXCODE_HOOK_STRING ;;Gets passed a STRING's "NAMEVAR" & "VALUEVAR"
This command takes these parameters:
Due to Windows Installer limitations not all such references can be handled so "c:\winnt\" will be translated but "c:\winnt" will not be.
The default for this parameter can be set via the DEFAULT_REGISTRYIMPORT_SPECIALFOLDER_TRANSLATIONS macro. The initial value for this is "Y".
It is possible to alter the import configuration. See "ImportTranslations.mmh" for more information, the following worked for one user:
#( <$ImportTranslationAdd FromExp=^'C:\Program Files\MyTopDir\'^ ToExp=^'[INSTALL_BASE_FOLDER]'^> > #)
If a component is created for you then it will be created in the "current" feature with default options (see the "Component" command).
EXAMPLE |
The following command imports registry entries, creating all required components:
<$RegistryImport "test.re4" CURRENT_USER="" LOCAL_MACHINE="" CLASSES_ROOT="">
An example using hooks:
;--- Replace any tabs with a space --- #DefineRexx+ 'REGIMPORT_REXXCODE_HOOK_FILELINE_MANIPULATION' {$LINEVAR} = ReplaceString({$LINEVAR}, '09'x, ' '); #DefineRexx ;--- When I use regasm to create a .reg format file from a .NET assembly, ;--- the file paths are formatted like this, with forward-slashes rather ;--- than back-slashes: ;--- "CodeBase"="file:///C:/Program Files/kutana/Kappris/KSupport3.dll" #DefineRexx+ 'REGIMPORT_REXXCODE_HOOK_STRING' if left({$VALUEVAR}, 8) = 'file:///' then {$VALUEVAR} = ReplaceString(substr({$VALUEVAR}, 9), '//', '\') #DefineRexx <$RegistryImport "DotNetRegAsmOutput.re4" CURRENT_USER="" LOCAL_MACHINE="" CLASSES_ROOT="">