Commit 4f30ff87 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

wineboot: Query windows from all desktops when --end-session --kill is used.

parent 1b37809d
......@@ -322,6 +322,45 @@ BOOL shutdown_close_windows( BOOL force )
return (result != 0);
}
static BOOL CALLBACK shutdown_one_desktop( LPWSTR name, LPARAM force )
{
HDESK hdesk;
WINE_TRACE("Shutting down desktop %s\n", wine_dbgstr_w(name));
hdesk = OpenDesktopW( name, 0, FALSE, GENERIC_ALL );
if (hdesk == NULL)
{
WINE_ERR("Cannot open desktop %s, err=%i\n", wine_dbgstr_w(name), GetLastError());
return 0;
}
if (!SetThreadDesktop( hdesk ))
{
CloseDesktop( hdesk );
WINE_ERR("Cannot set thread desktop %s, err=%i\n", wine_dbgstr_w(name), GetLastError());
return 0;
}
CloseDesktop( hdesk );
return shutdown_close_windows( force );
}
BOOL shutdown_all_desktops( BOOL force )
{
BOOL ret;
HDESK prev_desktop;
prev_desktop = GetThreadDesktop(GetCurrentThreadId());
ret = EnumDesktopsW( NULL, shutdown_one_desktop, (LPARAM)force );
SetThreadDesktop(prev_desktop);
return ret;
}
/* forcibly kill all processes without any cleanup */
void kill_processes( BOOL kill_desktop )
{
......
......@@ -88,6 +88,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wineboot);
#define MAX_LINE_LENGTH (2*MAX_PATH+2)
extern BOOL shutdown_close_windows( BOOL force );
extern BOOL shutdown_all_desktops( BOOL force );
extern void kill_processes( BOOL kill_desktop );
static WCHAR windowsdir[MAX_PATH];
......@@ -1142,7 +1143,11 @@ int main( int argc, char *argv[] )
if (end_session)
{
if (!shutdown_close_windows( force )) return 1;
if (kill)
{
if (!shutdown_all_desktops( force )) return 1;
}
else if (!shutdown_close_windows( force )) return 1;
}
if (kill) kill_processes( shutdown );
......
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