[PATCH] setupapi: Return CR_NO_SUCH_DEVNODE from CM_Get_Parent stub.

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Sun Apr 1 16:48:49 CDT 2018


From: Tim Wanders <timwanders241 at gmail.com>

Fixes: https://bugs.winehq.org/show_bug.cgi?id=43831

Returning CR_SUCCESS assumes that the return value will be valid.
This causes crashes in programs which only check the return.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/setupapi/stubs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c
index 990974d9b9..7c3413a7cc 100644
--- a/dlls/setupapi/stubs.c
+++ b/dlls/setupapi/stubs.c
@@ -180,8 +180,9 @@ CONFIGRET WINAPI CM_Get_Device_ID_List_SizeW( PULONG  pulLen, PCWSTR  pszFilter,
 DWORD WINAPI CM_Get_Parent(PDEVINST pdnDevInst, DEVINST dnDevInst, ULONG ulFlags)
 {
     FIXME("%p 0x%08x 0x%08x stub\n", pdnDevInst, dnDevInst, ulFlags);
-    *pdnDevInst = dnDevInst;
-    return CR_SUCCESS;
+    if(pdnDevInst)
+        *pdnDevInst = 0;
+    return CR_NO_SUCH_DEVNODE;
 }
 
 /***********************************************************************
-- 
2.16.2




More information about the wine-devel mailing list