Can regtool be used to rename a key?

Glen Coakley gcoakley@mqsoftware.com
Mon Jul 2 14:50:00 GMT 2001


I don't know of such function. But, you could do it the hard way with
regtool by 1) get the old key value 2) create the new key name & value 3)
delete the old key. 

The order was listed this way to avoid a race condition in case some program
was trying to read that key while you were 'renaming' it.

________________________________
Glen Coakley, Sr. Software Engineer
MQSoftware Inc., (763) 543-4845
"Tinkero ergo sum." -- Chuck Murcko


> -----Original Message-----
> From: Keith Starsmeare [ mailto:keith_starsmeare@yahoo.co.uk ]
> Sent: Wednesday, June 27, 2001 9:35 AM
> To: cygwin
> Subject: Can regtool be used to rename a key?
> 
> 
> I'd like to be able to script a method of renaming a key. Is 
> there a simple
> way of doing it using regtool?
> 
> I couldn't figure it out, so I had a look at the source, but 
> I've never
> programmed the registry before - so I'm naturally a little 
> hesitant. I was
> hoping that there'd be a RegMoveKey or RegRenameKey similar to the
> RegDeleteKey, but no. The closest I could see in the MSDN was 
> RegReplaceKey.
> Has anyone with any experience of registry programming got 
> any advice (which
> you could email to me directly if there's the worry that discussing
> programming the registry if OT)?
> 
> Also, as an aside, how do you recommend giving patches if you 
> can't access
> the cvs server because I'm behind a firewall? I downloaded 
> the file from the
> web site.
> 
> Incidentally, is there a reason that regtool likes 
> backslashes so much?
> They're a pain in the butt from the command line. I submit 
> this wee tweak so
> that I could use slashes for the keys:
> 
> *** regtool.cc  Wed Jun 27 15:24:43 2001
> --- regtool.cc.txt      Wed Jun 27 15:16:22 2001
> ***************
> *** 194,206 ****
>     int i;
>     if (*n == '/')
>       translate (n);
> !   while ((*n == '\\') || (*n == '/'))
>       n++;
> !   for (e = n; *e && *e != '\\' && *e != '/'; e++);
> !   if (*e == '/')
> !     c = '\\';
> !   else
> !     c = *e;
>     *e = 0;
>     for (i = 0; wkprefixes[i].string; i++)
>       if (strcmp (wkprefixes[i].string, n) == 0)
> --- 194,203 ----
>     int i;
>     if (*n == '/')
>       translate (n);
> !   while (*n == '\\')
>       n++;
> !   for (e = n; *e && *e != '\\'; e++);
> !   c = *e;
>     *e = 0;
>     for (i = 0; wkprefixes[i].string; i++)
>       if (strcmp (wkprefixes[i].string, n) == 0)
> 
> Cheers
> 
> Keith
> 
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list