4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-31 11:30:56 +08:00

2004-10-26 Pierre Humblet <pierre.humblet@ieee.org>

* registry.cc (get_registry_hive_path): Simplify and add a
        debug_printf in case of failure.
        (load_registry_hive): Revert the 2004-04-19 change.
This commit is contained in:
Pierre Humblet 2004-10-26 01:53:27 +00:00
parent 9a0fdd2315
commit fdf4ad73e1
2 changed files with 14 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2004-10-26 Pierre Humblet <pierre.humblet@ieee.org>
* registry.cc (get_registry_hive_path): Simplify and add a
debug_printf in case of failure.
(load_registry_hive): Revert the 2004-04-19 change.
2004-10-20 Christopher Faylor <cgf@timesys.com> 2004-10-20 Christopher Faylor <cgf@timesys.com>
* select.cc (start_thread_socket): Remove attempt to delay reading of * select.cc (start_thread_socket): Remove attempt to delay reading of

View File

@ -211,14 +211,15 @@ get_registry_hive_path (const PSID psid, char *path)
char buf[256]; char buf[256];
DWORD type, siz; DWORD type, siz;
key[0] = '\0'; path[0] = '\0';
if (!RegQueryValueExA (hkey, "ProfileImagePath", 0, &type, if (!RegQueryValueExA (hkey, "ProfileImagePath", 0, &type,
(BYTE *)buf, (siz = 256, &siz))) (BYTE *)buf, (siz = sizeof (buf), &siz)))
ExpandEnvironmentStringsA (buf, key, 256); ExpandEnvironmentStringsA (buf, path, CYG_MAX_PATH + 1);
RegCloseKey (hkey); RegCloseKey (hkey);
if (key[0]) if (path[0])
return strcpy (path, key); return path;
} }
debug_printf ("HKLM\\%s not found", key);
return NULL; return NULL;
} }
@ -241,7 +242,8 @@ load_registry_hive (PSID psid)
RegCloseKey (hkey); RegCloseKey (hkey);
return; return;
} }
enable_restore_privilege (); /* This is only called while deimpersonated */
set_process_privilege (SE_RESTORE_NAME);
if (get_registry_hive_path (psid, path)) if (get_registry_hive_path (psid, path))
{ {
strcat (path, "\\NTUSER.DAT"); strcat (path, "\\NTUSER.DAT");