patch feedback?

Damjan Jovanovic dj015 at yahoo.com
Fri Aug 11 04:36:37 CDT 2006


Hi

I've tried submitting a patch to wine-patches 3 times
now in the past 3 weeks, and not only has it not been
applied, but I never even got any feedback.

Please tell me what I am doing wrong.

The latest patch is below.

Thank you
Damjan

--- Damjan Jovanovic <dj015 at yahoo.com> wrote:

> Date: Thu, 3 Aug 2006 23:49:11 -0700 (PDT)
> From: Damjan Jovanovic <dj015 at yahoo.com>
> To: wine-patches at winehq.org
> Subject: setupapi: test+patch for
> SetupDiOpenClassRegKeyExW (try 3)
> 
> wine's SetupDiOpenClassRegKeyExW returns FALSE
> instead
> of INVALID_HANDLE_VALUE in several places, and
> doesn't
> brace the GUID string like it should. The test
> reveals
> these problems, and the patch fixes them.
> 
> ChangeLog:
> * Fixed returns values, braced GUID string, and
> added
> a test, for SetupDiOpenClassRegKeyExW.
> 
> Damjan Jovanovic (dj015 at yahoo.com)
> 
> 
> a/dlls/setupapi/tests/Makefile.in	2006-07-10
> 18:01:08.000000000 +0200
> +++ b/dlls/setupapi/tests/Makefile.in	2006-08-04
> 16:15:05.000000000 +0200
> @@ -3,7 +3,7 @@
>  SRCDIR    = @srcdir@
>  VPATH     = @srcdir@
>  TESTDLL   = setupapi.dll
> -IMPORTS   = setupapi kernel32
> +IMPORTS   = setupapi kernel32 advapi32 rpcrt4
>  
>  CTESTS = \
>  	devinst.c \
> --- a/dlls/setupapi/tests/devinst.c	2006-08-03
> 10:07:11.000000000 +0200
> +++ b/dlls/setupapi/tests/devinst.c	2006-08-04
> 17:57:57.000000000 +0200
> @@ -27,6 +27,7 @@
>  #include "winuser.h"
>  #include "winreg.h"
>  #include "setupapi.h"
> +#include "rpc.h"
>  
>  #include "wine/test.h"
>  
> @@ -63,7 +64,85 @@
>      ok(ret, "SetupDiDestroyDeviceInfoList failed :
> %ld\n", error);
>  }
>  
> +static void test_SetupDiOpenClassRegKeyExW()
> +{
> +    GUID guid;
> +    RPC_STATUS rpcStatus;
> +    HKEY hkey;
> +    WCHAR *unbracedGuid;
> +    WCHAR *bracedGuid;
> +
> +    rpcStatus = UuidCreate(&guid);
> +    if (rpcStatus != RPC_S_OK)
> +    {
> +        ok(FALSE, "failed to generate test guid,
> error %ld", rpcStatus);
> +        return;
> +    }
> +
> +    /* Check return value for non-existant key */
> +    hkey = SetupDiOpenClassRegKeyExW(&guid,
> KEY_ALL_ACCESS, 
> +        DIOCR_INSTALLER, NULL, NULL);
> +    ok(hkey == INVALID_HANDLE_VALUE,
> +        "invalid return value %p from
> SetupDiOpenClassRegKeyExW "
> +        "for non-existant key, expected %p\n",
> hkey, INVALID_HANDLE_VALUE);
> +
> +    rpcStatus = UuidToStringW(&guid,
> &unbracedGuid);
> +    if (rpcStatus != RPC_S_OK)
> +    {
> +        ok(FALSE, "failed to get string form of
> guid, error %ld", rpcStatus);
> +        return;
> +    }
> +
> +    bracedGuid = HeapAlloc(GetProcessHeap(), 0,
> +        (lstrlenW(unbracedGuid) + 3) *
> sizeof(WCHAR));
> +    if (bracedGuid != NULL)
> +    {
> +        HKEY classesKey;
> +
> +        bracedGuid[0] = (WCHAR) '{';
> +        memcpy(&bracedGuid[1], unbracedGuid,
> +            lstrlenW(unbracedGuid) *
> sizeof(WCHAR));
> +        bracedGuid[1 + lstrlenW(unbracedGuid)] =
> (WCHAR) '}';
> +        bracedGuid[1 + lstrlenW(unbracedGuid) + 1]
> = (WCHAR) 0;
> +
> +        SetLastError(0xdeadbeef);
> +        classesKey =
> SetupDiOpenClassRegKeyExW(NULL, KEY_ALL_ACCESS,
> +            DIOCR_INSTALLER, NULL, NULL);
> +        ok(classesKey != INVALID_HANDLE_VALUE,
> +            "failed to open the device classes
> registry key: error %ld\n",
> +            GetLastError());
> +        if (classesKey != INVALID_HANDLE_VALUE)
> +        {
> +            DWORD ret;
> +            HKEY classKey;
> +            ret = RegCreateKeyW(classesKey,
> bracedGuid, &classKey);
> +            if (ret == ERROR_SUCCESS)
> +            {
> +                RegCloseKey(classKey);
> +                SetLastError(0xdeadbeef);
> +                classKey =
> SetupDiOpenClassRegKeyExW(&guid, KEY_ALL_ACCESS,
> +                     DIOCR_INSTALLER, NULL, NULL);
> +                /* wine does incorrectly return
> FALSE, so ... */
> +                ok(classKey != FALSE && classKey !=
> INVALID_HANDLE_VALUE,
> +                    "failed opening class key,
> error %ld\n", GetLastError());
> +                RegCloseKey(classKey);
> +                RegDeleteKeyW(classesKey,
> bracedGuid);
> +            }
> +            else
> +                ok(FALSE, "failed creating device
> key: error %ld\n", ret);
> +            RegCloseKey(classesKey);
> +        }
> +
> +        HeapFree(GetProcessHeap(), 0, bracedGuid);
> +    }
> +    else
> +        ok(FALSE, "failed to allocate memory for
> braced guid\n");
> +
> +    RpcStringFreeW(&unbracedGuid);
> +}
> +
>  START_TEST(devinst)
>  {
>      test_SetupDiCreateDeviceInfoListEx();
> +    test_SetupDiOpenClassRegKeyExW();
>  }
> --- a/dlls/setupapi/devinst.c	2006-08-03
> 10:07:11.000000000 +0200
> +++ b/dlls/setupapi/devinst.c	2006-08-04
> 18:10:06.000000000 +0200
> @@ -1393,6 +1393,7 @@
>          PVOID Reserved)
>  {
>      LPWSTR lpGuidString;
> +    LPWSTR lpBracedGuidString;
>      HKEY hClassesKey;
>      HKEY hClassKey;
>      LPCWSTR lpKeyName;
> @@ -1433,21 +1434,37 @@
>      if (UuidToStringW((UUID*)ClassGuid,
> &lpGuidString) != RPC_S_OK)
>      {
>  	RegCloseKey(hClassesKey);
> -	return FALSE;
> +	return INVALID_HANDLE_VALUE;
> +    }
> +
> +    lpBracedGuidString =
> HeapAlloc(GetProcessHeap(), 0,
> +        (strlenW(lpGuidString) + 3) *
> sizeof(WCHAR));
> +    if (lpBracedGuidString == NULL)
> +    {
> +        RpcStringFreeW(&lpGuidString);
> +        RegCloseKey(hClassesKey);
> +        return INVALID_HANDLE_VALUE;
>      }
> +    lpBracedGuidString[0] = (WCHAR) '{';
> +    memcpy(&lpBracedGuidString[1], lpGuidString,
> +        strlenW(lpGuidString) * sizeof(WCHAR));
> +    lpBracedGuidString[1 + strlenW(lpGuidString)] =
> (WCHAR) '}';
> +    lpBracedGuidString[1 + strlenW(lpGuidString) +
> 1] = (WCHAR) 0;
> +
> +    RpcStringFreeW(&lpGuidString);
>  
>      if (RegOpenKeyExW(hClassesKey,
> -		      lpGuidString,
> +		      lpBracedGuidString,
>  		      0,
>  		      KEY_ALL_ACCESS,
>  		      &hClassKey))
>      {
> -	RpcStringFreeW(&lpGuidString);
> +	HeapFree(GetProcessHeap(), 0, lpBracedGuidString);
>  	RegCloseKey(hClassesKey);
> -	return FALSE;
> +	return INVALID_HANDLE_VALUE;
>      }
>  
> -    RpcStringFreeW(&lpGuidString);
> +    HeapFree(GetProcessHeap(), 0,
> lpBracedGuidString);
>      RegCloseKey(hClassesKey);
>  
>      return hClassKey;
> > 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
--- a/dlls/setupapi/tests/Makefile.in	2006-07-10 18:01:08.000000000 +0200
+++ b/dlls/setupapi/tests/Makefile.in	2006-08-04 16:15:05.000000000 +0200
@@ -3,7 +3,7 @@
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 TESTDLL   = setupapi.dll
-IMPORTS   = setupapi kernel32
+IMPORTS   = setupapi kernel32 advapi32 rpcrt4
 
 CTESTS = \
 	devinst.c \
--- a/dlls/setupapi/tests/devinst.c	2006-08-03 10:07:11.000000000 +0200
+++ b/dlls/setupapi/tests/devinst.c	2006-08-04 17:57:57.000000000 +0200
@@ -27,6 +27,7 @@
 #include "winuser.h"
 #include "winreg.h"
 #include "setupapi.h"
+#include "rpc.h"
 
 #include "wine/test.h"
 
@@ -63,7 +64,85 @@
     ok(ret, "SetupDiDestroyDeviceInfoList failed : %ld\n", error);
 }
 
+static void test_SetupDiOpenClassRegKeyExW()
+{
+    GUID guid;
+    RPC_STATUS rpcStatus;
+    HKEY hkey;
+    WCHAR *unbracedGuid;
+    WCHAR *bracedGuid;
+
+    rpcStatus = UuidCreate(&guid);
+    if (rpcStatus != RPC_S_OK)
+    {
+        ok(FALSE, "failed to generate test guid, error %ld", rpcStatus);
+        return;
+    }
+
+    /* Check return value for non-existant key */
+    hkey = SetupDiOpenClassRegKeyExW(&guid, KEY_ALL_ACCESS, 
+        DIOCR_INSTALLER, NULL, NULL);
+    ok(hkey == INVALID_HANDLE_VALUE,
+        "invalid return value %p from SetupDiOpenClassRegKeyExW "
+        "for non-existant key, expected %p\n", hkey, INVALID_HANDLE_VALUE);
+
+    rpcStatus = UuidToStringW(&guid, &unbracedGuid);
+    if (rpcStatus != RPC_S_OK)
+    {
+        ok(FALSE, "failed to get string form of guid, error %ld", rpcStatus);
+        return;
+    }
+
+    bracedGuid = HeapAlloc(GetProcessHeap(), 0,
+        (lstrlenW(unbracedGuid) + 3) * sizeof(WCHAR));
+    if (bracedGuid != NULL)
+    {
+        HKEY classesKey;
+
+        bracedGuid[0] = (WCHAR) '{';
+        memcpy(&bracedGuid[1], unbracedGuid,
+            lstrlenW(unbracedGuid) * sizeof(WCHAR));
+        bracedGuid[1 + lstrlenW(unbracedGuid)] = (WCHAR) '}';
+        bracedGuid[1 + lstrlenW(unbracedGuid) + 1] = (WCHAR) 0;
+
+        SetLastError(0xdeadbeef);
+        classesKey = SetupDiOpenClassRegKeyExW(NULL, KEY_ALL_ACCESS,
+            DIOCR_INSTALLER, NULL, NULL);
+        ok(classesKey != INVALID_HANDLE_VALUE,
+            "failed to open the device classes registry key: error %ld\n",
+            GetLastError());
+        if (classesKey != INVALID_HANDLE_VALUE)
+        {
+            DWORD ret;
+            HKEY classKey;
+            ret = RegCreateKeyW(classesKey, bracedGuid, &classKey);
+            if (ret == ERROR_SUCCESS)
+            {
+                RegCloseKey(classKey);
+                SetLastError(0xdeadbeef);
+                classKey = SetupDiOpenClassRegKeyExW(&guid, KEY_ALL_ACCESS,
+                     DIOCR_INSTALLER, NULL, NULL);
+                /* wine does incorrectly return FALSE, so ... */
+                ok(classKey != FALSE && classKey != INVALID_HANDLE_VALUE,
+                    "failed opening class key, error %ld\n", GetLastError());
+                RegCloseKey(classKey);
+                RegDeleteKeyW(classesKey, bracedGuid);
+            }
+            else
+                ok(FALSE, "failed creating device key: error %ld\n", ret);
+            RegCloseKey(classesKey);
+        }
+
+        HeapFree(GetProcessHeap(), 0, bracedGuid);
+    }
+    else
+        ok(FALSE, "failed to allocate memory for braced guid\n");
+
+    RpcStringFreeW(&unbracedGuid);
+}
+
 START_TEST(devinst)
 {
     test_SetupDiCreateDeviceInfoListEx();
+    test_SetupDiOpenClassRegKeyExW();
 }
--- a/dlls/setupapi/devinst.c	2006-08-03 10:07:11.000000000 +0200
+++ b/dlls/setupapi/devinst.c	2006-08-04 18:10:06.000000000 +0200
@@ -1393,6 +1393,7 @@
         PVOID Reserved)
 {
     LPWSTR lpGuidString;
+    LPWSTR lpBracedGuidString;
     HKEY hClassesKey;
     HKEY hClassKey;
     LPCWSTR lpKeyName;
@@ -1433,21 +1434,37 @@
     if (UuidToStringW((UUID*)ClassGuid, &lpGuidString) != RPC_S_OK)
     {
 	RegCloseKey(hClassesKey);
-	return FALSE;
+	return INVALID_HANDLE_VALUE;
+    }
+
+    lpBracedGuidString = HeapAlloc(GetProcessHeap(), 0,
+        (strlenW(lpGuidString) + 3) * sizeof(WCHAR));
+    if (lpBracedGuidString == NULL)
+    {
+        RpcStringFreeW(&lpGuidString);
+        RegCloseKey(hClassesKey);
+        return INVALID_HANDLE_VALUE;
     }
+    lpBracedGuidString[0] = (WCHAR) '{';
+    memcpy(&lpBracedGuidString[1], lpGuidString,
+        strlenW(lpGuidString) * sizeof(WCHAR));
+    lpBracedGuidString[1 + strlenW(lpGuidString)] = (WCHAR) '}';
+    lpBracedGuidString[1 + strlenW(lpGuidString) + 1] = (WCHAR) 0;
+
+    RpcStringFreeW(&lpGuidString);
 
     if (RegOpenKeyExW(hClassesKey,
-		      lpGuidString,
+		      lpBracedGuidString,
 		      0,
 		      KEY_ALL_ACCESS,
 		      &hClassKey))
     {
-	RpcStringFreeW(&lpGuidString);
+	HeapFree(GetProcessHeap(), 0, lpBracedGuidString);
 	RegCloseKey(hClassesKey);
-	return FALSE;
+	return INVALID_HANDLE_VALUE;
     }
 
-    RpcStringFreeW(&lpGuidString);
+    HeapFree(GetProcessHeap(), 0, lpBracedGuidString);
     RegCloseKey(hClassesKey);
 
     return hClassKey;
-------------- next part --------------



More information about the wine-devel mailing list