GetSystemInfo vs. GetNativeSystemInfo: Which One to Use?Windows provides two closely related functions for retrieving system information: GetSystemInfo and GetNativeSystemInfo. They look similar, but choosing the correct one matters when your application needs accurate details about processor architecture and address space — especially on 64-bit Windows running 32-bit code (WOW64). This article explains the differences, shows practical examples, outlines common pitfalls, and gives clear guidance on which API to call in different scenarios.
What each function does
-
GetSystemInfo
Returns information about the system as presented to the calling process. On 32-bit processes running under WOW64 (Windows-on-Windows64), GetSystemInfo reports the emulated environment — typically the 32-bit view — not the actual underlying native architecture. -
GetNativeSystemInfo
Returns information about the native system architecture, independent of the calling process’s bitness. Even if a 32-bit process calls this function under WOW64, it receives the real underlying system information (for example, x86_64/AMD64).
Why the distinction matters
The key issue is address-width and processor architecture visibility when 32-bit processes run on 64-bit Windows (WOW64). Examples where the difference affects behavior:
- Determining if the OS is 64-bit. A 32-bit process calling GetSystemInfo may incorrectly conclude the OS is 32-bit.
- Deciding pointer sizes, data model choices, or allocating memory ranges that depend on native address space.
- Reporting system capabilities to users or logging accurate telemetry.
- Implementing compatibility or diagnostic tools that must reflect the actual OS.
SYSTEM_INFO structure: important fields
Both functions populate a SYSTEM_INFO structure. Relevant fields include:
- wProcessorArchitecture — processor architecture identifier (e.g., PROCESSOR_ARCHITECTURE_AMD64).
- dwPageSize — page size in bytes.
- lpMinimumApplicationAddress / lpMaximumApplicationAddress — range of application virtual addresses.
- dwNumberOfProcessors — logical processor count.
Under WOW64, values such as wProcessorArchitecture and lpMaximumApplicationAddress differ between the two calls: GetSystemInfo shows the 32-bit view, GetNativeSystemInfo shows the true 64-bit values.
Practical examples ©
Example: call both functions and compare results.
#include <windows.h> #include <stdio.h> void printSystemInfo(const SYSTEM_INFO *si) { printf("Architecture: %u ", si->wProcessorArchitecture); printf("PageSize: %u ", si->dwPageSize); printf("MinAppAddr: %p ", si->lpMinimumApplicationAddress); printf("MaxAppAddr: %p ", si->lpMaximumApplicationAddress); printf("NumProcessors: %u ", si->dwNumberOfProcessors); } int main(void) { SYSTEM_INFO si1, si2; GetSystemInfo(&si1); GetNativeSystemInfo(&si2); printf("GetSystemInfo: "); printSystemInfo(&si1); printf(" GetNativeSystemInfo: "); printSystemInfo(&si2); return 0; }
On a 32-bit process under 64-bit Windows, expect lpMaximumApplicationAddress from GetSystemInfo to be around 0x7FFFFFFF while GetNativeSystemInfo will be much larger (reflecting the 64-bit address space).
When to use which
-
Use GetNativeSystemInfo when:
- Your code must know the actual native processor architecture and address space (e.g., installers, system utilities, diagnostic tools).
- You’re running code that needs to adapt behavior based on the real OS capabilities, regardless of process bitness.
- You need accurate maximum application address or page-size info for native memory calculations.
-
Use GetSystemInfo when:
- You want the system information as the current process sees it (for example, for behavior that must match the process’s runtime environment).
- Your code is strictly concerned with the process’s emulated environment and should act accordingly.
If in doubt and you need true system capabilities, prefer GetNativeSystemInfo.
Additional notes and best practices
- Use IsWow64Process / IsWow64Process2 when you need to detect WOW64 explicitly or determine the relationship between process and native architectures. IsWow64Process2 (Windows 10 and later) gives more precise mapping of emulation.
- Do not assume identical values for lpMaximumApplicationAddress or pointer sizes across processes of different bitness on the same machine.
- For new code targeting modern Windows, prefer GetNativeSystemInfo for system capability checks; use GetSystemInfo only when the process-view is specifically required.
Troubleshooting common issues
- If a 32-bit installer reports the system as 32-bit: ensure it calls GetNativeSystemInfo or uses IsWow64Process2.
- If memory allocations fail or addresses appear truncated: confirm whether your calculations used the native address limits or the process-limited view.
- For cross-platform code (Windows and non-Windows), tie architecture checks to portable detection macros or runtime checks rather than relying on a single Windows API call.
Summary (one-line guidance)
- If you need the real, underlying system architecture and address-space — call GetNativeSystemInfo.
- If you need the system view as seen by the current process — call GetSystemInfo.
Leave a Reply