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

Christian Franke Christian.Franke@t-online.de
Thu Mar 2 20:59:00 GMT 2006


Corinna Vinschen wrote:
> ...
>   
>>    //printf("key `%s' value `%s'\n", n, value);
>>     
>
> Why is this printf commented out?  If it's not needed, please remove.
>   

cvs annotate regtool.cc
...
1.1 (cgf      17-Feb-00):     }
1.1 (cgf      17-Feb-00):   //printf("key `%s' value `%s'\n", n, value);
1.1 (cgf      17-Feb-00): }

Doing code-janitor work on historic code was not the intent of my patch ;-)
Uncommenting this line during testing was helpful, so I left it untouched.


>> @@ -577,7 +647,14 @@
>>    switch (vtype)
>>      {
>>      case REG_BINARY:
>> -      fwrite (data, dsize, 1, stdout);
>> +      if (key_type == KT_BINARY)	// hack
>>     
>
> Hack?  Why hack?  Otherwise, please remove this comment.
>   

Because {re|mis}using "set" key_type for as a "get" option has been 
called a hack many years ago:

1.1 (cgf      17-Feb-00):     case REG_EXPAND_SZ:
1.3 (cgf      10-Jan-01):       if (key_type == KT_EXPAND)    // hack
1.1 (cgf      17-Feb-00):     {


Attached is a new version of the patch.
Thanks to your help regarding SE_BACKUP_NAME, the "save" action is now 
included.

Example: Backup system registry hives
(aka these ugly-forever-locked files in /windows/system32/config ;-)

#!/bin/sh
set -e
d="${1:-.}"

for k in SAM SECURITY SOFTWARE SYSTEM; do
  regtool save /HKLM/$k "$d/$k"
done
regtool save /HKU/.DEFAULT "$d/DEFAULT"
# End of script
####################

Hope the new features are helpful.

Christian


=====================

2006-03-02  Christian Franke <franke@computer.org>

       * regtool.cc (options): Add 'binary'.
         (usage): Document 'load|unload|save' and '-b'.
         (find_key): Add 'options' parameter, add load/unload.
         (cmd_set): Add KT_BINARY case.
         (cmd_get): Add hex output in KT_BINARY case.
         (cmd_load): New function.
         (cmd_unload): New function.
         (set_privilege): New function.
         (cmd_save): New function.
         (commands): Add load, unload and save.
         (main): Add '-b'
       * utils.sgml (regtool): Document it.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: regtool-load-save-patch.txt
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20060302/d6ef79c1/attachment.txt>


More information about the Cygwin-patches mailing list