******* TODO: Check whether I want to remove this switch (lerror) thing and use code more similar to Wine's...

[WINESYNC] setupapi: Fix SetupDiGetDeviceRegistryProperty if property does not exist.

Signed-off-by: Andrew Wesie <awesie@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id e4645d60d72a9fbfbd745e275d4f90110bdceb4d by Andrew Wesie <awesie@gmail.com>

SYNC NOTE: Adapted for ReactOS code.

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
This commit is contained in:
winesync 2024-01-05 20:53:35 +01:00 committed by Hermès Bélusca-Maïto
parent 3c8b1d2e0b
commit 4aaaa0687d
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 19 additions and 3 deletions

View file

@ -3312,18 +3312,34 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(
if (RequiredSize)
*RequiredSize = size;
#if 0 // Similar to Wine's code
if (lError == ERROR_FILE_NOT_FOUND)
lError = ERROR_INVALID_DATA;
else if (lError == ERROR_MORE_DATA || !PropertyBufferSize)
lError = ERROR_INSUFFICIENT_BUFFER;
/*
else if (lError == ERROR_SUCCESS)
ret = TRUE;
else
SetLastError(lError);
*/
#else
switch (lError)
{
case ERROR_SUCCESS:
if (PropertyBuffer == NULL && size != 0)
if (!PropertyBuffer && size != 0)
lError = ERROR_INSUFFICIENT_BUFFER;
break;
case ERROR_FILE_NOT_FOUND:
lError = ERROR_INVALID_DATA;
break;
case ERROR_MORE_DATA:
lError = ERROR_INSUFFICIENT_BUFFER;
break;
default:
break;
}
#endif
}
else if (Property == SPDRP_PHYSICAL_DEVICE_OBJECT_NAME)
{
@ -3373,7 +3389,7 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(
lError = ERROR_INSUFFICIENT_BUFFER;
break;
default :
default:
lError = ERROR_INVALID_DATA;
break;
}

View file

@ -5,4 +5,4 @@ files:
dlls/setupapi/misc.c: dll/win32/setupapi/misc.c
dlls/setupapi/stubs.c: dll/win32/setupapi/stubs.c
tags:
wine: 852cd999f3de5b95444b99a1912ed6900a64a37b
wine: e4645d60d72a9fbfbd745e275d4f90110bdceb4d