MCPcopy Create free account
hub / github.com/defold/defold / GetSystemInfo

Function GetSystemInfo

engine/dlib/src/dlib/sys_win32.cpp:297–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295 }
296
297 void GetSystemInfo(SystemInfo* info)
298 {
299 memset(info, 0, sizeof(*info));
300 PGETUSERDEFAULTLOCALENAME GetUserDefaultLocaleName = (PGETUSERDEFAULTLOCALENAME)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetUserDefaultLocaleName");
301 dmStrlCpy(info->m_DeviceModel, "", sizeof(info->m_DeviceModel));
302 dmStrlCpy(info->m_SystemName, "Windows", sizeof(info->m_SystemName));
303
304 const int max_len = 256;
305 char lang[max_len];
306 dmStrlCpy(lang, "en-US", max_len);
307
308 DWORD major_version = 0;
309 DWORD minor_version = 0;
310 if (GetWindowsVersion(&major_version, &minor_version))
311 {
312 dmSnPrintf(info->m_SystemVersion, sizeof(info->m_SystemVersion), "%u.%u", (uint32_t)major_version, (uint32_t)minor_version);
313 }
314 if (GetUserDefaultLocaleName) {
315 // Only availble on >= Vista
316 wchar_t tmp[max_len];
317 GetUserDefaultLocaleName(tmp, max_len);
318 WideCharToMultiByte(CP_UTF8, 0, tmp, -1, lang, max_len, 0, 0);
319 }
320 FillLanguageTerritory(lang, info);
321 FillTimeZone(info);
322 }
323
324 void GetSecureInfo(SystemInfo* info)
325 {

Callers

nothing calls this directly

Calls 6

dmStrlCpyFunction · 0.85
GetWindowsVersionFunction · 0.85
dmSnPrintfFunction · 0.85
FillLanguageTerritoryFunction · 0.85
FillTimeZoneFunction · 0.70
GetProcAddressFunction · 0.50

Tested by

no test coverage detected