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

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Mar 3 09:46:00 GMT 2006


On Mar  2 21:59, Christian Franke wrote:
> 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 ;-)

Urgh, sorry about that.  While scanning your patch I missed that this
printf isn't new but already in the code.

> >>@@ -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):     {

Well, I can't see a hack in what you're using KT_BINARY here.  I removed
the comment from your patch.

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

Cool.

> 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.

I applied the patch.  I just had to reformat your ChangeLog slightly
(a TAB before all lines, no extra indentation for lines which don't
start with a '*').

Btw., since you seem to be interested in hacking the registry...  would
you also be interested to introduce registry write access below
/proc/registry inside of the Cygwin DLL?  That would be extra cool.
I'm not quite sure how to handle the mapping from file types to
registry key types, but there might be some simple way which I'm just
too blind to see.


Thanks,
Corinna

-- 
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