I was mistaken. Enum/ROOT/LEGACY_BOGUS key can be deleted so:
SetLastError(0xdeadbeef); set = pSetupDiGetClassDevsA(&guid, NULL, 0, 0); ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevsA failed: %08x\n", GetLastError()); SetLastError(0xdeadbeef); ret = pSetupDiEnumDeviceInfo(set, 0, &devInfo); ok(ret, "SetupDiEnumDeviceInfo failed: %08x\n", GetLastError()); if (pSetupDiRemoveDevice) { SetLastError(0xdeadbeef); ret = pSetupDiRemoveDevice(set, &devInfo); todo_wine ok(ret, "SetupDiRemoveDevice failed: %08x\n", GetLastError()); } else skip("SetupDiRemoveDevice is not available\n"); pSetupDiDestroyDeviceInfoList(set);