Click here to Skip to main content
Click here to Skip to main content

Getting Processor architecture in x86 and x64 bit platforms

By , 12 Oct 2010
Rate this:
Please Sign up or sign in to vote.

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)

About the Author

Sarath C
Technical Lead
India India
Software Developer
Follow on   Twitter

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 12 Oct 2010
Article Copyright 2010 by Sarath C
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid