diff options
| author | Stefan Boberg <[email protected]> | 2021-09-27 20:08:44 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-09-27 20:08:44 +0200 |
| commit | b1fd9980abf2091ece8f0f2b3ccb77b1847d4de8 (patch) | |
| tree | 9c5b0c4c91d03cf185436c2b69b9c838b2c7bc3a /zencore/zencore.cpp | |
| parent | clang-format (diff) | |
| download | zen-b1fd9980abf2091ece8f0f2b3ccb77b1847d4de8.tar.xz zen-b1fd9980abf2091ece8f0f2b3ccb77b1847d4de8.zip | |
zencore: Added ability to forcefully set the IsInteractiveSession state
Diffstat (limited to 'zencore/zencore.cpp')
| -rw-r--r-- | zencore/zencore.cpp | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp index 3eb43c558..0b94f3bea 100644 --- a/zencore/zencore.cpp +++ b/zencore/zencore.cpp @@ -69,21 +69,36 @@ IsDebuggerPresent() #endif } +std::optional<bool> InteractiveSessionFlag; + +void +SetIsInteractiveSession(bool Value) +{ + InteractiveSessionFlag = Value; +} + bool IsInteractiveSession() { -#if ZEN_PLATFORM_WINDOWS - DWORD dwSessionId = 0; - if (ProcessIdToSessionId(GetCurrentProcessId(), &dwSessionId)) + if (!InteractiveSessionFlag.has_value()) { - return (dwSessionId != 0); - } - - return false; +#if ZEN_PLATFORM_WINDOWS + DWORD dwSessionId = 0; + if (ProcessIdToSessionId(GetCurrentProcessId(), &dwSessionId)) + { + InteractiveSessionFlag = (dwSessionId != 0); + } + else + { + InteractiveSessionFlag = false; + } #else - // TODO: figure out what makes sense here - return true; + // TODO: figure out what actually makes sense here + InteractiveSessionFlag = true; #endif + } + + return InteractiveSessionFlag.value(); } ////////////////////////////////////////////////////////////////////////// |