PROCESS_INFORMATION ProcessInfo;
STARTUPINFOW StartupInfo;
UUID RandomUuid;
- WCHAR RegistryPath[MAX_PATH];
HKEY DeviceKey;
/* The following lengths are constant (see below), they cannot overflow */
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)
NULL) == ERROR_SUCCESS)
{
DPRINT("No need to install: %S\n", DeviceInstance);
+ RegCloseKey(DeviceKey);
return TRUE;
}
- CloseHandle(DeviceKey);
+ RegCloseKey(DeviceKey);
}
DPRINT1("Installing: %S\n", DeviceInstance);