Author: cgutman Date: Sat May 28 13:42:06 2011 New Revision: 51974
URL: http://svn.reactos.org/svn/reactos?rev=51974&view=rev Log: [UNPNPMGR] - Simplify and fix a few bugs in the ClassGUID reading code
Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c
Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/umpn... ============================================================================== --- trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] Sat May 28 13:42:06 2011 @@ -2249,7 +2249,6 @@ PROCESS_INFORMATION ProcessInfo; STARTUPINFOW StartupInfo; UUID RandomUuid; - WCHAR RegistryPath[MAX_PATH]; HKEY DeviceKey;
/* The following lengths are constant (see below), they cannot overflow */ @@ -2262,11 +2261,8 @@
ZeroMemory(&ProcessInfo, sizeof(ProcessInfo));
- wcscpy(RegistryPath, L"SYSTEM\CurrentControlSet\Enum\"); - wcscat(RegistryPath, DeviceInstance); - - if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, - RegistryPath, + if (RegOpenKeyExW(hEnumKey, + DeviceInstance, 0, KEY_QUERY_VALUE, &DeviceKey) == ERROR_SUCCESS) @@ -2279,10 +2275,11 @@ NULL) == ERROR_SUCCESS) { DPRINT("No need to install: %S\n", DeviceInstance); + RegCloseKey(DeviceKey); return TRUE; }
- CloseHandle(DeviceKey); + RegCloseKey(DeviceKey); }
DPRINT1("Installing: %S\n", DeviceInstance);