mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
Store the global shell, progman and taskman windows in the server
(based on a patch by Martin Fuchs).
This commit is contained in:
parent
6fbcacbb92
commit
8d174d3f47
@ -344,3 +344,134 @@ HWND WINAPI GetForegroundWindow(void)
|
||||
SERVER_END_REQ;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SetShellWindowEx (USER32.@)
|
||||
* hwndShell = Progman[Program Manager]
|
||||
* |-> SHELLDLL_DefView
|
||||
* hwndListView = | |-> SysListView32
|
||||
* | | |-> tooltips_class32
|
||||
* | |
|
||||
* | |-> SysHeader32
|
||||
* |
|
||||
* |-> ProxyTarget
|
||||
*/
|
||||
BOOL WINAPI SetShellWindowEx(HWND hwndShell, HWND hwndListView)
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
SERVER_START_REQ(set_global_windows)
|
||||
{
|
||||
req->flags = SET_GLOBAL_SHELL_WINDOWS;
|
||||
req->shell_window = hwndShell;
|
||||
req->shell_listview = hwndListView;
|
||||
ret = !wine_server_call_err(req);
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
|
||||
if (ret)
|
||||
{
|
||||
if (hwndListView && hwndListView!=hwndShell)
|
||||
SetWindowPos(hwndListView, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
|
||||
|
||||
SetWindowPos(hwndShell, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
* SetShellWindow (USER32.@)
|
||||
*/
|
||||
BOOL WINAPI SetShellWindow(HWND hwndShell)
|
||||
{
|
||||
return SetShellWindowEx(hwndShell, hwndShell);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
* GetShellWindow (USER32.@)
|
||||
*/
|
||||
HWND WINAPI GetShellWindow(void)
|
||||
{
|
||||
HWND hwndShell = 0;
|
||||
|
||||
SERVER_START_REQ(set_global_windows)
|
||||
{
|
||||
req->flags = 0;
|
||||
if (!wine_server_call_err(req))
|
||||
hwndShell = reply->old_shell_window;
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
|
||||
return hwndShell;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SetProgmanWindow (USER32.@)
|
||||
*/
|
||||
HWND WINAPI SetProgmanWindow ( HWND hwnd )
|
||||
{
|
||||
SERVER_START_REQ(set_global_windows)
|
||||
{
|
||||
req->flags = SET_GLOBAL_PROGMAN_WINDOW;
|
||||
req->progman_window = hwnd;
|
||||
if (wine_server_call_err( req )) hwnd = 0;
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GetProgmanWindow (USER32.@)
|
||||
*/
|
||||
HWND WINAPI GetProgmanWindow(void)
|
||||
{
|
||||
HWND ret = 0;
|
||||
|
||||
SERVER_START_REQ(set_global_windows)
|
||||
{
|
||||
req->flags = 0;
|
||||
if (!wine_server_call_err(req)) ret = reply->old_progman_window;
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SetTaskmanWindow (USER32.@)
|
||||
* NOTES
|
||||
* hwnd = MSTaskSwWClass
|
||||
* |-> SysTabControl32
|
||||
*/
|
||||
HWND WINAPI SetTaskmanWindow ( HWND hwnd )
|
||||
{
|
||||
SERVER_START_REQ(set_global_windows)
|
||||
{
|
||||
req->flags = SET_GLOBAL_TASKMAN_WINDOW;
|
||||
req->taskman_window = hwnd;
|
||||
if (wine_server_call_err( req )) hwnd = 0;
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetTaskmanWindow (USER32.@)
|
||||
*/
|
||||
HWND WINAPI GetTaskmanWindow(void)
|
||||
{
|
||||
HWND ret = 0;
|
||||
|
||||
SERVER_START_REQ(set_global_windows)
|
||||
{
|
||||
req->flags = 0;
|
||||
if (!wine_server_call_err(req)) ret = reply->old_taskman_window;
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
return ret;
|
||||
}
|
||||
|
@ -3092,6 +3092,29 @@ struct open_token_reply
|
||||
#define OPEN_TOKEN_AS_SELF 2
|
||||
|
||||
|
||||
|
||||
struct set_global_windows_request
|
||||
{
|
||||
struct request_header __header;
|
||||
unsigned int flags;
|
||||
user_handle_t shell_window;
|
||||
user_handle_t shell_listview;
|
||||
user_handle_t progman_window;
|
||||
user_handle_t taskman_window;
|
||||
};
|
||||
struct set_global_windows_reply
|
||||
{
|
||||
struct reply_header __header;
|
||||
user_handle_t old_shell_window;
|
||||
user_handle_t old_shell_listview;
|
||||
user_handle_t old_progman_window;
|
||||
user_handle_t old_taskman_window;
|
||||
};
|
||||
#define SET_GLOBAL_SHELL_WINDOWS 0x01
|
||||
#define SET_GLOBAL_PROGMAN_WINDOW 0x02
|
||||
#define SET_GLOBAL_TASKMAN_WINDOW 0x04
|
||||
|
||||
|
||||
enum request
|
||||
{
|
||||
REQ_new_process,
|
||||
@ -3272,6 +3295,7 @@ enum request
|
||||
REQ_get_next_hook,
|
||||
REQ_set_clipboard_info,
|
||||
REQ_open_token,
|
||||
REQ_set_global_windows,
|
||||
REQ_NB_REQUESTS
|
||||
};
|
||||
|
||||
@ -3457,6 +3481,7 @@ union generic_request
|
||||
struct get_next_hook_request get_next_hook_request;
|
||||
struct set_clipboard_info_request set_clipboard_info_request;
|
||||
struct open_token_request open_token_request;
|
||||
struct set_global_windows_request set_global_windows_request;
|
||||
};
|
||||
union generic_reply
|
||||
{
|
||||
@ -3640,8 +3665,9 @@ union generic_reply
|
||||
struct get_next_hook_reply get_next_hook_reply;
|
||||
struct set_clipboard_info_reply set_clipboard_info_reply;
|
||||
struct open_token_reply open_token_reply;
|
||||
struct set_global_windows_reply set_global_windows_reply;
|
||||
};
|
||||
|
||||
#define SERVER_PROTOCOL_VERSION 123
|
||||
#define SERVER_PROTOCOL_VERSION 124
|
||||
|
||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||
|
@ -2159,3 +2159,21 @@ enum message_type
|
||||
@END
|
||||
#define OPEN_TOKEN_THREAD 1
|
||||
#define OPEN_TOKEN_AS_SELF 2
|
||||
|
||||
|
||||
/* Set/get the global windows */
|
||||
@REQ(set_global_windows)
|
||||
unsigned int flags; /* flags for fields to set (see below) */
|
||||
user_handle_t shell_window; /* handle to the new shell window */
|
||||
user_handle_t shell_listview; /* handle to the new shell listview window */
|
||||
user_handle_t progman_window; /* handle to the new program manager window */
|
||||
user_handle_t taskman_window; /* handle to the new task manager window */
|
||||
@REPLY
|
||||
user_handle_t old_shell_window; /* handle to the shell window */
|
||||
user_handle_t old_shell_listview; /* handle to the shell listview window */
|
||||
user_handle_t old_progman_window; /* handle to the new program manager window */
|
||||
user_handle_t old_taskman_window; /* handle to the new task manager window */
|
||||
@END
|
||||
#define SET_GLOBAL_SHELL_WINDOWS 0x01 /* set both main shell and listview windows */
|
||||
#define SET_GLOBAL_PROGMAN_WINDOW 0x02
|
||||
#define SET_GLOBAL_TASKMAN_WINDOW 0x04
|
||||
|
@ -281,6 +281,7 @@ DECL_HANDLER(finish_hook_chain);
|
||||
DECL_HANDLER(get_next_hook);
|
||||
DECL_HANDLER(set_clipboard_info);
|
||||
DECL_HANDLER(open_token);
|
||||
DECL_HANDLER(set_global_windows);
|
||||
|
||||
#ifdef WANT_REQUEST_HANDLERS
|
||||
|
||||
@ -465,6 +466,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
|
||||
(req_handler)req_get_next_hook,
|
||||
(req_handler)req_set_clipboard_info,
|
||||
(req_handler)req_open_token,
|
||||
(req_handler)req_set_global_windows,
|
||||
};
|
||||
#endif /* WANT_REQUEST_HANDLERS */
|
||||
|
||||
|
@ -2532,6 +2532,23 @@ static void dump_open_token_reply( const struct open_token_reply *req )
|
||||
fprintf( stderr, " token=%p", req->token );
|
||||
}
|
||||
|
||||
static void dump_set_global_windows_request( const struct set_global_windows_request *req )
|
||||
{
|
||||
fprintf( stderr, " flags=%08x,", req->flags );
|
||||
fprintf( stderr, " shell_window=%p,", req->shell_window );
|
||||
fprintf( stderr, " shell_listview=%p,", req->shell_listview );
|
||||
fprintf( stderr, " progman_window=%p,", req->progman_window );
|
||||
fprintf( stderr, " taskman_window=%p", req->taskman_window );
|
||||
}
|
||||
|
||||
static void dump_set_global_windows_reply( const struct set_global_windows_reply *req )
|
||||
{
|
||||
fprintf( stderr, " old_shell_window=%p,", req->old_shell_window );
|
||||
fprintf( stderr, " old_shell_listview=%p,", req->old_shell_listview );
|
||||
fprintf( stderr, " old_progman_window=%p,", req->old_progman_window );
|
||||
fprintf( stderr, " old_taskman_window=%p", req->old_taskman_window );
|
||||
}
|
||||
|
||||
static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
|
||||
(dump_func)dump_new_process_request,
|
||||
(dump_func)dump_get_new_process_info_request,
|
||||
@ -2711,6 +2728,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
|
||||
(dump_func)dump_get_next_hook_request,
|
||||
(dump_func)dump_set_clipboard_info_request,
|
||||
(dump_func)dump_open_token_request,
|
||||
(dump_func)dump_set_global_windows_request,
|
||||
};
|
||||
|
||||
static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
|
||||
@ -2892,6 +2910,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
|
||||
(dump_func)dump_get_next_hook_reply,
|
||||
(dump_func)dump_set_clipboard_info_reply,
|
||||
(dump_func)dump_open_token_reply,
|
||||
(dump_func)dump_set_global_windows_reply,
|
||||
};
|
||||
|
||||
static const char * const req_names[REQ_NB_REQUESTS] = {
|
||||
@ -3073,6 +3092,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
|
||||
"get_next_hook",
|
||||
"set_clipboard_info",
|
||||
"open_token",
|
||||
"set_global_windows",
|
||||
};
|
||||
|
||||
/* ### make_requests end ### */
|
||||
|
@ -81,6 +81,11 @@ struct window
|
||||
|
||||
static struct window *top_window; /* top-level (desktop) window */
|
||||
|
||||
/* global window pointers */
|
||||
static struct window *shell_window;
|
||||
static struct window *shell_listview;
|
||||
static struct window *progman_window;
|
||||
static struct window *taskman_window;
|
||||
|
||||
/* retrieve a pointer to a window from its handle */
|
||||
inline static struct window *get_window( user_handle_t handle )
|
||||
@ -245,6 +250,11 @@ static void destroy_window( struct window *win )
|
||||
if (win->paint_count) inc_queue_paint_count( win->thread, -win->paint_count );
|
||||
queue_cleanup_window( win->thread, win->handle );
|
||||
}
|
||||
/* reset global window pointers, if the corresponding window is destroyed */
|
||||
if (win == shell_window) shell_window = NULL;
|
||||
if (win == shell_listview) shell_listview = NULL;
|
||||
if (win == progman_window) progman_window = NULL;
|
||||
if (win == taskman_window) taskman_window = NULL;
|
||||
free_user_handle( win->handle );
|
||||
destroy_properties( win );
|
||||
unlink_window( win );
|
||||
@ -820,3 +830,54 @@ DECL_HANDLER(get_window_properties)
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* get the new window pointer for a global window, checking permissions */
|
||||
/* helper for set_global_windows request */
|
||||
static int get_new_global_window( struct window **win, user_handle_t handle )
|
||||
{
|
||||
if (*win && (*win)->thread != current)
|
||||
{
|
||||
set_error( STATUS_ACCESS_DENIED );
|
||||
return 0;
|
||||
}
|
||||
if (!handle)
|
||||
{
|
||||
*win = NULL;
|
||||
return 1;
|
||||
}
|
||||
*win = get_window( handle );
|
||||
return (*win != NULL);
|
||||
}
|
||||
|
||||
/* Set/get the global windows */
|
||||
DECL_HANDLER(set_global_windows)
|
||||
{
|
||||
struct window *new_shell_window = shell_window;
|
||||
struct window *new_shell_listview = shell_listview;
|
||||
struct window *new_progman_window = progman_window;
|
||||
struct window *new_taskman_window = taskman_window;
|
||||
|
||||
reply->old_shell_window = shell_window ? shell_window->handle : 0;
|
||||
reply->old_shell_listview = shell_listview ? shell_listview->handle : 0;
|
||||
reply->old_progman_window = progman_window ? progman_window->handle : 0;
|
||||
reply->old_taskman_window = taskman_window ? taskman_window->handle : 0;
|
||||
|
||||
if (req->flags & SET_GLOBAL_SHELL_WINDOWS)
|
||||
{
|
||||
if (!get_new_global_window( &new_shell_window, req->shell_window )) return;
|
||||
if (!get_new_global_window( &new_shell_listview, req->shell_listview )) return;
|
||||
}
|
||||
if (req->flags & SET_GLOBAL_PROGMAN_WINDOW)
|
||||
{
|
||||
if (!get_new_global_window( &new_progman_window, req->progman_window )) return;
|
||||
}
|
||||
if (req->flags & SET_GLOBAL_TASKMAN_WINDOW)
|
||||
{
|
||||
if (!get_new_global_window( &new_taskman_window, req->taskman_window )) return;
|
||||
}
|
||||
shell_window = new_shell_window;
|
||||
shell_listview = new_shell_listview;
|
||||
progman_window = new_progman_window;
|
||||
taskman_window = new_taskman_window;
|
||||
}
|
||||
|
@ -67,10 +67,6 @@ typedef struct
|
||||
|
||||
/* ----- internal variables ----- */
|
||||
|
||||
static HWND hGlobalShellWindow=0; /*the shell*/
|
||||
static HWND hGlobalTaskmanWindow=0;
|
||||
static HWND hGlobalProgmanWindow=0;
|
||||
|
||||
static LPCSTR atomInternalPos;
|
||||
|
||||
|
||||
@ -632,27 +628,6 @@ BOOL WINAPI LockSetForegroundWindow( UINT lockcode )
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
* SetShellWindow (USER32.@)
|
||||
*/
|
||||
HWND WINAPI SetShellWindow(HWND hwndshell)
|
||||
{ WARN("(hWnd=%p) semi stub\n",hwndshell );
|
||||
|
||||
hGlobalShellWindow = WIN_GetFullHandle( hwndshell );
|
||||
return hGlobalShellWindow;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
* GetShellWindow (USER32.@)
|
||||
*/
|
||||
HWND WINAPI GetShellWindow(void)
|
||||
{ WARN("(hWnd=%p) semi stub\n",hGlobalShellWindow );
|
||||
|
||||
return hGlobalShellWindow;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* BringWindowToTop (USER32.@)
|
||||
*/
|
||||
@ -1346,59 +1321,3 @@ void WINAPI CascadeChildWindows16( HWND16 parent, WORD action )
|
||||
{
|
||||
FIXME("(%04x, %d): stub\n", parent, action);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* SetProgmanWindow (USER32.@)
|
||||
*/
|
||||
HWND WINAPI SetProgmanWindow ( HWND hwnd )
|
||||
{
|
||||
hGlobalProgmanWindow = hwnd;
|
||||
return hGlobalProgmanWindow;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetProgmanWindow (USER32.@)
|
||||
*/
|
||||
HWND WINAPI GetProgmanWindow(void)
|
||||
{
|
||||
return hGlobalProgmanWindow;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* SetShellWindowEx (USER32.@)
|
||||
* hwndProgman = Progman[Program Manager]
|
||||
* |-> SHELLDLL_DefView
|
||||
* hwndListView = | |-> SysListView32
|
||||
* | | |-> tooltips_class32
|
||||
* | |
|
||||
* | |-> SysHeader32
|
||||
* |
|
||||
* |-> ProxyTarget
|
||||
*/
|
||||
HWND WINAPI SetShellWindowEx ( HWND hwndProgman, HWND hwndListView )
|
||||
{
|
||||
FIXME("%p %p stub\n",hwndProgman ,hwndListView );
|
||||
hGlobalShellWindow = hwndProgman;
|
||||
return hGlobalShellWindow;
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* SetTaskmanWindow (USER32.@)
|
||||
* NOTES
|
||||
* hwnd = MSTaskSwWClass
|
||||
* |-> SysTabControl32
|
||||
*/
|
||||
HWND WINAPI SetTaskmanWindow ( HWND hwnd )
|
||||
{
|
||||
hGlobalTaskmanWindow = hwnd;
|
||||
return hGlobalTaskmanWindow;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetTaskmanWindow (USER32.@)
|
||||
*/
|
||||
HWND WINAPI GetTaskmanWindow(void)
|
||||
{
|
||||
return hGlobalTaskmanWindow;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user