[PATCH 0/2] MR10028: server: Only try to grab atom for string window properties.
From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/win32u/tests/win32u.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index 3dfc1ae2cb0..4cc77a84a72 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -338,14 +338,18 @@ static void test_class(void) "NtUserGetClassName returned %lx %lu\n", ret, GetLastError() ); SetPropW( hwnd, L"WineTestProp", (void *)0xdeadbeef ); + prop = GetPropW( hwnd, L"WineTestProp" ); + ok( prop == (void *)0xdeadbeef, "GetPropW returned %p\n", prop ); status = NtFindAtom( L"WineTestProp", sizeof(L"WineTestProp") - sizeof(WCHAR), &global ); ok( !status, "NtFindAtom returned %#lx\n", status ); for (ATOM atom = 0xc000; atom != 0; atom++) { + name.MaximumLength = sizeof(buf); memset( name.Buffer, 0xcc, name.MaximumLength ); ret = NtUserGetAtomName( atom, &name ); + ok( ret == 0 || ret == wcslen( buf ), "NtUserGetAtomName %#x returned %lu\n", atom, ret ); ok( wcscmp( buf, L"WineTestProp" ), "buf = %s\n", debugstr_w(buf) ); } @@ -358,6 +362,9 @@ static void test_class(void) status = NtDeleteAtom( global ); ok( !status, "NtDeleteAtom returned %#lx\n", status ); + status = NtFindAtom( L"WineTestProp", sizeof(L"WineTestProp") - sizeof(WCHAR), &global ); + ok( !status, "NtFindAtom returned %#lx\n", status ); + cls.lpszClassName = L"WineTestProp"; class = RegisterClassW( &cls ); ok( class != 0, "RegisterClassW returned %#x\n", class ); @@ -367,8 +374,34 @@ static void test_class(void) ok( ret, "UnregisterClassW failed: %lu\n", GetLastError() ); cls.lpszClassName = L"test"; + status = NtFindAtom( L"WineTestProp", sizeof(L"WineTestProp") - sizeof(WCHAR), &global ); + ok( !status, "NtFindAtom returned %#lx\n", status ); + RemovePropW( hwnd, L"WineTestProp" ); + status = NtFindAtom( L"WineTestProp", sizeof(L"WineTestProp") - sizeof(WCHAR), &global ); + ok( status == STATUS_OBJECT_NAME_NOT_FOUND, "NtFindAtom returned %#lx\n", status ); + + status = NtQueryInformationAtom( global, AtomBasicInformation, abi, sizeof(abi_buf), NULL ); + todo_wine ok( status == STATUS_INVALID_HANDLE, "NtQueryInformationAtom returned %#lx\n", status ); + + prop = NtUserGetProp( hwnd, MAKEINTRESOURCEW(global) ); + ok( prop == NULL, "NtUserGetProp returned %p\n", prop ); + ret = NtUserSetProp( hwnd, MAKEINTRESOURCEW(global), (void *)0xdeadbeef ); + ok( ret, "NtUserSetProp returned %lu\n", ret ); + prop = NtUserGetProp( hwnd, MAKEINTRESOURCEW(global) ); + todo_wine ok( prop == (void *)0xdeadbeef, "NtUserGetProp returned %p\n", prop ); + + status = NtQueryInformationAtom( global, AtomBasicInformation, abi, sizeof(abi_buf), NULL ); + todo_wine ok( status == STATUS_INVALID_HANDLE, "NtQueryInformationAtom returned %#lx\n", status ); + + ret = SetPropW( hwnd, MAKEINTRESOURCEW(0xc000), (void *)0xdeadbeef ); + todo_wine ok( ret, "SetPropW returned %lu\n", ret ); + prop = GetPropW( hwnd, MAKEINTRESOURCEW(0xc000) ); + todo_wine ok( prop == (void *)0xdeadbeef, "GetPropW returned %p\n", prop ); + prop = GetPropW( hwnd, MAKEINTRESOURCEW(0xc001) ); + ok( !prop, "GetPropW returned %p\n", prop ); + DestroyWindow( hwnd ); ret = UnregisterClassW( L"test", GetModuleHandleW(NULL) ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10028
From: Rémi Bernon <rbernon@codeweavers.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59350 --- dlls/win32u/tests/win32u.c | 4 ++-- server/window.c | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index 4cc77a84a72..ed4b47925e4 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -396,9 +396,9 @@ static void test_class(void) todo_wine ok( status == STATUS_INVALID_HANDLE, "NtQueryInformationAtom returned %#lx\n", status ); ret = SetPropW( hwnd, MAKEINTRESOURCEW(0xc000), (void *)0xdeadbeef ); - todo_wine ok( ret, "SetPropW returned %lu\n", ret ); + ok( ret, "SetPropW returned %lu\n", ret ); prop = GetPropW( hwnd, MAKEINTRESOURCEW(0xc000) ); - todo_wine ok( prop == (void *)0xdeadbeef, "GetPropW returned %p\n", prop ); + ok( prop == (void *)0xdeadbeef, "GetPropW returned %p\n", prop ); prop = GetPropW( hwnd, MAKEINTRESOURCEW(0xc001) ); ok( !prop, "GetPropW returned %p\n", prop ); diff --git a/server/window.c b/server/window.c index d58f643fde9..2861b41e06b 100644 --- a/server/window.c +++ b/server/window.c @@ -493,7 +493,7 @@ static void set_property( struct window *win, atom_t atom, lparam_t data, enum p } /* need to add an entry */ - if (!grab_atom( table, atom )) return; + if (type == PROP_TYPE_STRING && !grab_atom( table, atom )) return; if (free == -1) { /* no free entry */ @@ -504,7 +504,7 @@ static void set_property( struct window *win, atom_t atom, lparam_t data, enum p sizeof(*new_props) * (win->prop_alloc + 16) ))) { set_error( STATUS_NO_MEMORY ); - release_atom( table, atom ); + if (type == PROP_TYPE_STRING) release_atom( table, atom ); return; } win->prop_alloc += 16; @@ -525,12 +525,13 @@ static lparam_t remove_property( struct window *win, atom_t atom ) for (i = 0; i < win->prop_inuse; i++) { - if (win->properties[i].type == PROP_TYPE_FREE) continue; - if (win->properties[i].atom == atom) + struct property *prop = win->properties + i; + if (prop->type == PROP_TYPE_FREE) continue; + if (prop->atom == atom) { - release_atom( table, atom ); - win->properties[i].type = PROP_TYPE_FREE; - return win->properties[i].data; + if (prop->type == PROP_TYPE_STRING) release_atom( table, atom ); + prop->type = PROP_TYPE_FREE; + return prop->data; } } /* FIXME: last error? */ @@ -560,8 +561,9 @@ static inline void destroy_properties( struct window *win ) if (!win->properties) return; for (i = 0; i < win->prop_inuse; i++) { - if (win->properties[i].type == PROP_TYPE_FREE) continue; - release_atom( table, win->properties[i].atom ); + struct property *prop = win->properties + i; + if (prop->type == PROP_TYPE_FREE) continue; + if (prop->type == PROP_TYPE_STRING) release_atom( table, prop->atom ); } free( win->properties ); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10028
participants (2)
-
Rémi Bernon -
Rémi Bernon (@rbernon)