From fdf4ad73e1cccdcc9f9a03a2605615ef4835013c Mon Sep 17 00:00:00 2001 From: Pierre Humblet Date: Tue, 26 Oct 2004 01:53:27 +0000 Subject: 2004-10-26 Pierre Humblet * 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. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/registry.cc | 14 ++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'winsup/cygwin') diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 89ac3e4..d08e6d3 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2004-10-26 Pierre Humblet + + * 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 * select.cc (start_thread_socket): Remove attempt to delay reading of diff --git a/winsup/cygwin/registry.cc b/winsup/cygwin/registry.cc index bb47c48..bf80245 100644 --- a/winsup/cygwin/registry.cc +++ b/winsup/cygwin/registry.cc @@ -211,14 +211,15 @@ get_registry_hive_path (const PSID psid, char *path) char buf[256]; DWORD type, siz; - key[0] = '\0'; + path[0] = '\0'; if (!RegQueryValueExA (hkey, "ProfileImagePath", 0, &type, - (BYTE *)buf, (siz = 256, &siz))) - ExpandEnvironmentStringsA (buf, key, 256); + (BYTE *)buf, (siz = sizeof (buf), &siz))) + ExpandEnvironmentStringsA (buf, path, CYG_MAX_PATH + 1); RegCloseKey (hkey); - if (key[0]) - return strcpy (path, key); + if (path[0]) + return path; } + debug_printf ("HKLM\\%s not found", key); return NULL; } @@ -241,7 +242,8 @@ load_registry_hive (PSID psid) RegCloseKey (hkey); return; } - enable_restore_privilege (); + /* This is only called while deimpersonated */ + set_process_privilege (SE_RESTORE_NAME); if (get_registry_hive_path (psid, path)) { strcat (path, "\\NTUSER.DAT"); -- cgit v1.1