ThePhD / infoware

C++ Library for pulling system and hardware information, without hitting the command line.
Creative Commons Zero v1.0 Universal
410 stars 84 forks source link

Use GetNativeSystemInfo instead of GetSystemInfo in iware::cpu::architecture() #56

Closed demian51 closed 3 years ago

demian51 commented 3 years ago

In 64-bit Windows, the OS runs x86 applications in emulation mode(aka WOW64). GetSystemInfo returns its emulated information; therefore iware::cpu::architecture() says the architecture is x86, although OS is 64-bit. This pull request resolves the issue by calling GetNativeSystemInfo instead of GetSystemInfo.

Refer to: https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getnativesysteminfo

nabijaczleweli commented 3 years ago

Good point, the new behaviour also matches when you run cross-arch on UNIX; thanks!