[PATCH] advapi32: Use the lower 32bit of the special HKEYs on 64bit.
Alexandre Julliard
julliard at winehq.org
Wed Jan 23 05:52:03 CST 2013
Rico Schüller <kgbricola at web.de> writes:
> @@ -228,9 +228,9 @@ static NTSTATUS open_key( HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES *a
> static HKEY create_special_root_hkey( HKEY hkey, DWORD access )
> {
> HKEY ret = 0;
> - int idx = (UINT_PTR)hkey - (UINT_PTR)HKEY_SPECIAL_ROOT_FIRST;
> + int idx = (DWORD)hkey - (DWORD)HKEY_SPECIAL_ROOT_FIRST;
>
> - if (hkey == HKEY_CURRENT_USER)
> + if ((DWORD)hkey == (DWORD)HKEY_CURRENT_USER)
You want HandleToUlong and the like.
> @@ -947,6 +948,57 @@ static void test_reg_open_key(void)
> "RegOpenKeyEx with KEY_WOW64_64KEY failed (err=%u)\n", ret);
> RegCloseKey(hkResult);
>
> + /* check special HKEYs on 64bit
> + * only the lower 4 bytes of the supplied key are used
> + */
> + if (ptr_size == 64)
> + {
> + DWORD mask = ~0U;
> + HKEY hkBig = (HKEY)((ULONG_PTR)HKEY_CURRENT_USER & mask);
> +
> + ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software", &hkResult);
> + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
> + ok(hkResult != NULL, "expected hkResult != NULL\n");
> + hkPreserve = hkResult;
> + RegCloseKey(hkResult);
> +
> + hkBig = (HKEY)(((ULONG_PTR)HKEY_CURRENT_USER & mask) | 0x100000000ULL);
> + ret = RegOpenKeyA(hkBig, "Software", &hkResult);
> + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
> + ok(hkResult == hkPreserve, "expected hkResult == hkPreserve\n");
> + RegCloseKey(hkResult);
Please don't use long long constants.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list