host_environment.cpp 488 B

123456789101112131415161718
  1. #include "host_environment.h"
  2. #include "windows.h"
  3. namespace sunrise::core::runtime {
  4. bool is_wine() {
  5. static const bool is_linux = []() -> bool {
  6. HMODULE hntdll = GetModuleHandleW(L"ntdll.dll");
  7. if (!hntdll) {
  8. return false;
  9. }
  10. return GetProcAddress(hntdll, "wine_get_version")
  11. != nullptr; // Exported by wine to identify itself but not by real windows
  12. }();
  13. return is_linux;
  14. }
  15. } // namespace sunrise::core::runtime