please help with patch submission

Damjan Jovanovic dj015 at yahoo.com
Mon Jul 31 05:37:45 CDT 2006


Hi

I have a short patch that fixes serious bugs I've
encountered in setupapi's SetupDiOpenClassRegKeyExW().
It's been mailed twice to wine-patches and is attached
for reference. Is there anything wrong with it?

Please comment.

Thank you
Damjan


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
--- wine-0.9.17-old/dlls/setupapi/devinst.c	2006-07-10 18:01:08.000000000 +0200
+++ wine-0.9.17/dlls/setupapi/devinst.c	2006-07-28 14:12:39.000000000 +0200
@@ -33,20 +33,21 @@
 #include "winnls.h"
 #include "setupapi.h"
 #include "wine/debug.h"
 #include "wine/unicode.h"
 #include "ddk/cfgmgr32.h"
 #include "initguid.h"
 #include "winioctl.h"
 #include "rpc.h"
 #include "rpcdce.h"
 
+#include "ddk/cfgmgr32.h"
 #include "setupapi_private.h"
 
 
 WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
 
 /* Unicode constants */
 static const WCHAR ClassGUID[]  = {'C','l','a','s','s','G','U','I','D',0};
 static const WCHAR Class[]  = {'C','l','a','s','s',0};
 static const WCHAR ClassInstall32[]  = {'C','l','a','s','s','I','n','s','t','a','l','l','3','2',0};
 static const WCHAR NoDisplayClass[]  = {'N','o','D','i','s','p','l','a','y','C','l','a','s','s',0};
@@ -1314,20 +1315,21 @@
  *		SetupDiOpenClassRegKeyExW  (SETUPAPI.@)
  */
 HKEY WINAPI SetupDiOpenClassRegKeyExW(
         const GUID* ClassGuid,
         REGSAM samDesired,
         DWORD Flags,
         PCWSTR MachineName,
         PVOID Reserved)
 {
     LPWSTR lpGuidString;
+    WCHAR guidStringWithBraces[MAX_GUID_STRING_LEN];
     HKEY hClassesKey;
     HKEY hClassKey;
     LPCWSTR lpKeyName;
 
     if (MachineName != NULL)
     {
         FIXME("Remote access not supported yet!\n");
         return INVALID_HANDLE_VALUE;
     }
 
@@ -1354,35 +1356,39 @@
     {
 	return INVALID_HANDLE_VALUE;
     }
 
     if (ClassGuid == NULL)
         return hClassesKey;
 
     if (UuidToStringW((UUID*)ClassGuid, &lpGuidString) != RPC_S_OK)
     {
 	RegCloseKey(hClassesKey);
-	return FALSE;
+	return INVALID_HANDLE_VALUE;
     }
+    guidStringWithBraces[0] = (WCHAR) '{';
+    CopyMemory(&guidStringWithBraces[1], lpGuidString,
+        (MAX_GUID_STRING_LEN - 3) * sizeof(WCHAR));
+    guidStringWithBraces[1 + strlenW(lpGuidString)] = (WCHAR) '}';
+    guidStringWithBraces[2 + strlenW(lpGuidString)] = 0;
+    RpcStringFreeW(&lpGuidString);
 
     if (RegOpenKeyExW(hClassesKey,
-		      lpGuidString,
+		      guidStringWithBraces,
 		      0,
 		      KEY_ALL_ACCESS,
 		      &hClassKey))
     {
-	RpcStringFreeW(&lpGuidString);
 	RegCloseKey(hClassesKey);
-	return FALSE;
+	return INVALID_HANDLE_VALUE;
     }
 
-    RpcStringFreeW(&lpGuidString);
     RegCloseKey(hClassesKey);
 
     return hClassKey;
 }
 
 /***********************************************************************
  *		SetupDiOpenDeviceInterfaceW (SETUPAPI.@)
  */
 BOOL WINAPI SetupDiOpenDeviceInterfaceW(
        HDEVINFO DeviceInfoSet,


More information about the wine-devel mailing list