musabio
12-27-2008, 11:35 AM
Under Vista Ultimate SP1 and SB Developer Edition 6.9.2415, I'm trying to import a REG file but without success. I start by exporting the REG file from REGEDIT on the same machine, and it looks like this:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\MSAB\JBCT\ATE]
[HKEY_LOCAL_MACHINE\SOFTWARE\MSAB\JBCT\ATE\HostList]
@="HB"
"HB"="1"
[HKEY_LOCAL_MACHINE\SOFTWARE\MSAB\JBCT\ATE\Hosts]
[HKEY_LOCAL_MACHINE\SOFTWARE\MSAB\JBCT\ATE\Hosts\HB]
"Transport"="TELNET"
"TTY"="AM75G"
"Address"="1.2.3.4"
I click on the Registry item in the Visualizer, then right click on HKEY_LOCAL_MACHINE, select Import REG, and select my .REG file. The import dialog appears and the progress bar quickly goes from 0 to 100%, and the Finish button becomes enabled, but the "Lines Processed" remains at 0, and there is no sign of anything having been added to the script. (And running the script doesn't install the registry items.)
Am I missing some detail? Note that the REG file is not corrupt, as it can be imported successfully by REGEDIT. I've also tried exporting and importing other registry folders, but always get the same result. Also note that my installation runs elevated, so SB asks me to elevate when I launch it.
The doc says to first "select the feature with which you want to associate the imported keys and values", but the registry hives in my case are all listed under "always install". Yet if I highlight the "Registry 'Always Install'" item at the top of the registry hierarchy in the left pane, rather than the HKEY_LOCAL_MACHINE folder, and then try to import from the shortcut menu, the open dialog never appears. So it seems necessary to select or at least right click on one of the actual registry root folders first (although that seems a bit weird to me, given that the REG file contents are "absolute").
Related question about HKCU: I gather that you can't very well import into the HKEY_CURRENT_USER hive if running the installation elevated. Assuming that's true, what are the preferred workarounds? Most of the discussion about this issue on this forum seems to revolve around uninstallation, but the issues are slightly different there in that the app has already been installed, so you can more easily write a custom uninstall and launch it from the app itself, or the start menu. One obvious solution would be to run the install in non-elevated mode, but since the installation involves several sub-tasks that would then individually require elevation, that seems pretty dreadful. Another idea is to install into some non-user-specific hive, like HKLM, and then let the app transfer it to the HKCU when the app is launched, but one downside of that is the non-elevated app may not be able to remove the items from the HKLM. I take there is no way way to de-elevate from within the elevated install program, in order to import the REG items and/or ShellExecute. Any suggestions would be welcome.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\MSAB\JBCT\ATE]
[HKEY_LOCAL_MACHINE\SOFTWARE\MSAB\JBCT\ATE\HostList]
@="HB"
"HB"="1"
[HKEY_LOCAL_MACHINE\SOFTWARE\MSAB\JBCT\ATE\Hosts]
[HKEY_LOCAL_MACHINE\SOFTWARE\MSAB\JBCT\ATE\Hosts\HB]
"Transport"="TELNET"
"TTY"="AM75G"
"Address"="1.2.3.4"
I click on the Registry item in the Visualizer, then right click on HKEY_LOCAL_MACHINE, select Import REG, and select my .REG file. The import dialog appears and the progress bar quickly goes from 0 to 100%, and the Finish button becomes enabled, but the "Lines Processed" remains at 0, and there is no sign of anything having been added to the script. (And running the script doesn't install the registry items.)
Am I missing some detail? Note that the REG file is not corrupt, as it can be imported successfully by REGEDIT. I've also tried exporting and importing other registry folders, but always get the same result. Also note that my installation runs elevated, so SB asks me to elevate when I launch it.
The doc says to first "select the feature with which you want to associate the imported keys and values", but the registry hives in my case are all listed under "always install". Yet if I highlight the "Registry 'Always Install'" item at the top of the registry hierarchy in the left pane, rather than the HKEY_LOCAL_MACHINE folder, and then try to import from the shortcut menu, the open dialog never appears. So it seems necessary to select or at least right click on one of the actual registry root folders first (although that seems a bit weird to me, given that the REG file contents are "absolute").
Related question about HKCU: I gather that you can't very well import into the HKEY_CURRENT_USER hive if running the installation elevated. Assuming that's true, what are the preferred workarounds? Most of the discussion about this issue on this forum seems to revolve around uninstallation, but the issues are slightly different there in that the app has already been installed, so you can more easily write a custom uninstall and launch it from the app itself, or the start menu. One obvious solution would be to run the install in non-elevated mode, but since the installation involves several sub-tasks that would then individually require elevation, that seems pretty dreadful. Another idea is to install into some non-user-specific hive, like HKLM, and then let the app transfer it to the HKCU when the app is launched, but one downside of that is the non-elevated app may not be able to remove the items from the HKLM. I take there is no way way to de-elevate from within the elevated install program, in order to import the REG items and/or ShellExecute. Any suggestions would be welcome.