[Patch] regtool: Add load/unload commands and --binary option

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Jan 25 10:52:00 GMT 2006

On Jan 24 21:00, Christian Franke wrote:
> Hi,
> the attached patch adds commands "load" and "unload" and options "-b, 
> --binary" to regtool.
> Load a registry hive from PATH into new SUBKEY:
> regtool load KEY\SUBKEY PATH
> Unload and remove SUBKEY later:
> regtool unload KEY\SUBKEY
> Print REG_BINARY value as hex:
> regtool -b get KEY\VALUE
> Set REG_BINARY value from hex args:
> regtool -b set KEY\VALUE XX XX XX XX ...
> Example:
> Suppose S:\ is a partition on a second HD which contains a copy of all 
> files of XP system partition C:\.
> The following script fixes the logical drive mappings of the backup 
> installation.
> This allows booting backup drive S:\ as C:\ after original C:\ drive has 
> been removed.
> #!/bin/sh
> set -e
> # Load backup SYSTEM hive as SYSTEM.TMP
> regtool load /HKLM/SYSTEM.TMP /cygdrive/s/WINDOWS/system32/config/system
> trap 'regtool unload /HKLM/SYSTEM.TMP' ERR
> # Remove all logical drive mappings in backup
> # (Somewhat tricky, because key value names contain backslashes)
> for v in $(regtool list /HKLM/SYSTEM.TMP/MountedDevices |
>          sed -n '/^\\DosDevices\\[C-Z]:$/s,\\,/,gp')
> do
>  regtool -K, unset "/HKLM/SYSTEM.TMP/MountedDevices,$v"
> done
> # Map current S:\ as C:\ in backup
> m=$(regtool -K, -b get /HKLM/SYSTEM/MountedDevices/,/DosDevices/S:)
> regtool -K, -b set /HKLM/SYSTEM.TMP/MountedDevices/,/DosDevices/C: $m
> # Unload hive
> trap '' ERR
> regtool unload /HKLM/SYSTEM.TMP
> # End of script
> ####################
> Thanks for any comment

Thanks for this patch, it looks pretty useful.  There are just two
things missing.  First, could you please create a matching ChangeLog
entry?  Second, worse, I don't see your name on the list of people
having a copyright assignment in place, which is definitely necessary
for a patch of this size.  We need a written copyright assignment from
you once, after that, you can create as many patches as you like.
Please see http://cygwin.com/contrib.html for the gory details about
the copyright assignment form and how to send it to Red Hat.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-patches mailing list