Module: wine Branch: master Commit: 6bf64f0ac278b826b526504d69f384dfce598bc8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6bf64f0ac278b826b526504d69...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Jan 28 12:41:56 2014 +0100
user32: Fail creation of the desktop window earlier on when it already exists.
---
dlls/user32/desktop.c | 2 ++ dlls/user32/win.c | 3 +++ programs/explorer/desktop.c | 19 ++++++------------- 3 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/dlls/user32/desktop.c b/dlls/user32/desktop.c index bc91252..d22e732 100644 --- a/dlls/user32/desktop.c +++ b/dlls/user32/desktop.c @@ -117,6 +117,8 @@ LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lP ATOM atom; WCHAR buffer[37];
+ if (GetAncestor( hwnd, GA_PARENT )) return FALSE; /* refuse to create non-desktop window */ + sprintfW( buffer, guid_formatW, guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] ); diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 275b93c..e29153a 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -2086,6 +2086,9 @@ HWND WINAPI GetDesktopWindow(void) SERVER_END_REQ; }
+ /* wait for the desktop process to be ready */ + SendMessageW( thread_info->top_window, WM_NULL, 0, 0 ); + if (!thread_info->top_window || !USER_Driver->pCreateDesktopWindow( thread_info->top_window )) ERR( "failed to create desktop window\n" );
diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index db6a355..474e93e 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -799,7 +799,7 @@ void manage_desktop( WCHAR *arg ) HDESK desktop = 0; GUID guid; MSG msg; - HWND hwnd, msg_hwnd; + HWND hwnd; HMODULE graphics_driver; unsigned int width, height; WCHAR *cmdline = NULL, *driver = NULL; @@ -856,12 +856,12 @@ void manage_desktop( WCHAR *arg ) hwnd = CreateWindowExW( 0, DESKTOP_CLASS_ATOM, NULL, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 0, 0, 0, 0, 0, &guid );
- /* create the HWND_MESSAGE parent */ - msg_hwnd = CreateWindowExW( 0, messageW, NULL, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, - 0, 0, 100, 100, 0, 0, 0, NULL ); - - if (hwnd == GetDesktopWindow()) + if (hwnd) { + /* create the HWND_MESSAGE parent */ + CreateWindowExW( 0, messageW, NULL, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + 0, 0, 100, 100, 0, 0, 0, NULL ); + using_root = !desktop || !create_desktop( graphics_driver, name, width, height ); SetWindowLongPtrW( hwnd, GWLP_WNDPROC, (LONG_PTR)desktop_wnd_proc ); SendMessageW( hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconW( 0, MAKEINTRESOURCEW(OIC_WINLOGO))); @@ -891,13 +891,6 @@ void manage_desktop( WCHAR *arg ) } } } - else - { - DestroyWindow( hwnd ); /* someone beat us to it */ - hwnd = 0; - } - - if (GetAncestor( msg_hwnd, GA_PARENT )) DestroyWindow( msg_hwnd ); /* someone beat us to it */
/* if we have a command line, execute it */ if (cmdline)