Based on the articles above, suggested patch to Eddie source code (not tested):
diff --git a/common/lang/inv.json b/common/lang/inv.json
index cf2e13a..efeefab 100644
--- a/common/lang/inv.json
+++ b/common/lang/inv.json
@@ -413,6 +413,7 @@
"StatsVpnTotalUpload": "VPN Total Upload",
"StatsVpnType": "VPN Type",
"WindowsSettingsRouteOutEmptyList": "WARNING: not specified routes go outside the tunnel, but you did not specify any route. Continue?",
+ "WindowsSystemSessionEnding": "Received system-session-ending event (restart, shutdown or log off)",
"CommandCancel": "Cancel",
"CommandConnect": "Connect to a recommended server",
"CommandConnectSubtitle": "or choose a specific server in 'Servers' tab.",
@@ -541,4 +542,4 @@
"WindowsUnlockFirstAuth": "Enter your password to unlock profile",
"WindowsUnlockTitle": "Unlock",
"OsWindowsNetworkAdapterDnsDone": "DNS {1} of a network adapter forced ({2}, from {3} to {4})"
-}
\ No newline at end of file
+}
diff --git a/src/Lib.Forms/Forms/Main.cs b/src/Lib.Forms/Forms/Main.cs
index 8ebd80f..5763a92 100644
--- a/src/Lib.Forms/Forms/Main.cs
+++ b/src/Lib.Forms/Forms/Main.cs
@@ -75,6 +75,9 @@ namespace Eddie.Forms.Forms
private bool m_logNeedScrollBottom = false;
+ private const int WM_QUERYENDSESSION = 0x11;
+ private static bool isSystemSessionEnding = false;
+
public Main()
{
OnPreInitializeComponent();
@@ -94,6 +97,16 @@ namespace Eddie.Forms.Forms
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
}
+ protected override void WndProc(ref System.Windows.Forms.Message m)
+ {
+ if (m.Msg == WM_QUERYENDSESSION)
+ {
+ Engine.Instance.Logs.Log(LogType.InfoImportant, LanguageManager.GetText("WindowsSystemSessionEnding"));
+ isSystemSessionEnding = true;
+ }
+ base.WndProc(ref m);
+ }
+
private void DoDispose(IDisposable o)
{
if (o != null)
@@ -652,7 +665,8 @@ namespace Eddie.Forms.Forms
e.Cancel = true;
- if (Engine.Instance.AskExitConfirm())
+ // If the system session is ending (restart/shutdown/logoff), do not inhibit it by creating popups.
+ if (!isSystemSessionEnding && Engine.Instance.AskExitConfirm())
{
if (AskYesNo(LanguageManager.GetText("ExitConfirm")) != true)
{