diff options
| author | Stefan Boberg <[email protected]> | 2021-09-17 23:16:34 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-09-17 23:16:34 +0200 |
| commit | 91c305d98ab2a0482114c2d52d23ef787f08190d (patch) | |
| tree | b2a33fc86532424b1efa3fb28a48796e4aa76b78 /zencore/zencore.cpp | |
| parent | IsProcessRunning now throws if it fails the function fails to get a handle to... (diff) | |
| download | zen-91c305d98ab2a0482114c2d52d23ef787f08190d.tar.xz zen-91c305d98ab2a0482114c2d52d23ef787f08190d.zip | |
Added IsInteractiveSession() query to help identify if the process is running as a daemon or as an interactive process
Diffstat (limited to 'zencore/zencore.cpp')
| -rw-r--r-- | zencore/zencore.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp index d0b1135dc..122719d90 100644 --- a/zencore/zencore.cpp +++ b/zencore/zencore.cpp @@ -67,6 +67,23 @@ IsDebuggerPresent() #endif } +bool +IsInteractiveSession() +{ +#if ZEN_PLATFORM_WINDOWS + DWORD dwSessionId = 0; + if (ProcessIdToSessionId(GetCurrentProcessId(), &dwSessionId)) + { + return (dwSessionId != 0); + } + + return false; +#else + // TODO: figure out what makes sense here + return true; +#endif +} + ////////////////////////////////////////////////////////////////////////// static int s_ApplicationExitCode = 0; |