A process may run as native 32 bit process, native 64 bit process, or 32 bit process on 64 bit OS (WOW).

Some times you need to figure out the bitness of your process.

For example, fusion needs to know this information when you install an assembly to GAC. It is illegal to install a 64 bit assembly in a 32 bit OS. But if fusion is running under WOW, then it becomes legal as long as the 64 bit assembly has the same processorArchitecture as the machine.

You can use GetSystemInfo API to retrieve information about the system where the process is running.

GetSystemInfo returns a SYSTEM_INFO struct. SYSTEM_INFO.wProcessorArchitecture is the system's processor architecture.

If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_IA64 or PROCESSOR_ARCHITECTURE_AMD64, then you know the process is running as a native 64 bit process.

If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_INTEL, the process is a 32 bit process. But it could be a native 32 bit process on 64 bit OS, or a WoW process. To figure out if the process is running under WoW, you can use the API IsWow64Process.

If the process is running under WoW, you need to call GetNativeSystemInfo to retrieve the real system processor architecture.

The whole process looks like this:

SYSTEM_INFO info = {0};
GetSystemInfo(&info);
if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64) {
 printf("Native 64 bit process on IA64");
}
else if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)) {
 printf("Native 64 bit process on AMD64");
}
else if (info.wProcessorArchitecture == PROCESS_ARCHITECTURE_INTEL)) {
 BOOL bIsWow = FALSE;;
 if (!IsWow64Process(GetCurrentProcess(), &bIsWow)){
   printf("IsWow64Process failed with last error %d.", GetLastError());
 }

 else
if (bIsWow) {
  GetNativeSystemInfo(&info);
  if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64) {
   printf("32 bit process on IA64");
  }
  else if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)) {
   printf("32 bit process on AMD64");
  }
  else {
   printf("I am running in the future!");
  }

 }
 else {
  printf("Native 32 bit process on x86");
 }
}
else {
  printf("I am running in the future!");
}

IsWow64Process and GetNativeSystemInfo only exists in XP+. If your application wants to run in downlevel you need to call LoadLibrary and GetProcAddress. See MSDN document for more detail.