From 936f0206466591b63a92b53f05fe81c31fad5b60 Mon Sep 17 00:00:00 2001 From: winesync Date: Fri, 5 Jan 2024 20:53:35 +0100 Subject: [PATCH] ******* TODO: Check whether I want to remove this switch (lerror) thing and use code more similar to Wine's... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [WINESYNC] setupapi: Fix SetupDiGetDeviceRegistryProperty if property does not exist. Signed-off-by: Andrew Wesie Signed-off-by: Alexandre Julliard wine commit id e4645d60d72a9fbfbd745e275d4f90110bdceb4d by Andrew Wesie SYNC NOTE: Adapted for ReactOS code. Co-authored-by: Hermès Bélusca-Maïto --- dll/win32/setupapi/devinst.c | 20 ++++++++++++++++++-- sdk/tools/winesync/setupapi.cfg | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/dll/win32/setupapi/devinst.c b/dll/win32/setupapi/devinst.c index 05fe8314c66..8596f1386c5 100644 --- a/dll/win32/setupapi/devinst.c +++ b/dll/win32/setupapi/devinst.c @@ -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; } diff --git a/sdk/tools/winesync/setupapi.cfg b/sdk/tools/winesync/setupapi.cfg index 756dcd35c8a..d99e35f1b36 100644 --- a/sdk/tools/winesync/setupapi.cfg +++ b/sdk/tools/winesync/setupapi.cfg @@ -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