mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
impr: Added telemetry about whether ImHex runs on a corporate machine
This commit is contained in:
@@ -134,6 +134,7 @@ if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||
if (WIN32)
|
||||
set_target_properties(libimhex PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
||||
target_link_options(libimhex PRIVATE -Wl,--export-all-symbols)
|
||||
target_link_libraries(libimhex PRIVATE Netapi32.lib)
|
||||
elseif (APPLE)
|
||||
find_library(FOUNDATION NAMES Foundation)
|
||||
target_link_libraries(libimhex PUBLIC ${FOUNDATION})
|
||||
|
||||
@@ -582,6 +582,14 @@ namespace hex {
|
||||
*/
|
||||
const std::string& getGLRenderer();
|
||||
|
||||
/**
|
||||
* @brief Checks if ImHex is being run in a "Corporate Environment"
|
||||
* This function simply checks for common telltale signs such as if the machine is joined a
|
||||
* domain. It's not super accurate, but it's still useful for statistics
|
||||
* @return True if it is
|
||||
*/
|
||||
bool isCorporateEnvironment();
|
||||
|
||||
/**
|
||||
* @brief Checks if ImHex is running in portable mode
|
||||
* @return Whether ImHex is running in portable mode
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
#include <windows.h>
|
||||
#include <DSRole.h>
|
||||
#else
|
||||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
@@ -730,6 +731,27 @@ namespace hex {
|
||||
return impl::s_glRenderer;
|
||||
}
|
||||
|
||||
bool isCorporateEnvironment() {
|
||||
#if defined(OS_WINDOWS)
|
||||
{
|
||||
DSROLE_PRIMARY_DOMAIN_INFO_BASIC * info;
|
||||
if ((DsRoleGetPrimaryDomainInformation(NULL, DsRolePrimaryDomainInfoBasic, (PBYTE *)&info) == ERROR_SUCCESS) && (info != nullptr))
|
||||
{
|
||||
bool result = std::wstring(info->DomainNameFlat).empty();
|
||||
DsRoleFreeMemory(info);
|
||||
|
||||
return result;
|
||||
} else {
|
||||
DWORD size = 1024;
|
||||
::GetComputerNameExA(ComputerNameDnsDomain, nullptr, &size);
|
||||
return size > 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool isPortableVersion() {
|
||||
static std::optional<bool> portable;
|
||||
if (portable.has_value())
|
||||
|
||||
@@ -75,7 +75,8 @@ namespace hex::plugin::builtin {
|
||||
{ "os", ImHexApi::System::getOSName() },
|
||||
{ "os_version", ImHexApi::System::getOSVersion() },
|
||||
{ "arch", ImHexApi::System::getArchitecture() },
|
||||
{ "gpu_vendor", ImHexApi::System::getGPUVendor() }
|
||||
{ "gpu_vendor", ImHexApi::System::getGPUVendor() },
|
||||
{ "corporate_env", ImHexApi::System::isCorporateEnvironment() }
|
||||
};
|
||||
|
||||
HttpRequest telemetryRequest("POST", ImHexApiURL + "/telemetry"s);
|
||||
|
||||
@@ -308,11 +308,12 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("hex.builtin.oobe.server_contact.data_collected.os"_lang);
|
||||
ImGui::TableNextColumn();
|
||||
ImGuiExt::TextFormattedWrapped("{}\n{}\n{}\n{}",
|
||||
ImGuiExt::TextFormattedWrapped("{}\n{}\n{}\n{}\nCorporate Environment: {}",
|
||||
ImHexApi::System::getOSName(),
|
||||
ImHexApi::System::getOSVersion(),
|
||||
ImHexApi::System::getArchitecture(),
|
||||
ImHexApi::System::getGPUVendor());
|
||||
ImHexApi::System::getGPUVendor(),
|
||||
ImHexApi::System::isCorporateEnvironment() ? "Yes" : "No");
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user