diff options
author | Werner Koch <[email protected]> | 2021-11-17 08:30:48 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2021-11-17 08:30:48 +0000 |
commit | 50539394802fb9478296d52527582697a6693b52 (patch) | |
tree | c611ddd8a044c160d7cc2675aacce5ddfeeda6d9 /common/t-w32-reg.c | |
parent | sm: Detect circular chains in --list-chain. (diff) | |
download | gnupg-50539394802fb9478296d52527582697a6693b52.tar.gz gnupg-50539394802fb9478296d52527582697a6693b52.zip |
common,w32: New function read_w32_reg_string.
* common/w32-reg.c (get_root_key): Remove.
(read_w32_registry_string): Turn into a wrapper for the gpgrt
function.
(read_w32_reg_string): New.
Diffstat (limited to 'common/t-w32-reg.c')
-rw-r--r-- | common/t-w32-reg.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/common/t-w32-reg.c b/common/t-w32-reg.c index 01816db54..9665003ea 100644 --- a/common/t-w32-reg.c +++ b/common/t-w32-reg.c @@ -44,25 +44,28 @@ static void test_read_registry (void) { - char *string; + char *string1, *string2; -#ifdef HAVE_W32CE_SYSTEM - string = read_w32_registry_string ("HKEY_CLASSES_ROOT", - "BOOTSTRAP\\CLSID", NULL); - if (!string) - fail (0); - fprintf (stderr, "Bootstrap clsid: %s\n", string); - xfree (string); -#endif - - string = read_w32_registry_string + string1 = read_w32_registry_string ("HKEY_CURRENT_USER", "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", "User Agent"); - if (!string) + if (!string1) fail (0); - fprintf (stderr, "User agent: %s\n", string); - xfree (string); + fprintf (stderr, "User agent: %s\n", string1); + + string2 = read_w32_reg_string + ("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion" + "\\Internet Settings:User Agent"); + if (!string2) + fail (1); + fprintf (stderr, "User agent: %s\n", string2); + if (strcmp (string1, string2)) + fail (2); + + + xfree (string1); + xfree (string2); } @@ -71,10 +74,14 @@ test_read_registry (void) int main (int argc, char **argv) { - (void)argc; - (void)argv; - - test_read_registry (); + if (argc > 1) + { + char *string = read_w32_reg_string (argv[1]); + printf ("%s -> %s\n", argv[1], string? string : "(null)"); + xfree (string); + } + else + test_read_registry (); return 0; } |