Skip to content

Commit dbb43bb

Browse files
committed
[0.4.15][SDK][CRYPT32][SETUPAPI][BOOTDATA] Fix VirtualBox guest additions, RelWithDebInfo target, USB
Fixes the release with debug information build target (RelWithDebInfo), complete a backport for CORE-19496, and import VirtualBox guest additions fixes from Ratin Gao (RatinCN). In addition, comment out bogus asserts in the USB stack that can prevent ReactOS from booting over USB on real hardware. Also adjust boot options in both LiveCD and BootCD to boot by default into the non-debug version. Finally, remove some bugchecks in our memory manager for common issues that do not bugcheck on release versions anyways. The text for the readme document on the desktop was also updated. This includes a squashed backport of the following commits: 6c7d2a2 [SDK] Fix RelWithDebInfo (reactos#7811) 275c40d [CRYPT32] Initial implementation of CertEnumSystemStoreLocation() (reactos#7746) 7a9c744 [SETUPAPI] Stub implement SetupQueryInfVersionInformation (reactos#7769) 49a55a0 [SETUPAPI] Refactor SetupInstallServicesFromInfSectionExW (reactos#7770) cfcc8d8 [NEWDEV] Fix HardwareId match logic in UpdateDriverForPlugAndPlayDevicesW (reactos#7808) 2ffc6d2 [BOOTDATA] Follow-up of reactos#7795; Modify NLS registry (reactos#7799)
1 parent 22fb3bb commit dbb43bb

File tree

18 files changed

+365
-123
lines changed

18 files changed

+365
-123
lines changed

base/setup/lib/bootsup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ CreateFreeLoaderReactOSEntries(
135135
else
136136
#endif
137137
{
138-
#if DBG
138+
#if 0 // DBG
139139
BootOptions.NextBootEntryKey = MAKESTRKEY(L"ReactOS_Debug");
140140
#else
141141
BootOptions.NextBootEntryKey = MAKESTRKEY(L"ReactOS");
@@ -153,7 +153,7 @@ CreateFreeLoaderReactOSEntries(
153153
else
154154
{
155155
/* Timeout=10 */
156-
BootOptions.Timeout = 10;
156+
BootOptions.Timeout = 3; // 10 by default (0.4.15 hack)
157157
}
158158
#endif
159159

boot/bootdata/hivesys.inf

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040a",0x00000000,"l_intl.n
11001100
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","080a",0x00000000,"l_intl.nls"
11011101
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c0a",0x00000000,"l_intl.nls"
11021102
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","100a",0x00000000,"l_intl.nls"
1103-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","140a",0x00000000,"l_intl.nls"
1103+
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","140a",0x00000000,"l_intl.nls"
11041104
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","180a",0x00000000,"l_intl.nls"
11051105
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1c0a",0x00000000,"l_intl.nls"
11061106
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","200a",0x00000000,"l_intl.nls"
@@ -1150,23 +1150,23 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041d",0x00000000,"l_intl.n
11501150
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","081d",0x00000000,"l_intl.nls"
11511151
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041e",0x00000000,"l_intl.nls"
11521152
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041f",0x00000000,"l_intl.nls"
1153-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0420",0x00000000,"l_intl.nls"
1153+
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0420",0x00000000,"l_intl.nls"
11541154
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0421",0x00000000,"l_intl.nls"
11551155
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0422",0x00000000,"l_intl.nls"
11561156
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0423",0x00000000,"l_intl.nls"
11571157
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0424",0x00000000,"l_intl.nls"
11581158
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0425",0x00000000,"l_intl.nls"
11591159
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0426",0x00000000,"l_intl.nls"
11601160
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0427",0x00000000,"l_intl.nls"
1161-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0429",0x00000000,"l_intl.nls"
1162-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042a",0x00000000,"l_intl.nls"
1161+
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0429",0x00000000,"l_intl.nls"
1162+
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042a",0x00000000,"l_intl.nls"
11631163
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042b",0x00000000,"l_intl.nls"
11641164
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042c",0x00000000,"l_intl.nls"
11651165
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","082c",0x00000000,"l_intl.nls"
11661166
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042d",0x00000000,"l_intl.nls"
11671167
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042f",0x00000000,"l_intl.nls"
11681168
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0436",0x00000000,"l_intl.nls"
1169-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0437",0x00000000,"l_intl.nls"
1169+
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0437",0x00000000,"l_intl.nls"
11701170
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0438",0x00000000,"l_intl.nls"
11711171
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0439",0x00000000,"l_intl.nls"
11721172
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","043e",0x00000000,"l_intl.nls"
@@ -1178,7 +1178,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0443",0x00000000,"l_intl.n
11781178
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0843",0x00000000,"l_intl.nls"
11791179
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0444",0x00000000,"l_intl.nls"
11801180
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0445",0x00000000,"l_intl.nls"
1181-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0455",0x00000000,"l_intl.nls"
1181+
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0455",0x00000000,"l_intl.nls"
11821182
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0456",0x00000000,"l_intl.nls"
11831183
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","048f",0x00000000,"l_intl.nls"
11841184
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0490",0x00000000,"l_intl.nls"
@@ -1189,6 +1189,8 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","InstallLanguage",0x0000000
11891189
; Supported and installed locales
11901190
; If you add/uncomment an entry here, please also add the appropriate Language
11911191
; in the previous section.
1192+
; See also: https://www.venea.net/web/culture-code
1193+
; https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f
11921194
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale",,0x00000012
11931195
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000401",0x00000000,"d"
11941196
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000801",0x00000000,"d"
@@ -1233,7 +1235,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040a",0x00000000,"1"
12331235
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000080a",0x00000000,"1"
12341236
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c0a",0x00000000,"1"
12351237
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000100a",0x00000000,"1"
1236-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000140a",0x00000000,"1"
1238+
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000140a",0x00000000,"1"
12371239
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000180a",0x00000000,"1"
12381240
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001c0a",0x00000000,"1"
12391241
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000200a",0x00000000,"1"
@@ -1270,7 +1272,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000814",0x00000000,"1"
12701272
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000415",0x00000000,"2"
12711273
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000416",0x00000000,"1"
12721274
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000816",0x00000000,"1"
1273-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000417",0x00000000,"1"
1275+
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000417",0x00000000,"1"
12741276
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000418",0x00000000,"2"
12751277
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000419",0x00000000,"5"
12761278
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041a",0x00000000,"2"
@@ -1282,23 +1284,23 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041d",0x00000000,"1"
12821284
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000081d",0x00000000,"1"
12831285
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041e",0x00000000,"b"
12841286
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041f",0x00000000,"6"
1285-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000420",0x00000000,""
1287+
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000420",0x00000000,"d"
12861288
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000421",0x00000000,"1"
12871289
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000422",0x00000000,"5"
12881290
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000423",0x00000000,"5"
12891291
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000424",0x00000000,"2"
12901292
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000425",0x00000000,"3"
12911293
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000426",0x00000000,"3"
12921294
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000427",0x00000000,"3"
1293-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000429",0x00000000,""
1294-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042a",0x00000000,""
1295+
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000429",0x00000000,"d"
1296+
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042a",0x00000000,"e"
12951297
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042b",0x00000000,"11"
12961298
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042c",0x00000000,"6"
12971299
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000082c",0x00000000,"5"
12981300
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042d",0x00000000,"1"
12991301
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042f",0x00000000,"5"
13001302
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000436",0x00000000,"1"
1301-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000437",0x00000000,"10"
1303+
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000437",0x00000000,"10"
13021304
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000438",0x00000000,"1"
13031305
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000439",0x00000000,"f"
13041306
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000043e",0x00000000,"1"
@@ -1309,11 +1311,11 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000441",0x00000000,"1"
13091311
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000443",0x00000000,"6"
13101312
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000843",0x00000000,"5"
13111313
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000444",0x00000000,"5"
1312-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000445",0x00000000,"f"
1313-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000455",0x00000000,""
1314+
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000445",0x00000000,"f"
1315+
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000455",0x00000000,"1"
13141316
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000456",0x00000000,"1"
1315-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000048f",0x00000000,"1"
1316-
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000490",0x00000000,"1"
1317+
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000048f",0x00000000,"1" ; tdd-Tale-CN, reserved
1318+
;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000490",0x00000000,"1" ; khb-Talu-CN, reserved
13171319

13181320
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","1",0x00000000,"1"
13191321
HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","2",0x00000000,"1"

boot/bootdata/livecd.ini

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[FREELOADER]
2-
DefaultOS=LiveCD_Debug
3-
TimeOut=5
2+
DefaultOS=LiveCD
3+
TimeOut=3 ; 5 was default (0.4.15 hack)
44

55
[Display]
66
TitleText=ReactOS LiveCD
@@ -9,8 +9,8 @@ MinimalUI=Yes
99
[Operating Systems]
1010
LiveCD="LiveCD"
1111
LiveCD_Debug="LiveCD (Debug)"
12-
LiveCD_Macpi="LiveCD ACPI SMP (Debug)"
13-
LiveCD_Aacpi="LiveCD ACPI APIC (Debug)"
12+
; LiveCD_Macpi="LiveCD ACPI SMP (Debug)"
13+
; LiveCD_Aacpi="LiveCD ACPI APIC (Debug)"
1414
LiveCD_VBoxDebug="LiveCD (VBox Debug)"
1515
LiveCD_Screen="LiveCD (Screen)"
1616
LiveCD_LogFile="LiveCD (Log file)"
@@ -25,15 +25,15 @@ BootType=Windows2003
2525
SystemPath=\reactos
2626
Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /FASTDETECT /MININT
2727

28-
[LiveCD_Macpi]
29-
BootType=Windows2003
30-
SystemPath=\reactos
31-
Options=/HAL=halmacpi.dll /KERNEL=ntkrnlmp.exe /DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /FASTDETECT /MININT
28+
; [LiveCD_Macpi]
29+
; BootType=Windows2003
30+
; SystemPath=\reactos
31+
; Options=/HAL=halmacpi.dll /KERNEL=ntkrnlmp.exe /DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /FASTDETECT /MININT
3232

33-
[LiveCD_Aacpi]
34-
BootType=Windows2003
35-
SystemPath=\reactos
36-
Options=/HAL=halaacpi.dll /DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /FASTDETECT /MININT
33+
; [LiveCD_Aacpi]
34+
; BootType=Windows2003
35+
; SystemPath=\reactos
36+
; Options=/HAL=halaacpi.dll /DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /FASTDETECT /MININT
3737

3838
[LiveCD_VBoxDebug]
3939
BootType=Windows2003

boot/bootdata/readme.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
========================
2-
ReactOS™ Version 0.4.x
3-
Updated October 9, 2021
2+
ReactOS™ Version 0.4.15
3+
Updated 23 March 2025
44
========================
55

66
1. What is ReactOS?

dll/win32/crypt32/crypt32.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
@ stdcall CertEnumCertificatesInStore(ptr ptr)
4040
@ stdcall CertEnumPhysicalStore(ptr long ptr ptr)
4141
@ stdcall CertEnumSystemStore(long ptr ptr ptr)
42+
@ stdcall CertEnumSystemStoreLocation(long ptr ptr)
4243
@ stdcall CertFindAttribute(str long ptr)
4344
@ stdcall CertFindCRLInStore(ptr long long long ptr ptr)
4445
@ stdcall CertFindCTLInStore(ptr long long long ptr ptr)

dll/win32/crypt32/store.c

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,61 @@ BOOL WINAPI CertEnumSystemStore(DWORD dwFlags, void *pvSystemStoreLocationPara,
13581358
return ret;
13591359
}
13601360

1361+
#ifdef __REACTOS__
1362+
1363+
typedef struct _CERT_SYSTEM_STORE_LOCATION
1364+
{
1365+
DWORD dwFlags;
1366+
PCWSTR pwszStoreLocation;
1367+
} CERT_SYSTEM_STORE_LOCATION, *PCERT_SYSTEM_STORE_LOCATION;
1368+
1369+
static const CERT_SYSTEM_STORE_LOCATION gSystemStoreLocations[] = {
1370+
{ CERT_SYSTEM_STORE_CURRENT_USER, L"CurrentUser" },
1371+
{ CERT_SYSTEM_STORE_LOCAL_MACHINE, L"LocalMachine" },
1372+
{ CERT_SYSTEM_STORE_CURRENT_SERVICE, L"CurrentService" },
1373+
{ CERT_SYSTEM_STORE_SERVICES, L"Services" },
1374+
{ CERT_SYSTEM_STORE_USERS, L"Users" },
1375+
{ CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY, L"CurrentUserGroupPolicy" },
1376+
{ CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY, L"LocalMachineGroupPolicy" },
1377+
{ CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE, L"LocalMachineEnterprise" },
1378+
};
1379+
1380+
BOOL
1381+
WINAPI
1382+
CertEnumSystemStoreLocation(
1383+
_In_ DWORD dwFlags,
1384+
_Inout_opt_ void *pvArg,
1385+
__callback PFN_CERT_ENUM_SYSTEM_STORE_LOCATION pfnEnum)
1386+
{
1387+
DWORD i;
1388+
1389+
/* Check input flags */
1390+
if (dwFlags != 0)
1391+
{
1392+
SetLastError(E_INVALIDARG);
1393+
return FALSE;
1394+
}
1395+
1396+
/* Return fixed system stores */
1397+
for (i = 0; i < ARRAYSIZE(gSystemStoreLocations); i++)
1398+
{
1399+
if (!pfnEnum(gSystemStoreLocations[i].pwszStoreLocation,
1400+
gSystemStoreLocations[i].dwFlags,
1401+
NULL,
1402+
pvArg))
1403+
{
1404+
return FALSE;
1405+
}
1406+
}
1407+
1408+
/* FIXME: Return registered OID system stores by calling CryptEnumOIDFunction */
1409+
FIXME("Registered OID system stores is not enumerated\n");
1410+
1411+
return TRUE;
1412+
}
1413+
1414+
#endif /* __REACTOS__ */
1415+
13611416
BOOL WINAPI CertEnumPhysicalStore(const void *pvSystemStore, DWORD dwFlags,
13621417
void *pvArg, PFN_CERT_ENUM_PHYSICAL_STORE pfnEnum)
13631418
{

dll/win32/newdev/newdev.c

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* New device installer (newdev.dll)
33
*
4-
* Copyright 2005-2006 Hervé Poussineau ([email protected])
4+
* Copyright 2005-2006 Hervé Poussineau ([email protected])
55
* 2005 Christoph von Wittich ([email protected])
66
* 2009 Colin Finck ([email protected])
77
*
@@ -50,6 +50,7 @@ UpdateDriverForPlugAndPlayDevicesW(
5050
LPWSTR Buffer = NULL;
5151
DWORD BufferSize;
5252
LPCWSTR CurrentHardwareId; /* Pointer into Buffer */
53+
DWORD Property;
5354
BOOL FoundHardwareId, FoundAtLeastOneDevice = FALSE;
5455
BOOL ret = FALSE;
5556

@@ -86,51 +87,58 @@ UpdateDriverForPlugAndPlayDevicesW(
8687
break;
8788
}
8889

89-
/* Get Hardware ID */
90-
HeapFree(GetProcessHeap(), 0, Buffer);
91-
Buffer = NULL;
92-
BufferSize = 0;
93-
while (!SetupDiGetDeviceRegistryPropertyW(
94-
DevInstData.hDevInfo,
95-
&DevInstData.devInfoData,
96-
SPDRP_HARDWAREID,
97-
NULL,
98-
(PBYTE)Buffer,
99-
BufferSize,
100-
&BufferSize))
90+
/* Match Hardware ID */
91+
FoundHardwareId = FALSE;
92+
Property = SPDRP_HARDWAREID;
93+
while (TRUE)
10194
{
102-
if (GetLastError() == ERROR_FILE_NOT_FOUND)
103-
{
104-
Buffer = NULL;
105-
break;
106-
}
107-
else if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
95+
/* Get IDs data */
96+
Buffer = NULL;
97+
BufferSize = 0;
98+
while (!SetupDiGetDeviceRegistryPropertyW(DevInstData.hDevInfo,
99+
&DevInstData.devInfoData,
100+
Property,
101+
NULL,
102+
(PBYTE)Buffer,
103+
BufferSize,
104+
&BufferSize))
108105
{
109-
TRACE("SetupDiGetDeviceRegistryPropertyW() failed with error 0x%x\n", GetLastError());
110-
goto cleanup;
106+
if (GetLastError() == ERROR_FILE_NOT_FOUND)
107+
{
108+
break;
109+
}
110+
else if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
111+
{
112+
TRACE("SetupDiGetDeviceRegistryPropertyW() failed with error 0x%x\n", GetLastError());
113+
goto cleanup;
114+
}
115+
/* This error was expected */
116+
HeapFree(GetProcessHeap(), 0, Buffer);
117+
Buffer = HeapAlloc(GetProcessHeap(), 0, BufferSize);
118+
if (!Buffer)
119+
{
120+
TRACE("HeapAlloc() failed\n", GetLastError());
121+
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
122+
goto cleanup;
123+
}
111124
}
112-
/* This error was expected */
113-
HeapFree(GetProcessHeap(), 0, Buffer);
114-
Buffer = HeapAlloc(GetProcessHeap(), 0, BufferSize);
115-
if (!Buffer)
125+
if (Buffer)
116126
{
117-
TRACE("HeapAlloc() failed\n", GetLastError());
118-
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
119-
goto cleanup;
127+
/* Check if we match the given hardware ID */
128+
for (CurrentHardwareId = Buffer; *CurrentHardwareId != UNICODE_NULL; CurrentHardwareId += wcslen(CurrentHardwareId) + 1)
129+
{
130+
if (_wcsicmp(CurrentHardwareId, HardwareId) == 0)
131+
{
132+
FoundHardwareId = TRUE;
133+
break;
134+
}
135+
}
120136
}
121-
}
122-
if (Buffer == NULL)
123-
continue;
124-
125-
/* Check if we match the given hardware ID */
126-
FoundHardwareId = FALSE;
127-
for (CurrentHardwareId = Buffer; *CurrentHardwareId != UNICODE_NULL; CurrentHardwareId += wcslen(CurrentHardwareId) + 1)
128-
{
129-
if (wcscmp(CurrentHardwareId, HardwareId) == 0)
137+
if (FoundHardwareId || Property == SPDRP_COMPATIBLEIDS)
130138
{
131-
FoundHardwareId = TRUE;
132139
break;
133140
}
141+
Property = SPDRP_COMPATIBLEIDS;
134142
}
135143
if (!FoundHardwareId)
136144
continue;

0 commit comments

Comments
 (0)