From 83e0ce0042d364ac3fb2f8c98f022e4ce0eb19f6 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sat, 15 Feb 2025 11:09:20 +0100 Subject: [PATCH] fix: Corporate environment detection not working correctly --- lib/libimhex/source/api/imhex_api.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/libimhex/source/api/imhex_api.cpp b/lib/libimhex/source/api/imhex_api.cpp index 146aa9a52..769d359d8 100644 --- a/lib/libimhex/source/api/imhex_api.cpp +++ b/lib/libimhex/source/api/imhex_api.cpp @@ -749,13 +749,14 @@ namespace hex { DSROLE_PRIMARY_DOMAIN_INFO_BASIC * info; if ((DsRoleGetPrimaryDomainInformation(NULL, DsRolePrimaryDomainInfoBasic, (PBYTE *)&info) == ERROR_SUCCESS) && (info != nullptr)) { - bool result = std::wstring(info->DomainNameFlat).empty(); + bool result = std::wstring(info->DomainNameFlat) != L"WORKGROUP"; DsRoleFreeMemory(info); return result; } else { - DWORD size = 1024; - ::GetComputerNameExA(ComputerNameDnsDomain, nullptr, &size); + DWORD size = 128; + char buffer[128]; + ::GetComputerNameExA(ComputerNameDnsDomain, buffer, &size); return size > 0; } }