Re: [Patch] regtool: Add load/unload commands and --binary option
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. Thanks, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat
Re: [PATCH] Proposed clarification of the snapshot installation FAQ
On Jan 13 00:01, Igor Peshansky wrote: > On Thu, 12 Jan 2006, Igor Peshansky wrote: > > > On Thu, 12 Jan 2006, Christopher Faylor wrote: > > > > > Nevertheless, the advice about using "mv" to rename cygwin1.dll won't > > > work on every version of Windows and needs to be changed. > > > > Hmm, it's worked for me on Win98, Win2k, and WinXP (though I suppose > > there could be differences on, say, WinNT4 or something)... I basically > > wanted to avoid giving too many things to do in Windows Explorer. But > > no matter -- I'll submit a patch with this change shortly. > > And here it is. > Igor > == > 2006-01-12 Igor Peshansky <[EMAIL PROTECTED]> > > * faq-setup.xml (faq.setup.snapshots): Rename DLL using Windows tools. Applied. Thanks, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat
Re: [Patch] regtool: Add load/unload commands and --binary option
On Wed, 25 Jan 2006, Corinna Vinschen wrote: > 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 ... > > > > [snip] > > Thanks for any comment > > Thanks for this patch, it looks pretty useful. > [snip] I wonder if it would be better to use stdin/stdout for binary data (or even add a -f option for set). IMHO, regtool -b get KEY1\\VALUE | regtool -b set KEY2\\VALUE or regtool -b get KEY1\\VALUE | regtool -b set -f - KEY2\\VALUE looks cleaner than storing the hex encoding into a string... If you want a hex dump, regtool -b get KEY1\\VALUE | od -t x1 will do it. I'm not aware of any program that does the reverse (hex dump->binary), but writing a perl script for that is trivial. That said, I also think this functionality would be very useful. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_[EMAIL PROTECTED] | [EMAIL PROTECTED] ZZZzz /,`.-'`'-. ;-;;,_Igor Peshansky, Ph.D. (name changed!) |,4- ) )-,_. ,\ ( `'-' old name: Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte." "But no -- you are no fool; you call yourself a fool, there's proof enough in that!" -- Rostand, "Cyrano de Bergerac"
Re: [Patch] regtool: Add load/unload commands and --binary option
On Wed, 25 Jan 2006, Igor Peshansky wrote: > I'm not aware of any program that does the reverse (hex dump->binary), > but writing a perl script for that is trivial. xxd -r ;-). -- Brian Ford Lead Realtime Software Engineer VITAL - Visual Simulation Systems FlightSafety International the best safety device in any aircraft is a well-trained pilot...
Re: [Patch] regtool: Add load/unload commands and --binary option
Corinna Vinschen wrote: [...] Thanks for this patch, it looks pretty useful. There are just two things missing. First, could you please create a matching ChangeLog entry? OK. 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. Sorry, I wasn't aware that this is necessary for such a trivial patch. Will send the snail mail with the legal stuff soon ;-) Christian
Re: [Patch] regtool: Add load/unload commands and --binary option
Igor Peshansky wrote: [snip] I wonder if it would be better to use stdin/stdout for binary data (or even add a -f option for set). IMHO, regtool -b get KEY1\\VALUE | regtool -b set KEY2\\VALUE or regtool -b get KEY1\\VALUE | regtool -b set -f - KEY2\\VALUE looks cleaner than storing the hex encoding into a string... At least when regtool is used interactively, it is IMO not very useful to have modem-line-noise-like output for REG_BINARY, but human readable output for the other value types. But this is the current behavior of "regtool get ...". Suggest to combine the best of both worlds: regtool get KEY\\VALUE should always produce human readable output, in particular a hex dump for REG_BINARY. (But this would change existing behavior on REG_BINARY) regtool -b get KEY\\VALUE writes REG_BINARY as binary data to stdout. regtool -b set KEY\\VALUE 01 02 03 sets REG_BINARY value from hex bytes in args. regtool -b set KEY\\VALUE - set value from binary data read from stdin [...] That said, I also think this functionality would be very useful. Thx, Christian
Re: [Patch] regtool: Add load/unload commands and --binary option
Christian Franke wrote: > At least when regtool is used interactively, it is IMO not very useful > to have > modem-line-noise-like output for REG_BINARY, but human readable output for > the other value types. > But this is the current behavior of "regtool get ...". Instead of an explicit -b flag, perhaps it should just call isatty() and if being run interactively, output human readable hex dump, otherwise output raw binary. Brian
Re: [Patch] regtool: Add load/unload commands and --binary option
On Wed, 25 Jan 2006, Brian Dessent wrote: > Christian Franke wrote: > > > At least when regtool is used interactively, it is IMO not very useful > > to have modem-line-noise-like output for REG_BINARY, but human > > readable output for the other value types. But this is the current > > behavior of "regtool get ...". > > Instead of an explicit -b flag, perhaps it should just call isatty() and > if being run interactively, output human readable hex dump, otherwise > output raw binary. What if you want to redirect the hex dump to a file? IMO, isatty() checks are only useful if the output won't change qualitatively on redirection (e.g., for coloring). Otherwise, it's always better to use an explicit flag. That said, attempting to "regtool get" a binary value is no different from attempting to cat a binary file -- and we're not changing "cat" to output hex dumps. What would be useful instead is a way to query the type of a value via regtool. We could also add a "-h" (for --human-readable) flag to always output the value in human-readable form (see below). FWIW, 'A=`regtool get KEY1\\VAL`; regtool set KEY2\\VAL "$A"' will already break for REG_MULTI_SZ type values. It would be good to make regtool's behavior consistent: "regtool set -f FILE" reads the value from FILE, which would work for all value types. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_[EMAIL PROTECTED] | [EMAIL PROTECTED] ZZZzz /,`.-'`'-. ;-;;,_Igor Peshansky, Ph.D. (name changed!) |,4- ) )-,_. ,\ ( `'-' old name: Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte." "But no -- you are no fool; you call yourself a fool, there's proof enough in that!" -- Rostand, "Cyrano de Bergerac"
Re: [Patch] regtool: Add load/unload commands and --binary option
Igor Peshansky wrote: > What if you want to redirect the hex dump to a file? IMO, isatty() checks > are only useful if the output won't change qualitatively on redirection > (e.g., for coloring). Otherwise, it's always better to use an explicit > flag. Good point. Why don't we just emulate the behavior of 'cat' here? If isatty() is true and non-ascii characters are in the output, then prompt first before possibly fubaring the user's terminal, otherwise just output the raw data. And just as 'cat' does not have any internal code for formatting binary data as a hex dump, neither should regtool, since 'od' works perfectly for that and already has the veritable kitchen sink of formatting options. Brian