GetSystemInfo
provides the basic system information and processor architecture of the underlying platform. This API can be used successfully in both x64 and x86 platforms. But, under 64-bit WIndows, we can run 32 bit Applications (WOW64). If a WOW64 process calls GetSystemInfo
API, it will return the processor architecture as x86. Of course, it should be the way. If this API acts otherwise, there could be compatibility problems that may arise and the application could act weird and show undefined behavior.
If the WOW64 process wants to know the original platform it’s running, it must call GetNativeSystemInfo
. When do we have to use this? I've a real world example. When we spawn process explorer (procexp.exe, it realizes the underlying platform and creates another EXE procexp64.exe (64bit version) to iterate all process information in the system. Note that the GetNativeSystemInfo
needs to be called only if your 32bit application wants to run under 64 bit platform and needs to care about the true underlying platform. In all other cases, call GetSystemInfo
, which works across platforms uniquely. See the snippet below:
To know more about the different processor architectures at the abstract level, please do check one of my previous posts.