From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/win32u/ntuser_private.h | 1 - dlls/win32u/window.c | 9 ++------- server/protocol.def | 1 + server/window.c | 18 ++++++++---------- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 426d074f935..8cf372340f3 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -48,7 +48,6 @@ typedef struct tagWND struct tagCLASS *class; /* Window class */ struct dce *dce; /* DCE pointer */ WNDPROC winproc; /* Window procedure */ - HINSTANCE hInstance; /* Window hInstance (from CreateWindow) */ struct window_rects rects; /* window rects in window DPI, relative to the parent client area */ RECT normal_rect; /* Normal window rect saved when maximized/minimized */ RECT present_rect; /* present rect for exclusive fullscreen mode */ diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 56e7093a93a..a236bfb309d 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1126,6 +1126,7 @@ static LONG_PTR get_window_long_shm( HWND hwnd, UINT offset, UINT size, BOOL int switch (offset) { case GWLP_ID: ret = window_shm->info.id; break; + case GWLP_HINSTANCE: ret = window_shm->info.instance; break; default: valid = size <= window_shm->extra_size && offset <= window_shm->extra_size - size && (internal || offset >= window_shm->private_size); @@ -1180,6 +1181,7 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans if (offset < 0) break; /* fallthrough */ case GWLP_ID: + case GWLP_HINSTANCE: return get_window_long_shm( hwnd, offset, size, internal ); case GWLP_HWNDPARENT: { @@ -1207,7 +1209,6 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans return retval; case GWL_EXSTYLE: case GWLP_USERDATA: - case GWLP_HINSTANCE: return 0; case GWLP_WNDPROC: RtlSetLastWin32Error( ERROR_ACCESS_DENIED ); @@ -1242,7 +1243,6 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans case GWLP_USERDATA: retval = win->userdata; break; case GWL_STYLE: retval = win->dwStyle; break; case GWL_EXSTYLE: retval = win->dwExStyle; break; - case GWLP_HINSTANCE: retval = (ULONG_PTR)win->hInstance; break; case GWLP_WNDPROC: /* This looks like a hack only for the edit control (see tests). This makes these controls * more tolerant to A/W mismatches. The lack of W->A->W conversion for such a mismatch suggests @@ -1513,10 +1513,6 @@ static LONG_PTR set_window_long_internal( HWND hwnd, INT offset, UINT size, win->dwExStyle = newval; retval = oldval; break; - case GWLP_HINSTANCE: - win->hInstance = (HINSTANCE)newval; - retval = oldval; - break; case GWLP_WNDPROC: break; case GWLP_USERDATA: @@ -5574,7 +5570,6 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name, win->owner = full_owner; win->class = class; win->winproc = get_class_winproc( class ); - win->hInstance = instance; set_user_handle_ptr( handle, win ); if (is_winproc_unicode( win->winproc, !ansi )) win->flags |= WIN_ISUNICODE; return win; diff --git a/server/protocol.def b/server/protocol.def index 973f091ecab..2f11acd4385 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1066,6 +1066,7 @@ typedef volatile struct struct window_info { lparam_t id; /* window id */ + mod_handle_t instance; /* creator instance */ }; typedef volatile struct diff --git a/server/window.c b/server/window.c index 1302291be64..8af6625af47 100644 --- a/server/window.c +++ b/server/window.c @@ -74,7 +74,6 @@ struct window struct region *update_region; /* update region (relative to window rect) */ unsigned int style; /* window style */ unsigned int ex_style; /* window extended style */ - mod_handle_t instance; /* creator instance */ unsigned int is_unicode : 1; /* ANSI or unicode */ unsigned int is_linked : 1; /* is it linked into the parent z-order list? */ unsigned int is_layered : 1; /* has layered info been set? */ @@ -607,7 +606,7 @@ void post_desktop_message( struct desktop *desktop, unsigned int message, /* create a new window structure (note: the window is not linked in the window tree) */ static struct window *create_window( struct window *parent, struct window *owner, atom_t atom, - mod_handle_t class_instance, mod_handle_t instance ) + mod_handle_t class_instance ) { data_size_t extra_size, private_size; struct window *win = NULL; @@ -657,7 +656,6 @@ static struct window *create_window( struct window *parent, struct window *owner win->update_region = NULL; win->style = 0; win->ex_style = 0; - win->instance = instance; win->is_unicode = 1; win->is_linked = 0; win->is_layered = 0; @@ -2239,7 +2237,7 @@ DECL_HANDLER(create_window) if (!atom) atom = find_atom( table, &cls_name ); - if (!(win = create_window( parent, owner, atom, req->class_instance, req->instance ))) return; + if (!(win = create_window( parent, owner, atom, req->class_instance ))) return; if (parent && !is_desktop_window( parent )) dpi_context = parent->shared->dpi_context; @@ -2250,7 +2248,8 @@ DECL_HANDLER(create_window) SHARED_WRITE_BEGIN( win->shared, window_shm_t ) { - shared->dpi_context = dpi_context; + shared->dpi_context = dpi_context; + shared->info.instance = req->instance; } SHARED_WRITE_END; @@ -2336,7 +2335,7 @@ DECL_HANDLER(get_desktop_window) if (!desktop->top_window && req->force) /* create it */ { - if ((desktop->top_window = create_window( NULL, NULL, DESKTOP_ATOM, 0, 0 ))) + if ((desktop->top_window = create_window( NULL, NULL, DESKTOP_ATOM, 0 ))) { detach_window_thread( desktop->top_window ); desktop->top_window->style = WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; @@ -2349,7 +2348,7 @@ DECL_HANDLER(get_desktop_window) static const struct unicode_str name = { messageW, sizeof(messageW) }; struct atom_table *table = get_user_atom_table(); atom_t atom = add_atom( table, &name ); - if (atom && (desktop->msg_window = create_window( NULL, NULL, atom, 0, 0 ))) + if (atom && (desktop->msg_window = create_window( NULL, NULL, atom, 0 ))) { detach_window_thread( desktop->msg_window ); desktop->msg_window->style = WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; @@ -2406,7 +2405,6 @@ DECL_HANDLER(get_window_info) { case GWL_STYLE: reply->info = win->style; break; case GWL_EXSTYLE: reply->info = win->ex_style; break; - case GWLP_HINSTANCE: reply->info = win->instance; break; case GWLP_WNDPROC: reply->info = win->is_unicode; break; case GWLP_USERDATA: reply->info = win->user_data; break; default: @@ -2463,8 +2461,8 @@ DECL_HANDLER(set_window_info) shared->info.id = req->new_info; break; case GWLP_HINSTANCE: - reply->old_info = win->instance; - win->instance = req->new_info; + reply->old_info = shared->info.instance; + shared->info.instance = req->new_info; break; case GWLP_WNDPROC: reply->old_info = win->is_unicode; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11106