Click here to Skip to main content
12,552,952 members (54,867 online)
Click here to Skip to main content
Add your own
alternative version


16 bookmarked

How can a 32-bit program detect that it is launched in a 64-bit Windows?

, 21 Mar 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
A 32-bit program can find out if it is launched in WoW64 with the help of the IsWow64Process function.

64-bit operating systems of the Windows family can execute 32-bit programs with the help of the WoW64 (Windows in Windows 64) subsystem that emulates the 32-bit environment due to an additional layer between a 32-bit application and 64-bit Windows API.

A 32-bit program can find out if it is launched in WoW64 with the help of the IsWow64Process function. The program can get additional information about the processor through the GetNativeSystemInfo function.

Keep in mind that the IsWow64Process function is included only in 64-bit Windows versions. You can use the GetProcAddress and GetModuleHandle functions to know if the IsWow64Process function is present in the system and to access it. This is an example demonstrating a correct use of the IsWow64Process function (download the project):

#include "stdafx.h"
bool IsWow64()
  BOOL bIsWow64 = FALSE;


  LPFN_ISWOW64PROCESS fnIsWow64Process;

  HMODULE module = GetModuleHandle(_T("kernel32"));
  const char funcName[] = "IsWow64Process";
  fnIsWow64Process = (LPFN_ISWOW64PROCESS)
    GetProcAddress(module, funcName);

  if(NULL != fnIsWow64Process)
    if (!fnIsWow64Process(GetCurrentProcess(),
      throw std::exception("Unknown error");
  return bIsWow64 != FALSE;

void main()
  if (IsWow64())
    printf("The process is running under WOW64.\n");
    printf("The process is not running under WOW64.\n");

  printf("\nPress Enter to continue...");


  1. The Bereznikers. How to detect 64-bit OS
  2. MSDN Library. IsWow64Process Function


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


About the Author

You may also be interested in...


Comments and Discussions

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161021.1 | Last Updated 22 Mar 2012
Article Copyright 2012 by Karpov Andrey
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid