/* Unicode constants */
static const WCHAR BackSlash[] = {'\\',0};
-static const WCHAR ClassGUID[] = {'C','l','a','s','s','G','U','I','D',0};
-static const WCHAR Class[] = {'C','l','a','s','s',0};
static const WCHAR DateFormat[] = {'%','u','-','%','u','-','%','u',0};
static const WCHAR DotCoInstallers[] = {'.','C','o','I','n','s','t','a','l','l','e','r','s',0};
static const WCHAR DotHW[] = {'.','H','W',0};
if (CurrentPlatform.cbSize != sizeof(SP_ALTPLATFORM_INFO))
{
/* That's the first time we go here. We need to fill in the structure */
- OSVERSIONINFOEX VersionInfo;
SYSTEM_INFO SystemInfo;
- VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
- ret = GetVersionExW((OSVERSIONINFO*)&VersionInfo);
- if (!ret)
- goto done;
GetSystemInfo(&SystemInfo);
CurrentPlatform.cbSize = sizeof(SP_ALTPLATFORM_INFO);
- CurrentPlatform.Platform = VersionInfo.dwPlatformId;
- CurrentPlatform.MajorVersion = VersionInfo.dwMajorVersion;
- CurrentPlatform.MinorVersion = VersionInfo.dwMinorVersion;
+ CurrentPlatform.Platform = OsVersionInfo.dwPlatformId;
+ CurrentPlatform.MajorVersion = OsVersionInfo.dwMajorVersion;
+ CurrentPlatform.MinorVersion = OsVersionInfo.dwMinorVersion;
CurrentPlatform.ProcessorArchitecture = SystemInfo.wProcessorArchitecture;
CurrentPlatform.Reserved = 0;
- CurrentProductType = VersionInfo.wProductType;
- CurrentSuiteMask = VersionInfo.wSuiteMask;
+ CurrentProductType = OsVersionInfo.wProductType;
+ CurrentSuiteMask = OsVersionInfo.wSuiteMask;
}
ProductType = CurrentProductType;
SuiteMask = CurrentSuiteMask;
CallbackInfo.BestScore4 = ULONG_MAX;
CallbackInfo.BestScore5 = ULONG_MAX;
strcpyW(CallbackInfo.BestSection, InfSectionName);
+ TRACE("EnumerateSectionsStartingWith(InfSectionName = %S)\n", InfSectionName);
if (!EnumerateSectionsStartingWith(
InfHandle,
InfSectionName,
SetLastError(ERROR_GEN_FAILURE);
goto done;
}
+ TRACE("CallbackInfo.BestSection = %S\n", CallbackInfo.BestSection);
dwFullLength = lstrlenW(CallbackInfo.BestSection);
if (RequiredSize != NULL)
* SetupDiBuildClassInfoListExA (SETUPAPI.@)
*
* Returns a list of setup class GUIDs that identify the classes
- * that are installed on a local or remote macine.
+ * that are installed on a local or remote machine.
*
* PARAMS
* Flags [I] control exclusion of classes from the list.
* SetupDiBuildClassInfoListExW (SETUPAPI.@)
*
* Returns a list of setup class GUIDs that identify the classes
- * that are installed on a local or remote macine.
+ * that are installed on a local or remote machine.
*
* PARAMS
* Flags [I] control exclusion of classes from the list.
dwLength = MAX_CLASS_NAME_LEN * sizeof(WCHAR);
if (!RegQueryValueExW(hClassKey,
- Class,
+ REGSTR_VAL_CLASS,
NULL,
NULL,
(LPBYTE)szClassName,
return FALSE;
/* Retrieve the class name data and close the key */
- rc = QueryRegistryValue(hKey, Class, (LPBYTE *) &Buffer, &dwRegType, &dwLength);
+ rc = QueryRegistryValue(hKey, REGSTR_VAL_CLASS, (LPBYTE *) &Buffer, &dwRegType, &dwLength);
RegCloseKey(hKey);
/* Make sure we got the data */
* Create an empty DeviceInfoSet list.
*
* PARAMS
- * ClassGuid [I] if not NULL only devices with GUID ClcassGuid are associated
+ * ClassGuid [I] if not NULL only devices with GUID ClassGuid are associated
* with this list.
* hwndParent [I] hwnd needed for interface related actions.
* MachineName [I] name of machine to create emtpy DeviceInfoSet list, if NULL
HKEY SETUP_CreateClassKey(HINF hInf)
{
- static const WCHAR slash[] = { '\\',0 };
WCHAR FullBuffer[MAX_PATH];
WCHAR Buffer[MAX_PATH];
DWORD RequiredSize;
HKEY hClassKey;
+ DWORD Disposition;
+ /* Obtain the Class GUID for this class */
if (!SetupGetLineTextW(NULL,
hInf,
Version,
- ClassGUID,
+ REGSTR_VAL_CLASSGUID,
Buffer,
- MAX_PATH,
+ sizeof(Buffer) / sizeof(WCHAR),
&RequiredSize))
{
return INVALID_HANDLE_VALUE;
}
+ /* Build the corresponding registry key name */
lstrcpyW(FullBuffer, REGSTR_PATH_CLASS_NT);
- lstrcatW(FullBuffer, slash);
+ lstrcatW(FullBuffer, BackSlash);
lstrcatW(FullBuffer, Buffer);
+ /* Obtain the Class name for this class */
+ if (!SetupGetLineTextW(NULL,
+ hInf,
+ Version,
+ REGSTR_VAL_CLASS,
+ Buffer,
+ sizeof(Buffer) / sizeof(WCHAR),
+ &RequiredSize))
+ {
+ return INVALID_HANDLE_VALUE;
+ }
+
+ /* Try to open or create the registry key */
+ TRACE("Opening class key %s\n", debugstr_w(FullBuffer));
+#if 0 // I keep this for reference...
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
FullBuffer,
0,
KEY_SET_VALUE,
&hClassKey))
{
- if (!SetupGetLineTextW(NULL,
- hInf,
- Version,
- Class,
- Buffer,
- MAX_PATH,
- &RequiredSize))
- {
- return INVALID_HANDLE_VALUE;
- }
-
- if (RegCreateKeyExW(HKEY_LOCAL_MACHINE,
- FullBuffer,
- 0,
- NULL,
- REG_OPTION_NON_VOLATILE,
- KEY_SET_VALUE,
- NULL,
- &hClassKey,
- NULL))
- {
- return INVALID_HANDLE_VALUE;
- }
+ /* Use RegCreateKeyExW */
}
+#endif
+ if (RegCreateKeyExW(HKEY_LOCAL_MACHINE,
+ FullBuffer,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ KEY_SET_VALUE,
+ NULL,
+ &hClassKey,
+ &Disposition))
+ {
+ ERR("RegCreateKeyExW(%s) failed\n", debugstr_w(FullBuffer));
+ return INVALID_HANDLE_VALUE;
+ }
+ if (Disposition == REG_CREATED_NEW_KEY)
+ TRACE("The class key %s was successfully created\n", debugstr_w(FullBuffer));
+ else
+ TRACE("The class key %s was successfully opened\n", debugstr_w(FullBuffer));
+ TRACE( "setting value %s to %s\n", debugstr_w(REGSTR_VAL_CLASS), debugstr_w(Buffer) );
if (RegSetValueExW(hClassKey,
- Class,
+ REGSTR_VAL_CLASS,
0,
REG_SZ,
(LPBYTE)Buffer,
rc = RegOpenKeyExW(HKLM,
REGSTR_PATH_HWPROFILES,
0,
- 0,
+ READ_CONTROL,
&hHWProfilesKey);
if (rc != ERROR_SUCCESS)
{
list->HKLM,
REGSTR_PATH_SYSTEMENUM,
0, /* Options */
- 0,
+ READ_CONTROL,
&hEnumKey);
if (rc != ERROR_SUCCESS)
{
HKEY enumKey, key = INVALID_HANDLE_VALUE;
LONG l;
- l = RegOpenKeyExW(RootKey, REGSTR_PATH_SYSTEMENUM, 0, 0, &enumKey);
+ l = RegOpenKeyExW(RootKey, REGSTR_PATH_SYSTEMENUM, 0, READ_CONTROL, &enumKey);
if (!l)
{
l = RegOpenKeyExW(enumKey, devInfo->instanceId, 0, samDesired, &key);
RootKey,
REGSTR_PATH_CLASS_NT,
0, /* Options */
- 0,
+ READ_CONTROL,
&hEnumKey);
if (rc != ERROR_SUCCESS)
{
RegCloseKey(hEnumKey);
if (hKey != NULL && hKey != key)
RegCloseKey(hKey);
+ if (DriverKey)
+ HeapFree(GetProcessHeap(), 0, DriverKey);
return key;
}