Click here to Skip to main content
15,886,689 members
Articles / Mobile Apps

Getting Processor Architecture in x86 and x64 Bit Platforms

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
12 Oct 2010CPOL1 min read 11.2K   3  
Getting Processor architecture in x86 and x64 bit platforms

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.


License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
India India
Software Developer

Comments and Discussions

 
-- There are no messages in this forum --