No need to allocate too much memory, as SetupDiGetDeviceRegistryPropertyW returns a size in bytes, not in characters. Bug spotted by Filip Modified: trunk/reactos/lib/setupapi/devinst.c _____
Modified: trunk/reactos/lib/setupapi/devinst.c --- trunk/reactos/lib/setupapi/devinst.c 2005-09-02 13:12:44 UTC (rev 17604) +++ trunk/reactos/lib/setupapi/devinst.c 2005-09-02 18:51:32 UTC (rev 17605) @@ -3466,7 +3466,7 @@
while (!Result && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { HeapFree(GetProcessHeap(), 0, HardwareIDs); - HardwareIDs = HeapAlloc(GetProcessHeap(), 0, RequiredSize * sizeof(WCHAR)); + HardwareIDs = HeapAlloc(GetProcessHeap(), 0, RequiredSize); if (!HardwareIDs) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -3491,7 +3491,7 @@ while (!Result && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { HeapFree(GetProcessHeap(), 0, CompatibleIDs); - CompatibleIDs = HeapAlloc(GetProcessHeap(), 0, RequiredSize * sizeof(WCHAR)); + CompatibleIDs = HeapAlloc(GetProcessHeap(), 0, RequiredSize); if (!CompatibleIDs) { SetLastError(ERROR_NOT_ENOUGH_MEMORY);