[v2 PATCH] user32: Fix returned class name for other process windows.
Nikolay Sivov
nsivov at codeweavers.com
Wed Jun 13 05:47:41 CDT 2018
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
Fixes https://bugs.winehq.org/show_bug.cgi?id=45156
v2: using existing request
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 2b2d07f888..07d36f05d7 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 e4c2d92376..511ad5c628 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 d5f6712006..6a7de7843e 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 c533f1b8eb..5d89c2b3ba 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 8b823ba844..10fd850ec1 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 c6020433f1..e6ed964e16 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 )
--
2.17.1
More information about the wine-devel
mailing list