Add Package and event subscription
MODIFY
WalletWasabi.Gui/packages.lock.json
WalletWasabi.Gui/packages.lock.json
},
"Microsoft.Win32.SystemEvents": {
"type": "Transitive",
- "resolved": "4.5.0",
- "contentHash": "LuI1oG+24TUj1ZRQQjM5Ew73BKnZE5NZ/7eAdh1o8ST5dPhUnJvIkiIn2re3MwnkRy6ELRnvEbBxHP8uALKhJw==",
+ "resolved": "4.7.0",
+ "contentHash": "mtVirZr++rq+XCDITMUdnETD59XoeMxSpLRIII7JRI6Yj0LEDiO1pPn0ktlnIj12Ix8bfvQqQDMMIF9wC98oCA==",
"dependencies": {
- "Microsoft.NETCore.Platforms": "2.0.0"
+ "Microsoft.NETCore.Platforms": "3.1.0"
}
},
"NBitcoin": {
"dependencies": {
"Microsoft.AspNetCore.Mvc.NewtonsoftJson": "3.1.1",
"Microsoft.Win32.Registry": "4.7.0",
+ "Microsoft.Win32.SystemEvents": "4.7.0",
"NBitcoin": "5.0.60",
"NBitcoin.Secp256k1": "1.0.8"
}
},
"Microsoft.Win32.SystemEvents": {
"type": "Transitive",
- "resolved": "4.5.0",
- "contentHash": "LuI1oG+24TUj1ZRQQjM5Ew73BKnZE5NZ/7eAdh1o8ST5dPhUnJvIkiIn2re3MwnkRy6ELRnvEbBxHP8uALKhJw==",
+ "resolved": "4.7.0",
+ "contentHash": "mtVirZr++rq+XCDITMUdnETD59XoeMxSpLRIII7JRI6Yj0LEDiO1pPn0ktlnIj12Ix8bfvQqQDMMIF9wC98oCA==",
"dependencies": {
- "Microsoft.NETCore.Platforms": "2.0.0"
+ "Microsoft.NETCore.Platforms": "3.1.0"
}
},
"runtime.any.System.Collections": {
},
"Microsoft.Win32.SystemEvents": {
"type": "Transitive",
- "resolved": "4.5.0",
- "contentHash": "LuI1oG+24TUj1ZRQQjM5Ew73BKnZE5NZ/7eAdh1o8ST5dPhUnJvIkiIn2re3MwnkRy6ELRnvEbBxHP8uALKhJw==",
+ "resolved": "4.7.0",
+ "contentHash": "mtVirZr++rq+XCDITMUdnETD59XoeMxSpLRIII7JRI6Yj0LEDiO1pPn0ktlnIj12Ix8bfvQqQDMMIF9wC98oCA==",
"dependencies": {
- "Microsoft.NETCore.Platforms": "2.0.0"
+ "Microsoft.NETCore.Platforms": "3.1.0"
}
},
"runtime.any.System.Collections": {
},
"Microsoft.Win32.SystemEvents": {
"type": "Transitive",
- "resolved": "4.5.0",
- "contentHash": "LuI1oG+24TUj1ZRQQjM5Ew73BKnZE5NZ/7eAdh1o8ST5dPhUnJvIkiIn2re3MwnkRy6ELRnvEbBxHP8uALKhJw==",
+ "resolved": "4.7.0",
+ "contentHash": "mtVirZr++rq+XCDITMUdnETD59XoeMxSpLRIII7JRI6Yj0LEDiO1pPn0ktlnIj12Ix8bfvQqQDMMIF9wC98oCA==",
"dependencies": {
- "Microsoft.NETCore.Platforms": "2.0.0"
+ "Microsoft.NETCore.Platforms": "3.1.0"
}
},
"runtime.any.System.Collections": {

MODIFY
WalletWasabi.Packager/packages.lock.json
WalletWasabi.Packager/packages.lock.json
"System.Security.Principal.Windows": "4.7.0"
}
},
+ "Microsoft.Win32.SystemEvents": {
+ "type": "Transitive",
+ "resolved": "4.7.0",
+ "contentHash": "mtVirZr++rq+XCDITMUdnETD59XoeMxSpLRIII7JRI6Yj0LEDiO1pPn0ktlnIj12Ix8bfvQqQDMMIF9wC98oCA==",
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "3.1.0"
+ }
+ },
"NBitcoin": {
"type": "Transitive",
"resolved": "5.0.60",
"dependencies": {
"Microsoft.AspNetCore.Mvc.NewtonsoftJson": "3.1.1",
"Microsoft.Win32.Registry": "4.7.0",
+ "Microsoft.Win32.SystemEvents": "4.7.0",
"NBitcoin": "5.0.60",
"NBitcoin.Secp256k1": "1.0.8"
}
"System.Security.Principal.Windows": "4.7.0"
}
},
+ "Microsoft.Win32.SystemEvents": {
+ "type": "Transitive",
+ "resolved": "4.7.0",
+ "contentHash": "mtVirZr++rq+XCDITMUdnETD59XoeMxSpLRIII7JRI6Yj0LEDiO1pPn0ktlnIj12Ix8bfvQqQDMMIF9wC98oCA==",
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "3.1.0"
+ }
+ },
"runtime.any.System.Collections": {
"type": "Transitive",
"resolved": "4.0.11",
"System.Security.Principal.Windows": "4.7.0"
}
},
+ "Microsoft.Win32.SystemEvents": {
+ "type": "Transitive",
+ "resolved": "4.7.0",
+ "contentHash": "mtVirZr++rq+XCDITMUdnETD59XoeMxSpLRIII7JRI6Yj0LEDiO1pPn0ktlnIj12Ix8bfvQqQDMMIF9wC98oCA==",
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "3.1.0"
+ }
+ },
"runtime.any.System.Collections": {
"type": "Transitive",
"resolved": "4.0.11",
"System.Security.Principal.Windows": "4.7.0"
}
},
+ "Microsoft.Win32.SystemEvents": {
+ "type": "Transitive",
+ "resolved": "4.7.0",
+ "contentHash": "mtVirZr++rq+XCDITMUdnETD59XoeMxSpLRIII7JRI6Yj0LEDiO1pPn0ktlnIj12Ix8bfvQqQDMMIF9wC98oCA==",
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "3.1.0"
+ }
+ },
"runtime.any.System.Collections": {
"type": "Transitive",
"resolved": "4.0.11",

MODIFY
WalletWasabi/Services/Terminate/TerminateService.cs
WalletWasabi/Services/Terminate/TerminateService.cs
+using Microsoft.Win32;
using System;
+using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Logging;
@@ -20,6 +22,17 @@ namespace WalletWasabi.Services.Terminate
TerminateApplicationAsync = terminateApplicationAsync;
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
Console.CancelKeyPress += Console_CancelKeyPress;
+
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ SystemEvents.SessionEnding += Windows_SystemEvents_SessionEnding;
+ }
+ }
+
+ private void Windows_SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
+ {
+ e.Cancel = true;
+ Logger.LogInfo("Windows_SystemEvents_SessionEnding cancelled");
}
private void CurrentDomain_ProcessExit(object? sender, EventArgs e)

MODIFY
WalletWasabi/WalletWasabi.csproj
WalletWasabi/WalletWasabi.csproj
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
+ <PackageReference Include="Microsoft.Win32.SystemEvents" Version="4.7.0" />
<PackageReference Include="NBitcoin" Version="5.0.60" />
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
<PackageReference Include="NBitcoin.Secp256k1" Version="1.0.8" />

MODIFY
WalletWasabi/packages.lock.json
WalletWasabi/packages.lock.json
"System.Security.Principal.Windows": "4.7.0"
}
},
+ "Microsoft.Win32.SystemEvents": {
+ "type": "Direct",
+ "requested": "[4.7.0, )",
+ "resolved": "4.7.0",
+ "contentHash": "mtVirZr++rq+XCDITMUdnETD59XoeMxSpLRIII7JRI6Yj0LEDiO1pPn0ktlnIj12Ix8bfvQqQDMMIF9wC98oCA==",
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "3.1.0"
+ }
+ },
"NBitcoin": {
"type": "Direct",
"requested": "[5.0.60, )",
"System.Security.Principal.Windows": "4.7.0"
}
},
+ "Microsoft.Win32.SystemEvents": {
+ "type": "Direct",
+ "requested": "[4.7.0, )",
+ "resolved": "4.7.0",
+ "contentHash": "mtVirZr++rq+XCDITMUdnETD59XoeMxSpLRIII7JRI6Yj0LEDiO1pPn0ktlnIj12Ix8bfvQqQDMMIF9wC98oCA==",
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "3.1.0"
+ }
+ },
"runtime.any.System.Collections": {
"type": "Transitive",
"resolved": "4.0.11",
"System.Security.Principal.Windows": "4.7.0"
}
},
+ "Microsoft.Win32.SystemEvents": {
+ "type": "Direct",
+ "requested": "[4.7.0, )",
+ "resolved": "4.7.0",
+ "contentHash": "mtVirZr++rq+XCDITMUdnETD59XoeMxSpLRIII7JRI6Yj0LEDiO1pPn0ktlnIj12Ix8bfvQqQDMMIF9wC98oCA==",
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "3.1.0"
+ }
+ },
"runtime.any.System.Collections": {
"type": "Transitive",
"resolved": "4.0.11",
"System.Security.Principal.Windows": "4.7.0"
}
},
+ "Microsoft.Win32.SystemEvents": {
+ "type": "Direct",
+ "requested": "[4.7.0, )",
+ "resolved": "4.7.0",
+ "contentHash": "mtVirZr++rq+XCDITMUdnETD59XoeMxSpLRIII7JRI6Yj0LEDiO1pPn0ktlnIj12Ix8bfvQqQDMMIF9wC98oCA==",
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "3.1.0"
+ }
+ },
"runtime.any.System.Collections": {
"type": "Transitive",
"resolved": "4.0.11",

Add Package and event subscription