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

This commit is contained in:
Robert Shearman 2006-08-04 17:28:04 +01:00 committed by Alexandre Julliard
parent 5678ec4db6
commit b550f34f2e
2 changed files with 19 additions and 1 deletions

View file

@ -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;
}

View file

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