fix: Corporate environment detection not working correctly

This commit is contained in:
WerWolv
2025-02-15 11:09:20 +01:00
parent 4685dea075
commit 83e0ce0042

View File

@@ -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;
}
}