Re: advapi32: RegGetValue fails with some correct combinations of dwFlags

2008-07-19 Thread Mathias Kosch
Dan Kegel wrote:
 You forgot to mention which versions of Windows you
 ran the test case on (and whether it passed there).
Thank you for telling me. (I'm not yet very familar with the process
of publishing patches.)

It took me some time, for I first had to install Windows Server
2003.
Testing was a good idea because I found out that my bugfix was a
little too lax. Windows only allows RRF_RT_ANY without
RRF_NOEXPAND, but not a combination of (RRF_RT_REG_EXPAND_SZ |
RRF_RT_REG_SZ). This is still a little curious because I thought
dwFlags would act like a mask.
Nevertheless Bug#14509 (and Bug#14350) are still fixed.

I successfully tested the test case under Windows Server 2003 and
Wine 1.1.1 with this patch applied.

You can find the updates to this patch and test case as attachments.
-- 
Mathias Kosch [EMAIL PROTECTED] | http://www.mkosch.de/
RSA Public Key: http://www.mkosch.de/pubkey

Mehr Schutz der Privatsphäre: http://www.gnupg.org/--- old/registry.c  2008-07-11 17:55:55.0 +0200
+++ registry.c  2008-07-18 01:39:21.0 +0200
@@ -1466,6 +1466,8 @@
  *expanded and pdwType is set to REG_SZ instead.
  *  - Restrictions are applied after expanding, using RRF_RT_REG_EXPAND_SZ 
  *without RRF_NOEXPAND is thus not allowed.
+ *An exception is the case where RRF_RT_ANY is specified, because then
+ *RRF_NOEXPAND is allowed.
  */
 LSTATUS WINAPI RegGetValueW( HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue,
   DWORD dwFlags, LPDWORD pdwType, PVOID pvData,
@@ -1481,7 +1483,8 @@
 
 if (pvData  !pcbData)
 return ERROR_INVALID_PARAMETER;
-if ((dwFlags  RRF_RT_REG_EXPAND_SZ)  !(dwFlags  RRF_NOEXPAND))
+if ((dwFlags  RRF_RT_REG_EXPAND_SZ)  !(dwFlags  RRF_NOEXPAND) 
+((dwFlags  RRF_RT_ANY) != RRF_RT_ANY))
 return ERROR_INVALID_PARAMETER;
 
 if (pszSubKey  pszSubKey[0])
@@ -1576,7 +1579,8 @@
 
 if (pvData  !pcbData)
 return ERROR_INVALID_PARAMETER;
-if ((dwFlags  RRF_RT_REG_EXPAND_SZ)  !(dwFlags  RRF_NOEXPAND))
+if ((dwFlags  RRF_RT_REG_EXPAND_SZ)  !(dwFlags  RRF_NOEXPAND) 
+((dwFlags  RRF_RT_ANY) != RRF_RT_ANY))
 return ERROR_INVALID_PARAMETER;
 
 if (pszSubKey  pszSubKey[0])

--- tests/old/registry.c2008-07-11 17:55:54.0 +0200
+++ tests/registry.c2008-07-18 01:39:14.0 +0200
@@ -858,6 +858,16 @@
 /* Query REG_EXPAND_SZ using RRF_RT_REG_EXPAND_SZ (not allowed without 
RRF_NOEXPAND) */
 ret = pRegGetValueA(hkey_main, NULL, TP1_EXP_SZ, RRF_RT_REG_EXPAND_SZ, 
NULL, NULL, NULL);
 ok(ret == ERROR_INVALID_PARAMETER, ret=%d\n, ret);
+
+/* Query REG_EXPAND_SZ using RRF_RT_ANY */
+buf[0] = 0; type = 0xdeadbeef; size = sizeof(buf);
+ret = pRegGetValueA(hkey_main, NULL, TP1_EXP_SZ, RRF_RT_ANY, type, buf, 
size);
+ok(ret == ERROR_SUCCESS, ret=%d\n, ret);
+/* At least v5.2.3790.1830 (2003 SP1) returns the unexpanded sTestpath1 
length + 1 here. */
+ok(size == strlen(expanded)+1 || broken(size == strlen(sTestpath1)+1),
+strlen(expanded)=%d, strlen(sTestpath1)=%d, size=%d\n, 
lstrlenA(expanded), lstrlenA(sTestpath1), size);
+ok(type == REG_SZ, type=%d\n, type);
+ok(!strcmp(expanded, buf), expanded=\%s\ buf=\%s\\n, expanded, buf);
 } 
 
 static void test_reg_open_key(void)




Re: advapi32: RegGetValue fails with some correct combinations of dwFlags

2008-07-18 Thread Alexandre Julliard
Mathias Kosch [EMAIL PROTECTED] writes:

 --- old/registry.c2008-07-11 17:55:55.0 +0200
 +++ registry.c2008-07-18 01:39:21.0 +0200
 @@ -1466,6 +1466,8 @@

Patches should be generated from the top-level directory.

-- 
Alexandre Julliard
[EMAIL PROTECTED]




re: advapi32: RegGetValue fails with some correct combinations of dwFlags

2008-07-17 Thread Dan Kegel
Mathias Kosch wrote:
 ...
 The patch and test case were created against wine-1.1.1 and are both
 attached to this mail.

 I hope this time I provided enough information

You forgot to mention which versions of Windows you
ran the test case on (and whether it passed there).
- Dan