From 91c305d98ab2a0482114c2d52d23ef787f08190d Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Fri, 17 Sep 2021 23:16:34 +0200 Subject: Added IsInteractiveSession() query to help identify if the process is running as a daemon or as an interactive process --- zencore/zencore.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'zencore/zencore.cpp') 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; -- cgit v1.2.3