* registry.cc (load_registry_hive): Use HKEY_USERS when checking

for existing user hive.
        Use MAX_PATH instead of numerical constant for array size.
        Use return code of RegLoadKeyA instead of GetLastError for error output.
This commit is contained in:
Corinna Vinschen 2000-06-22 18:54:26 +00:00
parent 42030c97d7
commit 98a3dc3bc5
2 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,10 @@
Thu Jun 22 20:45:00 2000 Corinna Vinschen <corinna@vinschen.de>
* registry.cc (load_registry_hive): Use HKEY_USERS when checking
for existing user hive.
Use MAX_PATH instead of numerical constant for array size.
Use return code of RegLoadKeyA instead of GetLastError for error output.
Thu Jun 22 14:27:04 2000 Christopher Faylor <cgf@cygnus.com>
* Makefile.in: Add new-libcygwin.a back to all_host target.

View File

@ -210,13 +210,14 @@ void
load_registry_hive (PSID psid)
{
char sid[256];
char path[256];
char path[MAX_PATH + 1];
HKEY hkey;
LONG ret;
if (!psid)
return;
/* Check if user hive already exists */
if (!RegOpenKeyExA (HKEY_LOCAL_MACHINE, convert_sid_to_string_sid (psid, sid),
/* Check if user hive is already loaded. */
if (!RegOpenKeyExA (HKEY_USERS, convert_sid_to_string_sid (psid, sid),
0, KEY_READ, &hkey))
{
debug_printf ("User registry hive for %s already exists", sid);
@ -226,8 +227,8 @@ load_registry_hive (PSID psid)
if (get_registry_hive_path (psid, path))
{
strcat (path, "\\NTUSER.DAT");
if (RegLoadKeyA (HKEY_USERS, sid, path))
debug_printf ("Loading user registry hive for %s failed: %E", sid);
if ((ret = RegLoadKeyA (HKEY_USERS, sid, path)) != ERROR_SUCCESS)
debug_printf ("Loading user registry hive for %s failed: %d", sid, ret);
}
}