From 68897f04bd60624fb57d1bd5add4ca7aed1d5e50 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Fri, 17 Sep 2021 15:39:49 +0200 Subject: Added IsDebuggerPresent() query function to query whether a debugger is currently attached to the running process --- zencore/zencore.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'zencore/zencore.cpp') diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp index 5899f014d..bb457ed0a 100644 --- a/zencore/zencore.cpp +++ b/zencore/zencore.cpp @@ -30,6 +30,8 @@ namespace zen { +////////////////////////////////////////////////////////////////////////// + bool IsPointerToStack(const void* ptr) { @@ -55,6 +57,18 @@ IsPointerToStack(const void* ptr) #endif } +bool +IsDebuggerPresent() +{ +#if ZEN_PLATFORM_WINDOWS + return ::IsDebuggerPresent(); +#else + return false; +#endif +} + +////////////////////////////////////////////////////////////////////////// + AssertException::AssertException(const char* Msg) : m_Msg(Msg) { } -- cgit v1.2.3 From feb3e97f486e474f0c5775a4c407ef6db540df49 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Fri, 17 Sep 2021 19:09:10 +0200 Subject: Assert improvements --- zencore/zencore.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'zencore/zencore.cpp') diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp index bb457ed0a..d0b1135dc 100644 --- a/zencore/zencore.cpp +++ b/zencore/zencore.cpp @@ -69,16 +69,6 @@ IsDebuggerPresent() ////////////////////////////////////////////////////////////////////////// -AssertException::AssertException(const char* Msg) : m_Msg(Msg) -{ -} - -AssertException::~AssertException() -{ -} - -////////////////////////////////////////////////////////////////////////// - static int s_ApplicationExitCode = 0; static bool s_ApplicationExitRequested; -- cgit v1.2.3 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