* regtool.cc (Fail): Be more verbose.
(find_key): Add support for remote registry access. (usage): Document it. * utils.sgml: Document it.
This commit is contained in:
parent
9d0efbb3ae
commit
381fb8baa1
|
@ -1,3 +1,10 @@
|
|||
2002-06-06 Egor Duda <deo@logos-m.ru>
|
||||
|
||||
* regtool.cc (Fail): Be more verbose.
|
||||
(find_key): Add support for remote registry access.
|
||||
(usage): Document it.
|
||||
* utils.sgml: Document it.
|
||||
|
||||
2002-06-06 Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
* strace.cc (main): Make toggle a local variable.
|
||||
|
|
|
@ -91,12 +91,16 @@ usage (FILE *where = stderr)
|
|||
"\n");
|
||||
if (where == stdout)
|
||||
fprintf (where, ""
|
||||
"KEY is in the format \\prefix\\KEY\\KEY\\VALUE, where prefix is any of:\n"
|
||||
" \\root HKCR HKEY_CLASSES_ROOT\n"
|
||||
" \\config HKCC HKEY_CURRENT_CONFIG\n"
|
||||
" \\user HKCU HKEY_CURRENT_USER\n"
|
||||
" \\machine HKLM HKEY_LOCAL_MACHINE\n"
|
||||
" \\users HKU HKEY_USERS\n"
|
||||
"KEY is in the format [host]\\prefix\\KEY\\KEY\\VALUE, where host is optional\n"
|
||||
"remote host in either \\\\hostname or hostname: format and prefix is any of:\n"
|
||||
" root HKCR HKEY_CLASSES_ROOT (local only)\n"
|
||||
" config HKCC HKEY_CURRENT_CONFIG (local only)\n"
|
||||
" user HKCU HKEY_CURRENT_USER (local only)\n"
|
||||
" machine HKLM HKEY_LOCAL_MACHINE\n"
|
||||
" users HKU HKEY_USERS\n"
|
||||
"\n"
|
||||
"You can use forward slash ('/') as a separator instead of backslash, in\n"
|
||||
"that case backslash is treated as escape character\n"
|
||||
"");
|
||||
fprintf (where, ""
|
||||
"Example: %s get '\\user\\software\\Microsoft\\Clock\\iFormat'\n", prog_name);
|
||||
|
@ -136,7 +140,7 @@ Fail (DWORD rv)
|
|||
FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
|
||||
| FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
0, rv, 0, (CHAR *) & buf, 0, 0);
|
||||
fprintf (stderr, "Error: %s\n", buf);
|
||||
fprintf (stderr, "Error (%ld): %s\n", rv, buf);
|
||||
LocalFree (buf);
|
||||
}
|
||||
exit (1);
|
||||
|
@ -251,12 +255,38 @@ translate (char *key)
|
|||
void
|
||||
find_key (int howmanyparts, REGSAM access)
|
||||
{
|
||||
char *n = argv[0], *e, c;
|
||||
HKEY base;
|
||||
int rv;
|
||||
char *n = argv[0], *e, *h, c;
|
||||
char* host = NULL;
|
||||
int i;
|
||||
if (*n == '/')
|
||||
translate (n);
|
||||
while (*n == '\\')
|
||||
if (*n != '\\')
|
||||
{
|
||||
/* expect host:/key/value format */
|
||||
host = (char*) malloc (strlen (n) + 1);
|
||||
host[0] = host [1] = '\\';
|
||||
for (e = n, h = host + 2; *e && *e != ':'; e++, h++)
|
||||
*h = *e;
|
||||
*h = 0;
|
||||
n = e + 1;
|
||||
if (*n == '/')
|
||||
translate (n);
|
||||
}
|
||||
else if (n[0] == '\\' && n[1] == '\\')
|
||||
{
|
||||
/* expect //host/key/value format */
|
||||
host = (char*) malloc (strlen (n) + 1);
|
||||
host[0] = host[1] = '\\';
|
||||
for (e = n + 2, h = host + 2; *e && *e != '\\'; e++, h++)
|
||||
*h = *e;
|
||||
*h = 0;
|
||||
n = e;
|
||||
}
|
||||
while (*n != '\\')
|
||||
n++;
|
||||
*n++ = 0;
|
||||
for (e = n; *e && *e != '\\'; e++);
|
||||
c = *e;
|
||||
*e = 0;
|
||||
|
@ -292,14 +322,24 @@ find_key (int howmanyparts, REGSAM access)
|
|||
value = e + 1;
|
||||
}
|
||||
}
|
||||
if (n[0] == 0)
|
||||
if (host)
|
||||
{
|
||||
key = wkprefixes[i].key;
|
||||
return;
|
||||
rv = RegConnectRegistry (host, wkprefixes[i].key, &base);
|
||||
if (rv != ERROR_SUCCESS)
|
||||
Fail (rv);
|
||||
free (host);
|
||||
}
|
||||
else
|
||||
base = wkprefixes[i].key;
|
||||
|
||||
if (n[0] == 0)
|
||||
key = base;
|
||||
else
|
||||
{
|
||||
rv = RegOpenKeyEx (base, n, 0, access, &key);
|
||||
if (rv != ERROR_SUCCESS)
|
||||
Fail (rv);
|
||||
}
|
||||
int rv = RegOpenKeyEx (wkprefixes[i].key, n, 0, access, &key);
|
||||
if (rv != ERROR_SUCCESS)
|
||||
Fail (rv);
|
||||
//printf("key `%s' value `%s'\n", n, value);
|
||||
}
|
||||
|
||||
|
|
|
@ -710,12 +710,15 @@ Regtool Copyright (c) 2000 Red Hat Inc
|
|||
regtool [-v] unset [key\value] - removes value from key
|
||||
regtool [-q] get [key\value] - prints value to stdout
|
||||
-q=quiet, no error msg, just return nonzero exit if key/value missing
|
||||
keys are like \prefix\key\key\key\value, where prefix is any of:
|
||||
root HKCR HKEY_CLASSES_ROOT
|
||||
config HKCC HKEY_CURRENT_CONFIG
|
||||
user HKCU HKEY_CURRENT_USER
|
||||
machine HKLM HKEY_LOCAL_MACHINE
|
||||
users HKU HKEY_USERS
|
||||
key is in the format [host]\prefix\KEY\KEY\VALUE, where host is optional
|
||||
remote host in either \\hostname or hostname: format and prefix is any of:
|
||||
root HKCR HKEY_CLASSES_ROOT (local only)
|
||||
config HKCC HKEY_CURRENT_CONFIG (local only)
|
||||
user HKCU HKEY_CURRENT_USER (local only)
|
||||
machine HKLM HKEY_LOCAL_MACHINE
|
||||
users HKU HKEY_USERS
|
||||
You can use forward slash ('/') as a separator instead of backslash, in
|
||||
that case backslash is treated as escape character.
|
||||
example: \user\software\Microsoft\Clock\iFormat
|
||||
</screen>
|
||||
|
||||
|
|
Loading…
Reference in New Issue