Module: wine Branch: master Commit: 7a45d2fa781852d5f1b8c2f8433dd9054ec1797f URL: https://source.winehq.org/git/wine.git/?a=commit;h=7a45d2fa781852d5f1b8c2f84...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Wed Jun 13 13:47:41 2018 +0300
user32: Fix returned class name for other process windows.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/user32/class.c | 14 +++++++++++++- include/wine/server_protocol.h | 8 +++++--- server/class.c | 1 + server/protocol.def | 5 +++-- server/request.h | 13 +++++++------ server/trace.c | 5 +++-- 6 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/dlls/user32/class.c b/dlls/user32/class.c index 2b2d07f..07d36f0 100644 --- a/dlls/user32/class.c +++ b/dlls/user32/class.c @@ -1194,8 +1194,20 @@ INT WINAPI GetClassNameW( HWND hwnd, LPWSTR buffer, INT count ) if (class == CLASS_OTHER_PROCESS) { WCHAR tmpbuf[MAX_ATOM_LEN + 1]; + ATOM atom = 0;
- ret = GlobalGetAtomNameW( GetClassLongW( hwnd, GCW_ATOM ), tmpbuf, MAX_ATOM_LEN + 1 ); + SERVER_START_REQ( set_class_info ) + { + req->window = wine_server_user_handle( hwnd ); + req->flags = 0; + req->extra_offset = -1; + req->extra_size = 0; + if (!wine_server_call_err( req )) + atom = reply->base_atom; + } + SERVER_END_REQ; + + ret = GlobalGetAtomNameW( atom, tmpbuf, MAX_ATOM_LEN + 1 ); if (ret) { ret = min(count - 1, ret); diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index e4c2d92..511ad5c 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -4525,11 +4525,13 @@ struct set_class_info_reply { struct reply_header __header; atom_t old_atom; + atom_t base_atom; + mod_handle_t old_instance; + lparam_t old_extra_value; unsigned int old_style; int old_extra; int old_win_extra; - mod_handle_t old_instance; - lparam_t old_extra_value; + char __pad_44[4]; }; #define SET_CLASS_ATOM 0x0001 #define SET_CLASS_STYLE 0x0002 @@ -6512,6 +6514,6 @@ union generic_reply struct terminate_job_reply terminate_job_reply; };
-#define SERVER_PROTOCOL_VERSION 554 +#define SERVER_PROTOCOL_VERSION 555
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/class.c b/server/class.c index d5f6712..6a7de78 100644 --- a/server/class.c +++ b/server/class.c @@ -276,6 +276,7 @@ DECL_HANDLER(set_class_info) reply->old_extra = class->nb_extra_bytes; reply->old_win_extra = class->win_extra; reply->old_instance = class->instance; + reply->base_atom = class->base_atom;
if (req->flags & SET_CLASS_ATOM) { diff --git a/server/protocol.def b/server/protocol.def index c533f1b..5d89c2b 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3179,11 +3179,12 @@ enum caret_state lparam_t extra_value; /* value to set in extra bytes */ @REPLY atom_t old_atom; /* previous class atom */ + atom_t base_atom; /* base class atom */ + mod_handle_t old_instance; /* previous module instance */ + lparam_t old_extra_value; /* old value in extra bytes */ unsigned int old_style; /* previous class style */ int old_extra; /* previous number of class extra bytes */ int old_win_extra; /* previous number of window extra bytes */ - mod_handle_t old_instance; /* previous module instance */ - lparam_t old_extra_value; /* old value in extra bytes */ @END #define SET_CLASS_ATOM 0x0001 #define SET_CLASS_STYLE 0x0002 diff --git a/server/request.h b/server/request.h index 8b823ba..10fd850 100644 --- a/server/request.h +++ b/server/request.h @@ -2056,12 +2056,13 @@ C_ASSERT( FIELD_OFFSET(struct set_class_info_request, extra_size) == 44 ); C_ASSERT( FIELD_OFFSET(struct set_class_info_request, extra_value) == 48 ); C_ASSERT( sizeof(struct set_class_info_request) == 56 ); C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_atom) == 8 ); -C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_style) == 12 ); -C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_extra) == 16 ); -C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_win_extra) == 20 ); -C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_instance) == 24 ); -C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_extra_value) == 32 ); -C_ASSERT( sizeof(struct set_class_info_reply) == 40 ); +C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, base_atom) == 12 ); +C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_instance) == 16 ); +C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_extra_value) == 24 ); +C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_style) == 32 ); +C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_extra) == 36 ); +C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_win_extra) == 40 ); +C_ASSERT( sizeof(struct set_class_info_reply) == 48 ); C_ASSERT( FIELD_OFFSET(struct open_clipboard_request, window) == 12 ); C_ASSERT( sizeof(struct open_clipboard_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct open_clipboard_reply, owner) == 8 ); diff --git a/server/trace.c b/server/trace.c index c602043..e6ed964 100644 --- a/server/trace.c +++ b/server/trace.c @@ -3795,11 +3795,12 @@ static void dump_set_class_info_request( const struct set_class_info_request *re static void dump_set_class_info_reply( const struct set_class_info_reply *req ) { fprintf( stderr, " old_atom=%04x", req->old_atom ); + fprintf( stderr, ", base_atom=%04x", req->base_atom ); + dump_uint64( ", old_instance=", &req->old_instance ); + dump_uint64( ", old_extra_value=", &req->old_extra_value ); fprintf( stderr, ", old_style=%08x", req->old_style ); fprintf( stderr, ", old_extra=%d", req->old_extra ); fprintf( stderr, ", old_win_extra=%d", req->old_win_extra ); - dump_uint64( ", old_instance=", &req->old_instance ); - dump_uint64( ", old_extra_value=", &req->old_extra_value ); }
static void dump_open_clipboard_request( const struct open_clipboard_request *req )