advapi32: RegCreateKeyEx fix.
Rein Klazes
wijn at wanadoo.nl
Mon Dec 5 12:30:56 CST 2005
Hi,
Making installer of "Davi-Tuin 3D Deluxe" succeed, without complaining
about insufficient system privileges.
Changelog:
dlls/advapi32 : registry.c
dlls/advapi32/tests : registry.c
On Win9x,ME RegCreateKeyEx ignores the backslash character if the subkey
begins with one. With a regression test.
Rein.
-------------- next part --------------
--- wine/dlls/advapi32/registry.c 2005-11-30 18:20:15.000000000 +0100
+++ mywine/dlls/advapi32/registry.c 2005-12-05 18:34:14.000000000 +0100
@@ -206,7 +206,10 @@ DWORD WINAPI RegCreateKeyExA( HKEY hkey,
NTSTATUS status;
if (reserved) return ERROR_INVALID_PARAMETER;
- if (!is_version_nt()) access = KEY_ALL_ACCESS; /* Win95 ignores the access mask */
+ if (!is_version_nt()) {
+ access = KEY_ALL_ACCESS; /* Win95 ignores the access mask */
+ if( *name == '\\') name++; /* win9x,ME ignores one (and only one) beginning backslash */
+ }
else if (!(access & KEY_ACCESS_MASK) || (access & ~KEY_ACCESS_MASK)) return ERROR_ACCESS_DENIED;
if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
--- wine/dlls/advapi32/tests/registry.c 2005-11-08 08:07:44.000000000 +0100
+++ mywine/dlls/advapi32/tests/registry.c 2005-12-05 18:38:54.000000000 +0100
@@ -476,6 +476,12 @@ static void test_reg_open_key(void)
/* send in NULL hkResult */
ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", NULL);
ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", ret);
+
+ /* beginning backslash character */
+ ret = RegOpenKeyA(HKEY_CURRENT_USER, "\\Software\\Wine\\Test", &hkResult);
+ ok(ret == ERROR_BAD_PATHNAME || /* NT/2k/XP */
+ ret == ERROR_FILE_NOT_FOUND /* Win9x,ME */
+ , "expected ERROR_BAD_PATHNAME or ERROR_FILE_NOT_FOUND, got %ld\n", ret);
}
static void test_reg_create_key(void)
@@ -492,6 +498,15 @@ static void test_reg_create_key(void)
/* clean up */
RegDeleteKey(hkey2, NULL);
RegDeleteKey(hkey1, NULL);
+
+ /* beginning backslash character */
+ ret = RegCreateKeyExA(hkey_main, "\\Subkey3", 0, NULL, 0, KEY_NOTIFY, NULL, &hkey1, NULL);
+ if (!(GetVersion() & 0x80000000))
+ ok(ret == ERROR_BAD_PATHNAME, "expected ERROR_BAD_PATHNAME, got %ld\n", ret);
+ else {
+ ok(!ret, "RegCreateKeyExA failed with error %ld\n", ret);
+ RegDeleteKey(hkey1, NULL);
+ }
}
static void test_reg_close_key(void)
More information about the wine-patches
mailing list