Module: wine Branch: master Commit: f69bb9d6c5e731d69b61bb715f3de5c3cd47f68c URL: https://gitlab.winehq.org/wine/wine/-/commit/f69bb9d6c5e731d69b61bb715f3de5c...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Sep 1 17:24:06 2023 +0200
scrrun: Fix pointer hashing on 64-bit.
---
dlls/scrrun/dictionary.c | 6 +++++- dlls/scrrun/tests/dictionary.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/scrrun/dictionary.c b/dlls/scrrun/dictionary.c index d69b513efc2..364d8b52ff6 100644 --- a/dlls/scrrun/dictionary.c +++ b/dlls/scrrun/dictionary.c @@ -846,7 +846,11 @@ static HRESULT get_flt_hash(FLOAT flt, LONG *hash)
static DWORD get_ptr_hash(void *ptr) { - return PtrToUlong(ptr) % DICT_HASH_MOD; + DWORD hash = PtrToUlong(ptr); +#ifdef _WIN64 + hash ^= (ULONG_PTR)ptr >> 32; +#endif + return hash % 1201; }
static HRESULT WINAPI dictionary_get_HashVal(IDictionary *iface, VARIANT *key, VARIANT *hash) diff --git a/dlls/scrrun/tests/dictionary.c b/dlls/scrrun/tests/dictionary.c index 3232ef7321a..a6369b77831 100644 --- a/dlls/scrrun/tests/dictionary.c +++ b/dlls/scrrun/tests/dictionary.c @@ -193,7 +193,11 @@ static DWORD get_num_hash(FLOAT num)
static DWORD get_ptr_hash(void *ptr) { - return PtrToUlong(ptr) % 1201; + DWORD hash = PtrToUlong(ptr); +#ifdef _WIN64 + hash ^= (ULONG_PTR)ptr >> 32; +#endif + return hash % 1201; }
typedef union