user32: Fail creation of the desktop window earlier on when it already exists.

This commit is contained in:
Alexandre Julliard 2014-01-28 12:41:56 +01:00
parent ef5341b4d7
commit 6bf64f0ac2
3 changed files with 11 additions and 13 deletions

View File

@ -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] );

View File

@ -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" );

View File

@ -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)