[SETUPAPI] SETUP_CreateDevicesList must return ERROR_INVALID_DATA when the Enumerator is invalid

This fixes the devclass apitest.
This commit is contained in:
Eric Kohl 2024-11-01 22:17:02 +01:00
parent 91bc5b5e94
commit d55ca68f7d

View file

@ -2,7 +2,7 @@
* SetupAPI device class-related functions * SetupAPI device class-related functions
* *
* Copyright 2000 Andreas Mohr for CodeWeavers * Copyright 2000 Andreas Mohr for CodeWeavers
* 2005-2006 Hervé Poussineau (hpoussin@reactos.org) * 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -159,7 +159,7 @@ SETUP_CreateDevicesList(
TRACE("CM_Get_Device_ID_List_ExW() failed with status 0x%x\n", cr); TRACE("CM_Get_Device_ID_List_ExW() failed with status 0x%x\n", cr);
if (Buffer) if (Buffer)
HeapFree(GetProcessHeap(), 0, Buffer); HeapFree(GetProcessHeap(), 0, Buffer);
return GetErrorCodeFromCrCode(cr); return (cr == CR_REGISTRY_ERROR) ? ERROR_INVALID_DATA : GetErrorCodeFromCrCode(cr);
} }
} }
while (cr != CR_SUCCESS); while (cr != CR_SUCCESS);