Alexander Morozov amorozov@etersoft.ru writes:
SETUPDI_AddDeviceToSet: changing pointers on SP_DEVINFO_DATA after allocating new memory block for their array
We shouldn't have to do that sort of thing. The data structure should be fixed to store pointers that don't have to be moved around.
SETUPDI_AddDeviceToSet: changing pointers on SP_DEVINFO_DATA after allocating new memory block for their array
We shouldn't have to do that sort of thing. The data structure should be fixed to store pointers that don't have to be moved around.
Should modify DeviceInfoSet and _SP_DEVINFO_DATA structures? Without this patch so modified testRegisterAndGetDetail crashes:
--- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -777,22 +777,26 @@ static void testRegisterAndGetDetail(voi SP_DEVINFO_DATA devInfo = { sizeof(SP_DEVINFO_DATA), { 0 } }; SP_DEVICE_INTERFACE_DATA interfaceData = { sizeof(interfaceData), { 0 } }; DWORD dwSize = 0; + DWORD i;
SetLastError(0xdeadbeef); set = pSetupDiGetClassDevsA(&guid, NULL, 0, DIGCF_ALLCLASSES); ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevsA failed: %08x\n", GetLastError());
- SetLastError(0xdeadbeef); - ret = pSetupDiCreateDeviceInfoA(set, "LEGACY_BOGUS", &guid, NULL, 0, - DICD_GENERATE_ID, &devInfo); - ok(ret, "SetupDiCreateDeviceInfoA failed: %08x\n", GetLastError()); - SetLastError(0xdeadbeef); - ret = pSetupDiCreateDeviceInterfaceA(set, &devInfo, &guid, NULL, 0, &interfaceData); - ok(ret, "SetupDiCreateDeviceInterfaceA failed: %08x\n", GetLastError()); - SetLastError(0xdeadbeef); - ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL, NULL); - ok(ret, "SetupDiRegisterDeviceInfo failed: %08x\n", GetLastError()); + for (i = 0; i < 10; ++i) + { + SetLastError(0xdeadbeef); + ret = pSetupDiCreateDeviceInfoA(set, "LEGACY_BOGUS", &guid, NULL, 0, + DICD_GENERATE_ID, &devInfo); + ok(ret, "SetupDiCreateDeviceInfoA failed: %08x\n", GetLastError()); + SetLastError(0xdeadbeef); + ret = pSetupDiCreateDeviceInterfaceA(set, &devInfo, &guid, NULL, 0, &interfaceData); + ok(ret, "SetupDiCreateDeviceInterfaceA failed: %08x\n", GetLastError()); + SetLastError(0xdeadbeef); + ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL, NULL); + ok(ret, "SetupDiRegisterDeviceInfo failed: %08x\n", GetLastError()); + }
pSetupDiDestroyDeviceInfoList(set);
Should modify DeviceInfoSet and _SP_DEVINFO_DATA structures?
Yes. A linked list would be more appropriate than an array. Embarrassingly, this is the second time I've introduced such an error into Wine. Sorry for the mess. --Juan