On older versions of Windows it appeared to be possible to capture the WM_QUERYENDSESSION WM_ENDSESSION events from a console-less python applicati
WM_QUERYENDSESSION
WM_ENDSESSION