From 0eb2f07a3757f62b954ff6e99b7164feaeea590b Mon Sep 17 00:00:00 2001 From: Maurice Heumann Date: Sat, 3 Dec 2022 16:05:57 +0100 Subject: [PATCH] Add wine detection --- src/common/utils/nt.cpp | 11 +++++++++++ src/common/utils/nt.hpp | 1 + 2 files changed, 12 insertions(+) diff --git a/src/common/utils/nt.cpp b/src/common/utils/nt.cpp index fa890e52..f6b07add 100644 --- a/src/common/utils/nt.cpp +++ b/src/common/utils/nt.cpp @@ -218,6 +218,17 @@ namespace utils::nt return nullptr; } + bool is_wine() + { + static const auto has_wine_export = []() -> bool + { + const library ntdll("ntdll.dll"); + return ntdll.get_proc("wine_get_version"); + }(); + + return has_wine_export; + } + bool is_shutdown_in_progress() { static auto* shutdown_in_progress = [] diff --git a/src/common/utils/nt.hpp b/src/common/utils/nt.hpp index 71222007..962ed6d5 100644 --- a/src/common/utils/nt.hpp +++ b/src/common/utils/nt.hpp @@ -166,6 +166,7 @@ namespace utils::nt HANDLE handle_{InvalidHandle}; }; + bool is_wine(); bool is_shutdown_in_progress(); __declspec(noreturn) void raise_hard_exception();