Commit b550f34f authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

user: Make ExitWindowsEx asynchronous by deferring the real work to the explorer process.

parent 5678ec4d
......@@ -411,6 +411,18 @@ BOOL WINAPI ExitWindowsEx( UINT flags, DWORD reason )
{
TRACE("(%x,%lx)\n", flags, reason);
if (!WIN_IsCurrentThread( GetDesktopWindow() ))
{
BOOL ret = PostMessageW( GetDesktopWindow(), WM_USER + 666,
MAKEWPARAM( flags, 0xbabe ), reason);
if (ret)
return TRUE;
/* this can happen if explorer hasn't been started or created the
* desktop window yet */
WARN("PostMessage failed with error %ld\n", GetLastError());
/* fall through to doing it in the same process */
}
if ((flags & EWX_FORCE) == 0)
{
HWND *list;
......@@ -468,6 +480,5 @@ BOOL WINAPI ExitWindowsEx( UINT flags, DWORD reason )
MESSAGE("wine: Failed to start wineboot\n");
}
ExitProcess(0);
return TRUE;
}
......@@ -62,6 +62,13 @@ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPAR
}
return 0;
/* simple check to prevent applications accidentally triggering the
* ExitWindowsEx code if they send random messages to the desktop window */
case WM_USER + 666:
if (HIWORD(wp) == 0xbabe)
return ExitWindowsEx( LOWORD(wp), lp );
return DefWindowProcW( hwnd, message, wp, lp );
default:
return DefWindowProcW( hwnd, message, wp, lp );
}
......
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