https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7ca90b50de47ea1f2621d12bf75742630b02c19e

commit 7ca90b50de47ea1f2621d12bf75742630b02c19e
Author:     alpha5056 <[email protected]>
AuthorDate: Sun Apr 1 11:39:41 2018 -0600
Commit:     Hermès BÉLUSCA - MAÏTO <[email protected]>
CommitDate: Sun Apr 1 19:39:41 2018 +0200

    [WINLOGON] Implement BaseInitiateSystemShutdownEx(). (#458)
---
 base/system/winlogon/lang/bg-BG.rc |  11 +++
 base/system/winlogon/lang/cs-CZ.rc |  11 +++
 base/system/winlogon/lang/de-DE.rc |  11 +++
 base/system/winlogon/lang/el-GR.rc |  11 +++
 base/system/winlogon/lang/en-US.rc |  11 +++
 base/system/winlogon/lang/es-ES.rc |  11 +++
 base/system/winlogon/lang/fr-FR.rc |  11 +++
 base/system/winlogon/lang/he-IL.rc |  11 +++
 base/system/winlogon/lang/hu-HU.rc |  11 +++
 base/system/winlogon/lang/id-ID.rc |  11 +++
 base/system/winlogon/lang/it-IT.rc |  11 +++
 base/system/winlogon/lang/ja-JP.rc |  11 +++
 base/system/winlogon/lang/lt-LT.rc |  11 +++
 base/system/winlogon/lang/ms-MY.rc |  11 +++
 base/system/winlogon/lang/nl-NL.rc |  11 +++
 base/system/winlogon/lang/no-NO.rc |  11 +++
 base/system/winlogon/lang/pl-PL.rc |  11 +++
 base/system/winlogon/lang/pt-BR.rc |  11 +++
 base/system/winlogon/lang/ro-RO.rc |  11 +++
 base/system/winlogon/lang/ru-RU.rc |  11 +++
 base/system/winlogon/lang/sk-SK.rc |  11 +++
 base/system/winlogon/lang/sq-AL.rc |  11 +++
 base/system/winlogon/lang/sv-SE.rc |  11 +++
 base/system/winlogon/lang/tr-TR.rc |  11 +++
 base/system/winlogon/lang/uk-UA.rc |  11 +++
 base/system/winlogon/lang/zh-CN.rc |  11 +++
 base/system/winlogon/lang/zh-TW.rc |  11 +++
 base/system/winlogon/resource.h    |   6 ++
 base/system/winlogon/rpcserver.c   | 162 +++++++++++++++++++++++++++++++++++--
 29 files changed, 457 insertions(+), 8 deletions(-)

diff --git a/base/system/winlogon/lang/bg-BG.rc 
b/base/system/winlogon/lang/bg-BG.rc
index 639220b7d3..310842acfc 100644
--- a/base/system/winlogon/lang/bg-BG.rc
+++ b/base/system/winlogon/lang/bg-BG.rc
@@ -20,6 +20,17 @@ BEGIN
     DEFPUSHBUTTON "Пре&запуск", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Подготовка на мрежовите свързвания..."
diff --git a/base/system/winlogon/lang/cs-CZ.rc 
b/base/system/winlogon/lang/cs-CZ.rc
index 5d31156b3a..503c231227 100644
--- a/base/system/winlogon/lang/cs-CZ.rc
+++ b/base/system/winlogon/lang/cs-CZ.rc
@@ -20,6 +20,17 @@ BEGIN
     DEFPUSHBUTTON "&Restart", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Příprava síťových připojení..."
diff --git a/base/system/winlogon/lang/de-DE.rc 
b/base/system/winlogon/lang/de-DE.rc
index e7778e6db7..cf698c6e40 100644
--- a/base/system/winlogon/lang/de-DE.rc
+++ b/base/system/winlogon/lang/de-DE.rc
@@ -22,6 +22,17 @@ BEGIN
     DEFPUSHBUTTON "Neusta&rt", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Netzwerkverbindungen vorbereiten..."
diff --git a/base/system/winlogon/lang/el-GR.rc 
b/base/system/winlogon/lang/el-GR.rc
index 9de33e0278..d4663ce8c4 100644
--- a/base/system/winlogon/lang/el-GR.rc
+++ b/base/system/winlogon/lang/el-GR.rc
@@ -20,6 +20,17 @@ BEGIN
     DEFPUSHBUTTON "&Restart", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Γίνεται προετοιμασία των συνδέσεων 
δικτύου..."
diff --git a/base/system/winlogon/lang/en-US.rc 
b/base/system/winlogon/lang/en-US.rc
index 35e3cc45aa..2369394828 100644
--- a/base/system/winlogon/lang/en-US.rc
+++ b/base/system/winlogon/lang/en-US.rc
@@ -20,6 +20,17 @@ BEGIN
     DEFPUSHBUTTON "&Restart", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Preparing network connections..."
diff --git a/base/system/winlogon/lang/es-ES.rc 
b/base/system/winlogon/lang/es-ES.rc
index 4151f7f677..60e4334411 100644
--- a/base/system/winlogon/lang/es-ES.rc
+++ b/base/system/winlogon/lang/es-ES.rc
@@ -22,6 +22,17 @@ BEGIN
     DEFPUSHBUTTON "&Reiniciar", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Preparando las conexiones de red..."
diff --git a/base/system/winlogon/lang/fr-FR.rc 
b/base/system/winlogon/lang/fr-FR.rc
index e608ae0dca..eab9d4b572 100644
--- a/base/system/winlogon/lang/fr-FR.rc
+++ b/base/system/winlogon/lang/fr-FR.rc
@@ -22,6 +22,17 @@ BEGIN
     DEFPUSHBUTTON "&Redémarrer", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Préparation des connections réseau..."
diff --git a/base/system/winlogon/lang/he-IL.rc 
b/base/system/winlogon/lang/he-IL.rc
index 9907b4695e..0b900ec96c 100644
--- a/base/system/winlogon/lang/he-IL.rc
+++ b/base/system/winlogon/lang/he-IL.rc
@@ -22,6 +22,17 @@ BEGIN
     DEFPUSHBUTTON "הפעל מחדש", 1, 59, 32, 49, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "מכין חיבורי רשת..."
diff --git a/base/system/winlogon/lang/hu-HU.rc 
b/base/system/winlogon/lang/hu-HU.rc
index 3d0be69bb2..14c127a362 100644
--- a/base/system/winlogon/lang/hu-HU.rc
+++ b/base/system/winlogon/lang/hu-HU.rc
@@ -22,6 +22,17 @@ BEGIN
     DEFPUSHBUTTON "&Újraindítás", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Hálózati kapcsolatok elõkészítése..."
diff --git a/base/system/winlogon/lang/id-ID.rc 
b/base/system/winlogon/lang/id-ID.rc
index fa5c8cc022..c8fec2c143 100644
--- a/base/system/winlogon/lang/id-ID.rc
+++ b/base/system/winlogon/lang/id-ID.rc
@@ -22,6 +22,17 @@ BEGIN
     DEFPUSHBUTTON "&Mulai Lagi", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Menyiapkan koneksi jaringan..."
diff --git a/base/system/winlogon/lang/it-IT.rc 
b/base/system/winlogon/lang/it-IT.rc
index 7175687df8..f16f126013 100644
--- a/base/system/winlogon/lang/it-IT.rc
+++ b/base/system/winlogon/lang/it-IT.rc
@@ -20,6 +20,17 @@ BEGIN
     DEFPUSHBUTTON "&Riavvio", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Preparazione connessioni di rete..."
diff --git a/base/system/winlogon/lang/ja-JP.rc 
b/base/system/winlogon/lang/ja-JP.rc
index 0b6d5db70f..fd586f3d22 100644
--- a/base/system/winlogon/lang/ja-JP.rc
+++ b/base/system/winlogon/lang/ja-JP.rc
@@ -20,6 +20,17 @@ BEGIN
     DEFPUSHBUTTON "再起動(&R)", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "ネットワーク接続を準備しています..."
diff --git a/base/system/winlogon/lang/lt-LT.rc 
b/base/system/winlogon/lang/lt-LT.rc
index b8d8035d50..dd4ea23200 100644
--- a/base/system/winlogon/lang/lt-LT.rc
+++ b/base/system/winlogon/lang/lt-LT.rc
@@ -22,6 +22,17 @@ BEGIN
     DEFPUSHBUTTON "&Perkrauti", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Ruošiami tinklo susijungimai..."
diff --git a/base/system/winlogon/lang/ms-MY.rc 
b/base/system/winlogon/lang/ms-MY.rc
index 40579b408e..b2a1ec4cc1 100644
--- a/base/system/winlogon/lang/ms-MY.rc
+++ b/base/system/winlogon/lang/ms-MY.rc
@@ -22,6 +22,17 @@ BEGIN
     DEFPUSHBUTTON "Mula semula(&R)", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Menyediakan sambungan rangkaian..."
diff --git a/base/system/winlogon/lang/nl-NL.rc 
b/base/system/winlogon/lang/nl-NL.rc
index 43638ce094..53967ff4ba 100644
--- a/base/system/winlogon/lang/nl-NL.rc
+++ b/base/system/winlogon/lang/nl-NL.rc
@@ -20,6 +20,17 @@ BEGIN
     DEFPUSHBUTTON "&Restart", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Netwerkverbindingen voorbereiden..."
diff --git a/base/system/winlogon/lang/no-NO.rc 
b/base/system/winlogon/lang/no-NO.rc
index 441aec8ae8..799df12b59 100644
--- a/base/system/winlogon/lang/no-NO.rc
+++ b/base/system/winlogon/lang/no-NO.rc
@@ -20,6 +20,17 @@ BEGIN
     DEFPUSHBUTTON "&Restart", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE 
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Forbreder nettverk tilkoblinger..."
diff --git a/base/system/winlogon/lang/pl-PL.rc 
b/base/system/winlogon/lang/pl-PL.rc
index 5146c24b71..a4a8f2c65c 100644
--- a/base/system/winlogon/lang/pl-PL.rc
+++ b/base/system/winlogon/lang/pl-PL.rc
@@ -27,6 +27,17 @@ BEGIN
     DEFPUSHBUTTON "&Uruchom ponownie", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Trwa przygotowywanie połączeń sieciowych..."
diff --git a/base/system/winlogon/lang/pt-BR.rc 
b/base/system/winlogon/lang/pt-BR.rc
index e77efcdf59..58e107b261 100644
--- a/base/system/winlogon/lang/pt-BR.rc
+++ b/base/system/winlogon/lang/pt-BR.rc
@@ -22,6 +22,17 @@ BEGIN
     DEFPUSHBUTTON "&Reiniciar", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Preparando conexões de rede..."
diff --git a/base/system/winlogon/lang/ro-RO.rc 
b/base/system/winlogon/lang/ro-RO.rc
index 927ea7dc29..edad82edf6 100644
--- a/base/system/winlogon/lang/ro-RO.rc
+++ b/base/system/winlogon/lang/ro-RO.rc
@@ -29,6 +29,17 @@ BEGIN
     DEFPUSHBUTTON "&Repornire", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Conexiuni în rețea în curs de pregătire…"
diff --git a/base/system/winlogon/lang/ru-RU.rc 
b/base/system/winlogon/lang/ru-RU.rc
index 98d0797e75..efa60bec94 100644
--- a/base/system/winlogon/lang/ru-RU.rc
+++ b/base/system/winlogon/lang/ru-RU.rc
@@ -20,6 +20,17 @@ BEGIN
     DEFPUSHBUTTON "&Перезагрузка", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Подготавливаются сетевые подключения..."
diff --git a/base/system/winlogon/lang/sk-SK.rc 
b/base/system/winlogon/lang/sk-SK.rc
index e306a194c5..ced0100fd4 100644
--- a/base/system/winlogon/lang/sk-SK.rc
+++ b/base/system/winlogon/lang/sk-SK.rc
@@ -25,6 +25,17 @@ BEGIN
     DEFPUSHBUTTON "&Reštartovať", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Pripravujú sa sieťové pripojenia..."
diff --git a/base/system/winlogon/lang/sq-AL.rc 
b/base/system/winlogon/lang/sq-AL.rc
index 87bda5333e..de8b6046f2 100644
--- a/base/system/winlogon/lang/sq-AL.rc
+++ b/base/system/winlogon/lang/sq-AL.rc
@@ -24,6 +24,17 @@ BEGIN
     DEFPUSHBUTTON "&Rifillo", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Pergatit lidhjen e networkut..."
diff --git a/base/system/winlogon/lang/sv-SE.rc 
b/base/system/winlogon/lang/sv-SE.rc
index 0a175cff01..92aa469aa3 100644
--- a/base/system/winlogon/lang/sv-SE.rc
+++ b/base/system/winlogon/lang/sv-SE.rc
@@ -22,6 +22,17 @@ BEGIN
     DEFPUSHBUTTON "&Starta om", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Förbereder nätverksanslutningar..."
diff --git a/base/system/winlogon/lang/tr-TR.rc 
b/base/system/winlogon/lang/tr-TR.rc
index db8aacfb2a..2019d7a9b4 100644
--- a/base/system/winlogon/lang/tr-TR.rc
+++ b/base/system/winlogon/lang/tr-TR.rc
@@ -22,6 +22,17 @@ BEGIN
     DEFPUSHBUTTON "&Yeniden Başlat", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Ağ Bağlantıları Anıklanıyor..."
diff --git a/base/system/winlogon/lang/uk-UA.rc 
b/base/system/winlogon/lang/uk-UA.rc
index 0cf0d35882..3022a35e0b 100644
--- a/base/system/winlogon/lang/uk-UA.rc
+++ b/base/system/winlogon/lang/uk-UA.rc
@@ -20,6 +20,17 @@ BEGIN
     DEFPUSHBUTTON "&Перезавантаження", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "Підготовка мережних підключень..."
diff --git a/base/system/winlogon/lang/zh-CN.rc 
b/base/system/winlogon/lang/zh-CN.rc
index c1db1be5cb..16683df9ed 100644
--- a/base/system/winlogon/lang/zh-CN.rc
+++ b/base/system/winlogon/lang/zh-CN.rc
@@ -23,6 +23,17 @@ BEGIN
     DEFPUSHBUTTON "重新启动(&R)", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "正在准备网络连接..."
diff --git a/base/system/winlogon/lang/zh-TW.rc 
b/base/system/winlogon/lang/zh-TW.rc
index af349467f6..1b6a15dfee 100644
--- a/base/system/winlogon/lang/zh-TW.rc
+++ b/base/system/winlogon/lang/zh-TW.rc
@@ -22,6 +22,17 @@ BEGIN
     DEFPUSHBUTTON "重新啟動(&R)", 1, 80, 91, 68, 14
 END
 
+IDD_SYSSHUTDOWN DIALOGEX 50, 50, 162, 100
+STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CAPTION | 
WS_POPUP
+CAPTION "System Shutdown"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    ICON IDI_WINLOGON, IDC_SYSSHUTDOWNICON, 6, 7, 18, 20
+    LTEXT "A system shutdown has been initiated. Please save all your work and 
terminate your session. All unsaved work will be lost when the system shuts 
down in:", IDC_SYSSHUTDOWNMSG, 38, 7, 124, 31
+    LTEXT "", IDC_SHUTDOWNTIMELEFT, 38, 38, 124, 14
+    LTEXT "No shutdown comment given.", IDC_SHUTDOWNCOMMENT, 38, 52, 124, 55
+END
+
 STRINGTABLE
 BEGIN
     IDS_PREPARENETWORKCONNECTIONS "正在準備網路連線..."
diff --git a/base/system/winlogon/resource.h b/base/system/winlogon/resource.h
index cea915c0cf..ac5150876c 100644
--- a/base/system/winlogon/resource.h
+++ b/base/system/winlogon/resource.h
@@ -1,6 +1,7 @@
 #pragma once
 
 /* Dialogs */
+#define IDD_SYSSHUTDOWN      500
 #define IDD_GINALOADFAILED   400
 #define IDD_SHUTDOWNCOMPUTER 300
 
@@ -8,6 +9,11 @@
 #define IDI_WINLOGON 4
 
 /* Controls */
+#define IDC_SYSSHUTDOWNMSG   501
+#define IDC_SHUTDOWNTIMELEFT 502
+#define IDC_SHUTDOWNCOMMENT  503
+#define IDC_SYSSHUTDOWNICON  504
+
 #define IDC_GINALOADFAILED        401
 #define IDC_GINALOADFAILEDCONTACT 402
 
diff --git a/base/system/winlogon/rpcserver.c b/base/system/winlogon/rpcserver.c
index 837c61ca32..bbf8e54aa6 100644
--- a/base/system/winlogon/rpcserver.c
+++ b/base/system/winlogon/rpcserver.c
@@ -6,13 +6,34 @@
  * PROGRAMMERS:     Eric Kohl
  */
 
-/* INCLUDES *****************************************************************/
+/* INCLUDES ******************************************************************/
 
 #include "winlogon.h"
 
+#include <ntstrsafe.h>
 #include <rpc.h>
 #include <winreg_s.h>
 
+/* DEFINES *******************************************************************/
+
+#define IDT_SYSSHUTDOWN 2000
+
+/* STRUCTS *******************************************************************/
+
+typedef struct _SYS_SHUTDOWN_PARAMS
+{
+    UNICODE_STRING usMessage;
+    ULONG dwTimeout;
+    BOOLEAN bRebootAfterShutdown;
+    BOOLEAN bForceAppsClosed;
+    DWORD dwReason;
+} SYS_SHUTDOWN_PARAMS, *PSYS_SHUTDOWN_PARAMS;
+
+/* GLOBALS *******************************************************************/
+
+HWND g_hShutdownDialog = NULL;
+BOOLEAN g_bShuttingDown = FALSE;
+SYS_SHUTDOWN_PARAMS g_ShutdownParams;
 
 /* FUNCTIONS *****************************************************************/
 
@@ -431,7 +452,12 @@ BaseAbortSystemShutdown(
     PREGISTRY_SERVER_NAME ServerName)
 {
     TRACE("BaseAbortSystemShutdown()\n");
-    return ERROR_SUCCESS;
+
+    //FIXME: Verify that the caller actually has the correct privileges
+
+    if (g_bShuttingDown == FALSE)
+        return ERROR_NO_SHUTDOWN_IN_PROGRESS;
+    return PostMessage(g_hShutdownDialog, WM_CLOSE, 0, 0) ? ERROR_SUCCESS : 
GetLastError();
 }
 
 
@@ -485,6 +511,92 @@ BaseRegQueryMultipleValues(
     return ERROR_SUCCESS;
 }
 
+INT_PTR
+CALLBACK
+ShutdownDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    switch (uMsg)
+    {
+        case WM_INITDIALOG:
+        {
+            g_hShutdownDialog = hwndDlg;
+            if (g_ShutdownParams.usMessage.Length)
+            {
+                SetDlgItemTextW(hwndDlg,
+                                IDC_SHUTDOWNCOMMENT,
+                                g_ShutdownParams.usMessage.Buffer);
+            }
+            RemoveMenu(GetSystemMenu(hwndDlg, FALSE), SC_CLOSE, MF_BYCOMMAND);
+            SetWindowPos(hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | 
SWP_NOMOVE);
+            PostMessage(hwndDlg, WM_TIMER, 0, 0);
+            SetTimer(hwndDlg, IDT_SYSSHUTDOWN, 1000, NULL);
+        break;
+        }
+        case WM_CLOSE:
+        {
+            g_hShutdownDialog = NULL;
+            g_bShuttingDown = FALSE;
+            KillTimer(hwndDlg, IDT_SYSSHUTDOWN);
+            if (g_ShutdownParams.usMessage.Buffer)
+            {
+                HeapFree(GetProcessHeap(), 0, 
g_ShutdownParams.usMessage.Buffer);
+                RtlInitEmptyUnicodeString(&g_ShutdownParams.usMessage, NULL, 
0);
+            }
+            EndDialog(hwndDlg, 0);
+            DestroyWindow(hwndDlg);
+        break;
+        }
+        case WM_TIMER:
+        {
+            WCHAR strbuf[34];
+            int seconds, minutes, hours;
+            seconds = (int)(g_ShutdownParams.dwTimeout);
+            hours = seconds/3600;
+            seconds -= hours*3600;
+            minutes = seconds/60;
+            seconds -= minutes*60;
+            ZeroMemory(strbuf, sizeof(strbuf));
+            //FIXME: Show time remaining according to the locale's format
+            RtlStringCbPrintfW(strbuf, sizeof(strbuf), L"%d:%d:%d", hours, 
minutes, seconds);
+            SetDlgItemTextW(hwndDlg, IDC_SHUTDOWNTIMELEFT, strbuf);
+            if (g_ShutdownParams.dwTimeout == 0)
+            {
+                PostMessage(hwndDlg, WM_CLOSE, 0, 0);
+                ExitWindowsEx((g_ShutdownParams.bRebootAfterShutdown ? 
EWX_REBOOT : EWX_SHUTDOWN) |
+                              (g_ShutdownParams.bForceAppsClosed ? EWX_FORCE : 
0),
+                              g_ShutdownParams.dwReason);
+            }
+            g_ShutdownParams.dwTimeout--;
+        break;
+        }
+        default:
+            return FALSE;
+    }
+    return TRUE;
+}
+
+DWORD
+WINAPI
+InitiateSystemShutdownThread(LPVOID lpParameter)
+{
+    INT_PTR status;
+    status = DialogBoxW(hAppInstance, MAKEINTRESOURCEW(IDD_SYSSHUTDOWN),
+                        NULL, ShutdownDialogProc);
+    if (status >= 0)
+    {
+        return ERROR_SUCCESS;
+    }
+    else
+    {
+        if (g_ShutdownParams.usMessage.Buffer)
+        {
+            HeapFree(GetProcessHeap(), 0, g_ShutdownParams.usMessage.Buffer);
+            RtlInitEmptyUnicodeString(&g_ShutdownParams.usMessage, NULL, 0);
+        }
+        g_bShuttingDown = FALSE;
+        return GetLastError();
+    }
+}
 
 /* Function 30 */
 ULONG
@@ -497,6 +609,8 @@ BaseInitiateSystemShutdownEx(
     BOOLEAN bRebootAfterShutdown,
     ULONG dwReason)
 {
+    HANDLE hThread;
+
     TRACE("BaseInitiateSystemShutdownEx()\n");
     TRACE("  Message: %wZ\n", lpMessage);
     TRACE("  Timeout: %lu\n", dwTimeout);
@@ -504,15 +618,47 @@ BaseInitiateSystemShutdownEx(
     TRACE("  Reboot: %d\n", bRebootAfterShutdown);
     TRACE("  Reason: %lu\n", dwReason);
 
-//    return ERROR_SUCCESS;
+    //FIXME: Verify that the caller actually has the correct privileges
 
-    /* FIXME */
-    return ExitWindowsEx((bRebootAfterShutdown ? EWX_REBOOT : EWX_SHUTDOWN) |
-                         (bForceAppsClosed ? EWX_FORCE : 0),
-                         dwReason);
+    if (_InterlockedCompareExchange8((volatile char*)&g_bShuttingDown, TRUE, 
FALSE) == TRUE)
+        return ERROR_SHUTDOWN_IN_PROGRESS;
+    if (lpMessage && lpMessage->Length && lpMessage->Buffer)
+    {
+        g_ShutdownParams.usMessage.Buffer = HeapAlloc(GetProcessHeap(), 0, 
lpMessage->Length+sizeof(UNICODE_NULL));
+        if (g_ShutdownParams.usMessage.Buffer == NULL)
+        {
+            g_bShuttingDown = FALSE;
+            return GetLastError();
+        }
+        RtlInitEmptyUnicodeString(&g_ShutdownParams.usMessage, 
g_ShutdownParams.usMessage.Buffer, lpMessage->Length+sizeof(UNICODE_NULL));
+        RtlCopyUnicodeString(&(g_ShutdownParams.usMessage), 
(PUNICODE_STRING)lpMessage);
+    }
+    else
+    {
+        RtlInitEmptyUnicodeString(&g_ShutdownParams.usMessage, NULL, 0);
+    }
+    g_ShutdownParams.dwTimeout = dwTimeout;
+    g_ShutdownParams.bForceAppsClosed = bForceAppsClosed;
+    g_ShutdownParams.bRebootAfterShutdown = bRebootAfterShutdown;
+    g_ShutdownParams.dwReason = dwReason;
+    hThread = CreateThread(NULL, 0, InitiateSystemShutdownThread, NULL, 0, 
NULL);
+    if (hThread)
+    {
+        CloseHandle(hThread);
+        return ERROR_SUCCESS;
+    }
+    else
+    {
+        if (g_ShutdownParams.usMessage.Buffer)
+        {
+            HeapFree(GetProcessHeap(), 0, g_ShutdownParams.usMessage.Buffer);
+            RtlInitEmptyUnicodeString(&g_ShutdownParams.usMessage, NULL, 0);
+        }
+        g_bShuttingDown = FALSE;
+        return GetLastError();
+    }
 }
 
-
 /* Function 31 */
 error_status_t
 __stdcall

Reply via email to