Commit 86af38c8 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Make IsWindowUnicode work in the case when window belongs to another

process.
parent 62dbe211
...@@ -1056,10 +1056,11 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom, ...@@ -1056,10 +1056,11 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
SERVER_START_REQ( set_window_info ) SERVER_START_REQ( set_window_info )
{ {
req->handle = hwnd; req->handle = hwnd;
req->flags = SET_WIN_STYLE | SET_WIN_EXSTYLE | SET_WIN_INSTANCE; req->flags = SET_WIN_STYLE | SET_WIN_EXSTYLE | SET_WIN_INSTANCE | SET_WIN_UNICODE;
req->style = wndPtr->dwStyle; req->style = wndPtr->dwStyle;
req->ex_style = wndPtr->dwExStyle; req->ex_style = wndPtr->dwExStyle;
req->instance = (void *)wndPtr->hInstance; req->instance = (void *)wndPtr->hInstance;
req->is_unicode = (type == WIN_PROC_32W);
req->extra_offset = -1; req->extra_offset = -1;
wine_server_call( req ); wine_server_call( req );
} }
...@@ -1658,12 +1659,26 @@ BOOL WINAPI IsWindowEnabled(HWND hWnd) ...@@ -1658,12 +1659,26 @@ BOOL WINAPI IsWindowEnabled(HWND hWnd)
BOOL WINAPI IsWindowUnicode( HWND hwnd ) BOOL WINAPI IsWindowUnicode( HWND hwnd )
{ {
WND * wndPtr; WND * wndPtr;
BOOL retvalue; BOOL retvalue = FALSE;
if (!(wndPtr = WIN_GetPtr(hwnd))) return FALSE;
if (!(wndPtr = WIN_GetPtr(hwnd)) || wndPtr == WND_OTHER_PROCESS) return FALSE;
if (wndPtr == WND_DESKTOP) return TRUE; if (wndPtr == WND_DESKTOP) return TRUE;
retvalue = (WINPROC_GetProcType( wndPtr->winproc ) == WIN_PROC_32W);
WIN_ReleasePtr( wndPtr ); if (wndPtr != WND_OTHER_PROCESS)
{
retvalue = (WINPROC_GetProcType( wndPtr->winproc ) == WIN_PROC_32W);
WIN_ReleasePtr( wndPtr );
}
else
{
SERVER_START_REQ( get_window_info )
{
req->handle = hwnd;
if (!wine_server_call_err( req )) retvalue = reply->is_unicode;
}
SERVER_END_REQ;
}
return retvalue; return retvalue;
} }
...@@ -1976,10 +1991,18 @@ static LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, LONG_PTR newval, ...@@ -1976,10 +1991,18 @@ static LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, LONG_PTR newval,
return (ULONG_PTR)SetParent( hwnd, (HWND)newval ); return (ULONG_PTR)SetParent( hwnd, (HWND)newval );
} }
case GWLP_WNDPROC: case GWLP_WNDPROC:
{
WINDOWPROCTYPE old_type = WINPROC_GetProcType( wndPtr->winproc );
retval = (ULONG_PTR)WINPROC_GetProc( wndPtr->winproc, type ); retval = (ULONG_PTR)WINPROC_GetProc( wndPtr->winproc, type );
wndPtr->winproc = WINPROC_AllocProc( (WNDPROC)newval, type ); wndPtr->winproc = WINPROC_AllocProc( (WNDPROC)newval, type );
WIN_ReleasePtr( wndPtr ); if (old_type == type)
return retval; {
WIN_ReleasePtr( wndPtr );
return retval;
}
/* update is_unicode flag on the server side */
break;
}
case GWLP_ID: case GWLP_ID:
case GWLP_HINSTANCE: case GWLP_HINSTANCE:
case GWLP_USERDATA: case GWLP_USERDATA:
...@@ -2036,6 +2059,10 @@ static LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, LONG_PTR newval, ...@@ -2036,6 +2059,10 @@ static LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, LONG_PTR newval,
req->flags = SET_WIN_INSTANCE; req->flags = SET_WIN_INSTANCE;
req->instance = (void *)newval; req->instance = (void *)newval;
break; break;
case GWLP_WNDPROC:
req->flags = SET_WIN_UNICODE;
req->is_unicode = (type == WIN_PROC_32W);
break;
case GWLP_USERDATA: case GWLP_USERDATA:
req->flags = SET_WIN_USERDATA; req->flags = SET_WIN_USERDATA;
req->user_data = (void *)newval; req->user_data = (void *)newval;
...@@ -2066,6 +2093,8 @@ static LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, LONG_PTR newval, ...@@ -2066,6 +2093,8 @@ static LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, LONG_PTR newval,
wndPtr->hInstance = (HINSTANCE)newval; wndPtr->hInstance = (HINSTANCE)newval;
retval = (ULONG_PTR)reply->old_instance; retval = (ULONG_PTR)reply->old_instance;
break; break;
case GWLP_WNDPROC:
break;
case GWLP_USERDATA: case GWLP_USERDATA:
wndPtr->userdata = newval; wndPtr->userdata = newval;
retval = (ULONG_PTR)reply->old_user_data; retval = (ULONG_PTR)reply->old_user_data;
......
...@@ -2531,6 +2531,7 @@ struct get_window_info_reply ...@@ -2531,6 +2531,7 @@ struct get_window_info_reply
process_id_t pid; process_id_t pid;
thread_id_t tid; thread_id_t tid;
atom_t atom; atom_t atom;
int is_unicode;
}; };
...@@ -2544,6 +2545,7 @@ struct set_window_info_request ...@@ -2544,6 +2545,7 @@ struct set_window_info_request
unsigned int ex_style; unsigned int ex_style;
unsigned int id; unsigned int id;
void* instance; void* instance;
int is_unicode;
void* user_data; void* user_data;
int extra_offset; int extra_offset;
size_t extra_size; size_t extra_size;
...@@ -2565,6 +2567,7 @@ struct set_window_info_reply ...@@ -2565,6 +2567,7 @@ struct set_window_info_reply
#define SET_WIN_INSTANCE 0x08 #define SET_WIN_INSTANCE 0x08
#define SET_WIN_USERDATA 0x10 #define SET_WIN_USERDATA 0x10
#define SET_WIN_EXTRA 0x20 #define SET_WIN_EXTRA 0x20
#define SET_WIN_UNICODE 0x40
...@@ -4188,6 +4191,6 @@ union generic_reply ...@@ -4188,6 +4191,6 @@ union generic_reply
struct set_mailslot_info_reply set_mailslot_info_reply; struct set_mailslot_info_reply set_mailslot_info_reply;
}; };
#define SERVER_PROTOCOL_VERSION 179 #define SERVER_PROTOCOL_VERSION 180
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
...@@ -1788,6 +1788,7 @@ enum message_type ...@@ -1788,6 +1788,7 @@ enum message_type
process_id_t pid; /* process owning the window */ process_id_t pid; /* process owning the window */
thread_id_t tid; /* thread owning the window */ thread_id_t tid; /* thread owning the window */
atom_t atom; /* class atom */ atom_t atom; /* class atom */
int is_unicode; /* ANSI or unicode */
@END @END
...@@ -1799,6 +1800,7 @@ enum message_type ...@@ -1799,6 +1800,7 @@ enum message_type
unsigned int ex_style; /* window extended style */ unsigned int ex_style; /* window extended style */
unsigned int id; /* window id */ unsigned int id; /* window id */
void* instance; /* creator instance */ void* instance; /* creator instance */
int is_unicode; /* ANSI or unicode */
void* user_data; /* user-specific data */ void* user_data; /* user-specific data */
int extra_offset; /* offset to set in extra bytes */ int extra_offset; /* offset to set in extra bytes */
size_t extra_size; /* size to set in extra bytes */ size_t extra_size; /* size to set in extra bytes */
...@@ -1817,6 +1819,7 @@ enum message_type ...@@ -1817,6 +1819,7 @@ enum message_type
#define SET_WIN_INSTANCE 0x08 #define SET_WIN_INSTANCE 0x08
#define SET_WIN_USERDATA 0x10 #define SET_WIN_USERDATA 0x10
#define SET_WIN_EXTRA 0x20 #define SET_WIN_EXTRA 0x20
#define SET_WIN_UNICODE 0x40
/* Set the parent of a window */ /* Set the parent of a window */
......
...@@ -2249,7 +2249,8 @@ static void dump_get_window_info_reply( const struct get_window_info_reply *req ...@@ -2249,7 +2249,8 @@ static void dump_get_window_info_reply( const struct get_window_info_reply *req
fprintf( stderr, " last_active=%p,", req->last_active ); fprintf( stderr, " last_active=%p,", req->last_active );
fprintf( stderr, " pid=%04x,", req->pid ); fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " tid=%04x,", req->tid ); fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " atom=%04x", req->atom ); fprintf( stderr, " atom=%04x,", req->atom );
fprintf( stderr, " is_unicode=%d", req->is_unicode );
} }
static void dump_set_window_info_request( const struct set_window_info_request *req ) static void dump_set_window_info_request( const struct set_window_info_request *req )
...@@ -2260,6 +2261,7 @@ static void dump_set_window_info_request( const struct set_window_info_request * ...@@ -2260,6 +2261,7 @@ static void dump_set_window_info_request( const struct set_window_info_request *
fprintf( stderr, " ex_style=%08x,", req->ex_style ); fprintf( stderr, " ex_style=%08x,", req->ex_style );
fprintf( stderr, " id=%08x,", req->id ); fprintf( stderr, " id=%08x,", req->id );
fprintf( stderr, " instance=%p,", req->instance ); fprintf( stderr, " instance=%p,", req->instance );
fprintf( stderr, " is_unicode=%d,", req->is_unicode );
fprintf( stderr, " user_data=%p,", req->user_data ); fprintf( stderr, " user_data=%p,", req->user_data );
fprintf( stderr, " extra_offset=%d,", req->extra_offset ); fprintf( stderr, " extra_offset=%d,", req->extra_offset );
fprintf( stderr, " extra_size=%d,", req->extra_size ); fprintf( stderr, " extra_size=%d,", req->extra_size );
......
...@@ -73,6 +73,7 @@ struct window ...@@ -73,6 +73,7 @@ struct window
unsigned int ex_style; /* window extended style */ unsigned int ex_style; /* window extended style */
unsigned int id; /* window id */ unsigned int id; /* window id */
void* instance; /* creator instance */ void* instance; /* creator instance */
int is_unicode; /* ANSI or unicode */
void* user_data; /* user-specific data */ void* user_data; /* user-specific data */
WCHAR *text; /* window caption text */ WCHAR *text; /* window caption text */
unsigned int paint_flags; /* various painting flags */ unsigned int paint_flags; /* various painting flags */
...@@ -354,6 +355,7 @@ static struct window *create_window( struct window *parent, struct window *owner ...@@ -354,6 +355,7 @@ static struct window *create_window( struct window *parent, struct window *owner
win->ex_style = 0; win->ex_style = 0;
win->id = 0; win->id = 0;
win->instance = NULL; win->instance = NULL;
win->is_unicode = 1;
win->user_data = NULL; win->user_data = NULL;
win->text = NULL; win->text = NULL;
win->paint_flags = 0; win->paint_flags = 0;
...@@ -1393,6 +1395,7 @@ DECL_HANDLER(get_window_info) ...@@ -1393,6 +1395,7 @@ DECL_HANDLER(get_window_info)
{ {
reply->full_handle = win->handle; reply->full_handle = win->handle;
reply->last_active = win->handle; reply->last_active = win->handle;
reply->is_unicode = win->is_unicode;
if (get_user_object( win->last_active, USER_WINDOW )) reply->last_active = win->last_active; if (get_user_object( win->last_active, USER_WINDOW )) reply->last_active = win->last_active;
if (win->thread) if (win->thread)
{ {
...@@ -1440,6 +1443,7 @@ DECL_HANDLER(set_window_info) ...@@ -1440,6 +1443,7 @@ DECL_HANDLER(set_window_info)
if (req->flags & SET_WIN_EXSTYLE) win->ex_style = req->ex_style; if (req->flags & SET_WIN_EXSTYLE) win->ex_style = req->ex_style;
if (req->flags & SET_WIN_ID) win->id = req->id; if (req->flags & SET_WIN_ID) win->id = req->id;
if (req->flags & SET_WIN_INSTANCE) win->instance = req->instance; if (req->flags & SET_WIN_INSTANCE) win->instance = req->instance;
if (req->flags & SET_WIN_UNICODE) win->is_unicode = req->is_unicode;
if (req->flags & SET_WIN_USERDATA) win->user_data = req->user_data; if (req->flags & SET_WIN_USERDATA) win->user_data = req->user_data;
if (req->flags & SET_WIN_EXTRA) memcpy( win->extra_bytes + req->extra_offset, if (req->flags & SET_WIN_EXTRA) memcpy( win->extra_bytes + req->extra_offset,
&req->extra_value, req->extra_size ); &req->extra_value, req->extra_size );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment