From 09fe96f36188caf9697b6e1bb8dd27b09bb7fc94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 15 Jun 2014 20:02:26 +0000 Subject: [PATCH] [EXPLORER][EXPLORER_NEW] [TASKMGR] Set a proper shutdown level (with SetProcessShutdownParameters) so that explorer and taskmgr are terminated the very last when one shutdowns ReactOS. See Windows Internals 4th page 286 (section "Shutdown") which gives the values (that I've cross-checked on Windows 2k3 too). svn path=/trunk/; revision=63601 --- reactos/base/applications/taskmgr/taskmgr.c | 6 ++++++ reactos/base/shell/explorer/explorer.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/reactos/base/applications/taskmgr/taskmgr.c b/reactos/base/applications/taskmgr/taskmgr.c index 5fec61407b2..cf94146762c 100644 --- a/reactos/base/applications/taskmgr/taskmgr.c +++ b/reactos/base/applications/taskmgr/taskmgr.c @@ -172,6 +172,12 @@ int APIENTRY wWinMain(HINSTANCE hInstance, return -1; } + /* + * Set our shutdown parameters: we want to shutdown the very last, + * without displaying any end task dialog if needed. + */ + SetProcessShutdownParameters(1, SHUTDOWN_NORETRY); + DialogBoxW(hInst, (LPCWSTR)IDD_TASKMGR_DIALOG, NULL, TaskManagerWndProc); /* Save our settings to the registry */ diff --git a/reactos/base/shell/explorer/explorer.cpp b/reactos/base/shell/explorer/explorer.cpp index db931cb8f05..ffe9d23fe2a 100644 --- a/reactos/base/shell/explorer/explorer.cpp +++ b/reactos/base/shell/explorer/explorer.cpp @@ -1203,6 +1203,12 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL "ROS Explorer - command line options", MB_OK); } + /* + * Set our shutdown parameters: we want to shutdown the very last, + * but before any TaskMgr instance (which has a shutdown level of 1). + */ + SetProcessShutdownParameters(2, 0); + Thread* pSSOThread = NULL; if (startup_desktop) {