29static const WCHAR DotCoInstallers[] = {
'.',
'C',
'o',
'I',
'n',
's',
't',
'a',
'l',
'l',
'e',
'r',
's',0};
35static const WCHAR VersionFormat[] = {
'%',
'u',
'.',
'%',
'u',
'.',
'%',
'u',
'.',
'%',
'u',0};
37static const WCHAR REGSTR_DRIVER_DATE[] = {
'D',
'r',
'i',
'v',
'e',
'r',
'D',
'a',
't',
'e',0};
38static const WCHAR REGSTR_DRIVER_DATE_DATA[] = {
'D',
'r',
'i',
'v',
'e',
'r',
'D',
'a',
't',
'e',
'D',
'a',
't',
'a',0};
39static const WCHAR REGSTR_DRIVER_VERSION[] = {
'D',
'r',
'i',
'v',
'e',
'r',
'V',
'e',
'r',
's',
'i',
'o',
'n',0};
41static const WCHAR REGSTR_UI_NUMBER_DESC_FORMAT[] = {
'U',
'I',
'N',
'u',
'm',
'b',
'e',
'r',
'D',
'e',
's',
'c',
'F',
'o',
'r',
'm',
'a',
't',0};
83 static const WCHAR fmt[] = {
'{',
'%',
'0',
'8',
'X',
'-',
'%',
'0',
'4',
'X',
'-',
84 '%',
'0',
'4',
'X',
'-',
'%',
'0',
'2',
'X',
'%',
'0',
'2',
'X',
'-',
'%',
'0',
'2',
85 'X',
'%',
'0',
'2',
'X',
'%',
'0',
'2',
'X',
'%',
'0',
'2',
'X',
'%',
'0',
'2',
'X',
'%',
137 LPCWSTR pExtensionArchitecture;
143 static const WCHAR ExtensionPlatformNT[] = {
'.',
'N',
'T',0};
144 static const WCHAR ExtensionPlatformWindows[] = {
'.',
'W',
'i',
'n',0};
146 static const WCHAR ExtensionArchitectureNone[] = {0};
147 static const WCHAR ExtensionArchitecturealpha[] = {
'a',
'l',
'p',
'h',
'a',0};
148 static const WCHAR ExtensionArchitectureamd64[] = {
'A',
'M',
'D',
'6',
'4',0};
149 static const WCHAR ExtensionArchitectureia64[] = {
'I',
'A',
'6',
'4',0};
150 static const WCHAR ExtensionArchitecturemips[] = {
'm',
'i',
'p',
's',0};
151 static const WCHAR ExtensionArchitectureppc[] = {
'p',
'p',
'c',0};
152 static const WCHAR ExtensionArchitecturex86[] = {
'x',
'8',
'6',0};
154 TRACE(
"%s(%s %p 0x%x 0x%x)\n",
157 *ScorePlatform = *ScoreMajorVersion = *ScoreMinorVersion = *ScoreProductType = *ScoreSuiteMask = 0;
162 TRACE(
"pSetupDuplicateString() failed\n");
167 switch (PlatformInfo->Platform)
176 ERR(
"Unknown platform 0x%lx\n", PlatformInfo->Platform);
180 switch (PlatformInfo->ProcessorArchitecture)
183 pExtensionArchitecture = ExtensionArchitecturealpha;
186 pExtensionArchitecture = ExtensionArchitectureamd64;
189 pExtensionArchitecture = ExtensionArchitectureia64;
192 pExtensionArchitecture = ExtensionArchitecturex86;
195 pExtensionArchitecture = ExtensionArchitecturemips;
198 pExtensionArchitecture = ExtensionArchitectureppc;
201 ERR(
"Unknown processor architecture 0x%x\n", PlatformInfo->ProcessorArchitecture);
203 pExtensionArchitecture = ExtensionArchitectureNone;
217 if (Fields[0] ==
NULL)
219 TRACE(
"No extension found\n");
220 *ScorePlatform = *ScoreMajorVersion = *ScoreMinorVersion = *ScoreProductType = *ScoreSuiteMask =
ULONG_MAX;
224 Fields[1] = Fields[0] + 1;
225 Fields[2] = Fields[3] = Fields[4] = Fields[5] =
NULL;
226 for (
i = 2; Fields[
i - 1] !=
NULL &&
i < 6;
i++)
228 Fields[
i] =
wcschr(Fields[
i - 1],
'.');
236 if (
strncmpiW(Fields[0], ExtensionPlatformWindows,
strlenW(ExtensionPlatformWindows)) == 0)
240 TRACE(
"Mismatch on platform field\n");
243 Fields[1] +=
wcslen(ExtensionPlatformWindows) - 1;
245 else if (
strncmpiW(Fields[0], ExtensionPlatformNT,
strlenW(ExtensionPlatformNT)) == 0)
249 TRACE(
"Mismatch on platform field\n");
252 Fields[1] +=
wcslen(ExtensionPlatformNT) - 1;
257 *ScorePlatform |= 0x02;
259 if (
strcmpiW(Fields[1], ExtensionArchitectureNone) == 0)
262 *ScorePlatform |= 0x01;
264 else if (
strcmpiW(Fields[1], pExtensionArchitecture) != 0)
266 TRACE(
"Mismatch on architecture field ('%s' and '%s')\n",
272 if (Fields[2] && *Fields[2])
282 if (Fields[3] && *Fields[3])
295 TRACE(
"Mismatch on version field (%lu.%lu and %lu.%lu)\n",
299 *ScoreMajorVersion =
MajorVersion - PlatformInfo->MajorVersion;
301 *ScoreMinorVersion =
MinorVersion - PlatformInfo->MinorVersion;
305 else if (Fields[3] && *Fields[3])
307 TRACE(
"Minor version found without major version\n");
312 *ScoreMajorVersion = PlatformInfo->MajorVersion;
313 *ScoreMinorVersion = PlatformInfo->MinorVersion;
316 if (Fields[4] && *Fields[4])
318 DWORD CurrentProductType;
320 if ((CurrentProductType == 0 || CurrentProductType ==
ULONG_MAX) &&
326 if (CurrentProductType != ProductType)
328 TRACE(
"Mismatch on product type (0x%08lx and 0x%08x)\n",
329 CurrentProductType, ProductType);
334 *ScoreProductType = 1;
336 if (Fields[5] && *Fields[5])
338 DWORD CurrentSuiteMask;
340 if ((CurrentSuiteMask == 0 || CurrentSuiteMask ==
ULONG_MAX) &&
346 if ((CurrentSuiteMask & ~SuiteMask) != 0)
348 TRACE(
"Mismatch on suite mask (0x%08lx and 0x%08x)\n",
349 CurrentSuiteMask, SuiteMask);
352 *ScoreSuiteMask = SuiteMask & ~CurrentSuiteMask;
355 *ScoreSuiteMask = SuiteMask;
370 DWORD Score1, Score2, Score3, Score4, Score5;
373 if (SectionName[
info->PrefixLength] !=
'.')
377 &SectionName[
info->PrefixLength],
381 &Score1, &Score2, &Score3, &Score4, &Score5);
387 if (Score1 >
info->BestScore1)
goto done;
388 if (Score1 < info->
BestScore1)
goto bettersection;
389 if (Score2 >
info->BestScore2)
goto done;
390 if (Score2 < info->
BestScore2)
goto bettersection;
391 if (Score3 >
info->BestScore3)
goto done;
392 if (Score3 < info->
BestScore3)
goto bettersection;
393 if (Score4 >
info->BestScore4)
goto done;
394 if (Score4 < info->
BestScore4)
goto bettersection;
395 if (Score5 >
info->BestScore5)
goto done;
396 if (Score5 < info->
BestScore5)
goto bettersection;
401 info->BestScore1 = Score1;
402 info->BestScore2 = Score2;
403 info->BestScore3 = Score3;
404 info->BestScore4 = Score4;
405 info->BestScore5 = Score5;
420 IN DWORD InfSectionWithExtSize,
428 AlternatePlatformInfo, InfSectionWithExt, InfSectionWithExtSize,
433 else if (!InfSectionName)
435 else if (AlternatePlatformInfo && AlternatePlatformInfo->cbSize !=
sizeof(
SP_ALTPLATFORM_INFO))
442 static BYTE CurrentProductType = 0;
443 static WORD CurrentSuiteMask = 0;
451 if (AlternatePlatformInfo)
453 pPlatformInfo = AlternatePlatformInfo;
487 TRACE(
"EnumerateSectionsStartingWith(InfSectionName = %S)\n", InfSectionName);
503 if (InfSectionWithExtSize > 0)
505 if (InfSectionWithExtSize < dwFullLength + 1)
567 *pDeviceInfo = deviceInfo;
624 if (
list->hmodClassPropPageProvider)
730 GUID CurrentClassGuid;
733 DWORD dwGuidListIndex = 0;
761 for (dwIndex = 0; ; dwIndex++)
791 TRACE(
"'NoUseClass' value found!\n");
804 TRACE(
"'NoInstallClass' value found!\n");
817 TRACE(
"'NoDisplayClass' value found!\n");
826 ClassGuidList[dwGuidListIndex] = CurrentClassGuid;
904 if (ClassNameW ==
NULL)
910 if (MachineNameW ==
NULL)
945 DWORD dwGuidListIndex = 0;
972 for (dwIndex = 0; ; dwIndex++)
983 TRACE(
"RegEnumKeyExW() returns %d\n", lError);
986 TRACE(
"Key name: %p\n", szKeyName);
1010 TRACE(
"Found matching class name\n");
1012 TRACE(
"Guid: %p\n", szKeyName);
1015 if (szKeyName[0] ==
'{' && szKeyName[37] ==
'}')
1019 TRACE(
"Guid: %p\n", &szKeyName[1]);
1022 &ClassGuidList[dwGuidListIndex]);
1056 DWORD ClassNameSize,
1070 DWORD ClassNameSize,
1084 DWORD ClassNameSize,
1101 if (
len == 0 ||
len > ClassNameSize)
1117 DWORD ClassNameSize,
1139 if ((ClassNameSize > 0) && (ClassName ==
NULL))
1178 if ((ClassName !=
NULL) && (
dwLength <= ClassNameSize))
1229 if (MachineNameW ==
NULL)
1304 sizeof(
list->ClassGuid));
1317 list->szData[0] =
list->szData[1] =
'\\';
1360 PCSTR InfSectionName)
1366 HwProfile, KeyType, InfHandle,
debugstr_a(InfSectionName));
1370 if (!InfSectionName)
1382 HwProfile, KeyType, InfHandle, InfSectionNameW);
1414 HwProfile, KeyType, InfHandle,
debugstr_w(InfSectionName));
1442 if (InfHandle && !InfSectionName)
1447 if (!InfHandle && InfSectionName)
1467#if _WIN32_WINNT >= 0x502
1480 L"Device Parameters",
1498#if _WIN32_WINNT >= 0x502
1510 FIXME(
"Need to install section %s in file %p\n",
1551 if (DeviceDescriptionW ==
NULL)
1562 MyFree(DeviceDescriptionW);
1694 if (deviceInfo !=
NULL)
1716 PVOID CompareContext,
1726 CompareProc, CompareContext, DupDeviceInfoData);
1754 FIXME(
"Unimplemented codepath!\n");
1811 while (ItemList != &
list->ListHead &&
index-- > 0)
1812 ItemList = ItemList->
Flink;
1813 if (ItemList == &
list->ListHead)
1841 PSTR DeviceInstanceId,
1842 DWORD DeviceInstanceIdSize,
1852 if (!DeviceInstanceId && DeviceInstanceIdSize > 0)
1883 if (
len > DeviceInstanceIdSize)
1910 PWSTR DeviceInstanceId,
1911 DWORD DeviceInstanceIdSize,
1937 if (!DeviceInstanceId && DeviceInstanceIdSize > 0)
1942 if (DeviceInstanceId && DeviceInstanceIdSize == 0)
1966 PCSTR InfSectionName,
1967 PSTR InfSectionWithExt,
1968 DWORD InfSectionWithExtSize,
1983 PWSTR InfSectionWithExt,
1984 DWORD InfSectionWithExtSize,
2002 IN DWORD InfSectionWithExtSize,
2017 if (InfSectionNameW ==
NULL)
2020 if (InfSectionWithExt)
2022 InfSectionWithExtW =
MyMalloc(InfSectionWithExtSize *
sizeof(
WCHAR));
2023 if (InfSectionWithExtW ==
NULL)
2028 InfHandle, InfSectionNameW, AlternatePlatformInfo,
2029 InfSectionWithExt ? InfSectionWithExtW :
NULL,
2030 InfSectionWithExtSize,
2035 if (bResult && InfSectionWithExt)
2038 InfSectionWithExtSize,
NULL,
NULL) != 0;
2042 if (ExtensionW ==
NULL)
2045 *
Extension = &InfSectionWithExt[ExtensionW - InfSectionWithExtW];
2050 MyFree(InfSectionWithExtW);
2060 PSTR ClassDescription,
2061 DWORD ClassDescriptionSize,
2065 ClassDescriptionSize,
2074 PWSTR ClassDescription,
2075 DWORD ClassDescriptionSize,
2079 ClassDescriptionSize,
2088 PSTR ClassDescription,
2089 DWORD ClassDescriptionSize,
2101 if (ClassDescriptionSize > 0)
2103 ClassDescriptionW =
MyMalloc(ClassDescriptionSize *
sizeof(
WCHAR));
2104 if (!ClassDescriptionW)
2127 if (
len == 0 ||
len > ClassDescriptionSize)
2135 MyFree(ClassDescriptionW);
2145 PWSTR ClassDescription,
2146 DWORD ClassDescriptionSize,
2168 if (!ClassDescription && ClassDescriptionSize > 0)
2210 if ((ClassDescription !=
NULL) && (
dwLength <= ClassDescriptionSize))
2224 if ((ClassDescription ==
NULL) || (
dwLength > ClassDescriptionSize))
2339 hDeviceInfo = deviceset;
2352 FIXME(
": flag DIGCF_PROFILE ignored\n");
2373 pClassGuid = &
list->ClassGuid;
2393 pClassGuid = &
list->ClassGuid;
2449 if (
set->MachineName)
2490 if (
set->MachineName)
2506 DWORD CreationFlags,
2514 CreationFlags, DeviceInterfaceData);
2519 if (ReferenceStringW ==
NULL)
return FALSE;
2524 DeviceInterfaceData);
2526 MyFree(ReferenceStringW);
2539 DWORD CreationFlags,
2545 CreationFlags, DeviceInterfaceData);
2571 CreationFlags, DeviceInterfaceData);
2585 PCSTR InfSectionName)
2591 samDesired, InfHandle, InfSectionName);
2594 if (!InfSectionName)
2600 if (!InfSectionNameW)
2604 DeviceInterfaceData,
Reserved, samDesired, InfHandle,
2625 WCHAR bracedGuidString[39];
2630 samDesired, InfHandle, InfSectionName);
2638 if (!DeviceInterfaceData ||
2645 if (InfHandle && !InfSectionName)
2701 if (InfHandle && InfSectionName)
2710 set->SelectedDevice->InstallParams.InstallMsgHandler,
2711 set->SelectedDevice->InstallParams.InstallMsgHandlerContext,
2744 if (!DeviceInterfaceData ||
2805 if (!DeviceInterfaceData ||
2822 InterfaceListEntry = InterfaceListEntry->Flink;
2825 if (MemberIndex-- == 0)
2836 InterfaceListEntry = InterfaceListEntry->Flink;
2845 while (ItemList != &
set->ListHead && !found)
2856 InterfaceListEntry = InterfaceListEntry->
Flink;
2859 if (MemberIndex-- == 0)
2870 InterfaceListEntry = InterfaceListEntry->
Flink;
2872 ItemList = ItemList->
Flink;
2921 DWORD DeviceInterfaceDetailDataSize,
2931 DeviceInterfaceData, DeviceInterfaceDetailData,
2940 if (!DeviceInterfaceData ||
2953 if((DeviceInterfaceDetailDataSize != 0) &&
2960 if (!DeviceInterfaceDetailData && DeviceInterfaceDetailDataSize)
2967 if (DeviceInterfaceDetailData !=
NULL)
2972 if (!DeviceInterfaceDetailDataW)
2978 if (!DeviceInterfaceDetailData || (DeviceInterfaceDetailData && DeviceInterfaceDetailDataW))
2982 DeviceInterfaceData,
2983 DeviceInterfaceDetailDataW,
2991 if (
ret && DeviceInterfaceDetailData && DeviceInterfaceDetailDataSize >= bytesNeeded)
3003 MyFree(DeviceInterfaceDetailDataW);
3015 DWORD DeviceInterfaceDetailDataSize,
3023 DeviceInterfaceData, DeviceInterfaceDetailData,
3032 if (!DeviceInterfaceData ||
3044 if (!DeviceInterfaceDetailData && DeviceInterfaceDetailDataSize)
3054 if ((DeviceInterfaceDetailData !=
NULL)
3067 if (sizeRequired > DeviceInterfaceDetailDataSize)
3149 BOOL bIsStringProperty;
3151 DWORD RequiredSizeA, RequiredSizeW;
3152 DWORD PropertyBufferSizeW = 0;
3163 if (!PropertyBufferW)
3175 PropertyBufferSizeW,
3182 if (bIsStringProperty)
3183 RequiredSizeA = RequiredSizeW /
sizeof(
WCHAR);
3185 RequiredSizeA = RequiredSizeW;
3424 ERR(
"Property 0x%lx not implemented\n",
Property);
3503 if (InfFileNameW ==
NULL)
3577 ERR(
"RegCreateKeyExW(%s) failed\n",
debugstr_w(FullBuffer));
3581 TRACE(
"The class key %s was successfully created\n",
debugstr_w(FullBuffer));
3583 TRACE(
"The class key %s was successfully opened\n",
debugstr_w(FullBuffer));
3646 if (MachineNameW ==
NULL)
3700 ERR(
"Invalid Flags parameter!\n");
3723 WCHAR bracedGuidString[39];
3807 if (DevicePath[0] !=
L'\\' ||
3808 DevicePath[1] !=
L'\\' ||
3809 (DevicePath[2] !=
L'?' && DevicePath[2] !=
L'.') ||
3810 DevicePath[3] !=
L'\\')
3818 pEnd =
wcschr(&DevicePath[4],
L'\\');
3845 ItemList =
list->ListHead.Flink;
3846 while (ItemList != &
list->ListHead)
3855 InterfaceListEntry = InterfaceListEntry->
Flink;
3861 if (DeviceInterfaceData)
3864 DeviceInterfaceData->
Flags = deviceInterface->
Flags;
3889 InstancePath[0] = 0;
3890 dwKeyName =
sizeof(InstancePath);
3908 dwKeyName =
sizeof(SymBuffer);
3909 SymBuffer[0] =
L'\0';
3918 if (!
wcsicmp(SymBuffer, DevicePath))
3928 if (deviceInterface)
3941 if (DeviceInterfaceData)
3944 DeviceInterfaceData->
Flags = deviceInterface->
Flags;
3988 if (DevicePathW ==
NULL)
3992 DevicePathW, OpenFlags, DeviceInterfaceData);
4046#define CLASS_COINSTALLER 0x1
4047#define DEVICE_COINSTALLER 0x2
4048#define CLASS_INSTALLER 0x4
4049 UCHAR CanHandle = 0;
4052 switch (InstallFunction)
4131 ERR(
"Install function %u not supported\n", InstallFunction);