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

This commit is contained in:
Vincent Povirk 2010-05-18 13:36:36 -05:00 committed by Alexandre Julliard
parent 1b37809dba
commit 4f30ff875b
2 changed files with 45 additions and 1 deletions

View File

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

View File

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