Introduction |
This article provides an overview of the Windows on Windows 64 (WOW64) sub-system and associated techniques that support 32-bit applications under Windows 64-bit. |
[Doakio Editor's Note: This article was restored from Gizmo's Freeware archives as a service to the freeware community. Gizmo's Freeware provided high-quality, volunteer freeware reviews for decades. They shut down in July of 2021.]
Discussion |
Windows 32-bit on Windows 64 (WOW64)WOW64 emulates 32-bit WindowsWow64.dll – the core emulation infrastructure and the links to the Ntoskrnl.exe entry-point functions. Wow64Win.dll – the links to the Win32k.sys entry-point functions. Wow64Cpu.dll – switches the processor from 32-bit to 64-bit mode. Ntdll.dll – 64-bit version. Wow64.dll loads the 32-bit version (x86) of Ntdll.dll and all necessary 32-bit DLLs which are mostly unmodified 32-bit binaries..However, some of these DLLs have been modified to behave differently on WOW64 than they do on 32-bit Windows. This is usually because they share memory with 64-bit system components.WOW64 manages file and registry settingsIn addition to handling operating system calls, the WOW64 interface needs to ensure that files and registry settings for 32-bit applications are kept apart from those for 64-bit applications. To achieve this two mechanisms are used, File and Registry Redirection and Key Reflection. Redirection maintains logical views of the data as if it were in 32-bit Windows and maps it to the correct physical location. Reflection ensures that 32-bit and 64-bit settings will be consistent where that is required.File RedirectionFile redirection ensures that there are separate folders for program and operating system files for 32- and 64-bit applications. 32-bit applications files are installed intoC:\Program Files(x86)32-bit system files are installed into C:\WINDOWS\SysWOW64For 64-bit applications, files are installed to: C:\Program Files C:\WINDOWS\SYSTEM32The WOW64 file redirector ensures that requests from 32-bit applications to open files in C:\Program Files or C:\WINDOWS\SYSTEM32 are redirected to the appropriate 32-bit directories. There is one issue with file redirection that users and developers should be aware of. Many 64 bit applications still use 32 bit installation routines. To ensure that an application is installed correctly, i.e. to C:\Program Files, the installation routine should make an operating system call to temporarily suspend the WOW64 file redirector. After installation another operating system call needs to be made to re-enable the redirector. If this approach is not followed then the application will be installed to C:\Program Files (x86). A classic example of this is the 64 bit development version of Firefox 3.5, codenamed Shiretoko, which is installed to C:\Program Files(x86)\Shiretoko. Firefox still functions correctly, the only thing you can't do is change the icon for the application. Registry RedirectionRegistry keys specific to 32-bit applications are redirected from:HKEY_LOCAL_MACHINE\Softwareto: HKEY_LOCAL_MACHINE\Software\WOW6432NodeYou may also occasionally see Registry entries elsewhere although this is unusual HKEY_CURRENT_USER\Software\WOW6432NodeThis approach allows both the 32-bit and 64-bit versions of an application to be installed side-by-side without overwriting each other’s settings. Registry reflectionSome redirected keys and/or values are also reflected. This means that if a 32-bit application makes a change to the redirected section of the registry, that change is also made to the 64 bit part of the registry, and vice-versa. Key reflection uses a policy of last writer wins. For example, if I install three applications with the same file extension then the last one to be installed will be associated with that extension.
Double-clicking on a file with the extension XYZ in Explorer would load the application installed in step 3, as it was the last one to associate itself with this extension. WOW64 has several limitationsSome but not all 64-bit features are available to 32-bit applications WOW64 provides 32-bit applications with access to some features of 64-bit systems. For example, applications can have more memory up to 4GB with the correct setting.. Other features are more limited due to overheads and restrictions. For example, 64-bit Windows will support logical 64 processors but 32-bit applications are restricted to the usual 32 logical processors. Code Injection cannot mix between 32-bit and 64-bit Under 64-bit Windows it is not possible to inject 32-bit code into a 64-bit process, nor is it possible to inject 64-bit code into a 32-bit process. Applications that rely on code injection to add functionality to existing applications will usually not work. This explains why most 32-bit shell extensions do not work under Windows 64-bit. The majority of shell extensions rely on code injection to add themselves to Windows Explorer.WOW64 does not support 16-bit installersWOW64 provides support for Microsoft's 16-bit installer – by substituting a compatible 32-bit installer – but does not extend this support to third-party products.Further options for running 32-bit applications with Windows 64-bitWindows Virtual PCWindows Virtual PC is free software that provides an environment that will support legacy hardware and software that will not work under Windows 7. Guest operating systems (OS) can run in a virtual machine which means they are not aware that they are running under another operating system. The system requirements and features vary significantly between versions of Virtual PC and versions of Windows so check before you try Virtual PC. The latest version is, perhaps, the most limited with no support for operating systems before the current supported version of Windows XP which is Service Pack 3.Windows XP Mode (XPM)Windows XP Mode is a specific implementation of Windows Virtual PC that comes with a pre-installed, licensed copy of Windows XP Professional with Service Pack 3. It is only available with the Enterprise, Ultimate and Professional editions of Windows 7 64-bit so you are expected to upgrade to these versions if you want it. Many who have used XPM advise that it should be used as a last resort. It will provide legacy support if you have no other options but, compared to other virtualization products, performance is disappointing and the default configuration raises a number of security issues.Dual boot WindowsYou can install more than one version of Windows on the same computer by dual booting.For the purposes of this article, you would install a 32-bit version and a 64-bit version alongside each other. Each operating system is installed into its own disk partition and a boot manager is installed on the default partition to ensure that you can choose which operating system you want to use at startup. Although you cannot use both operating systems at the same time it is a useful option because the entire computer is dedicated to the running operating system. Compared with virtual machines, there are no issues of compatibility and much less complexity in both installation and operation. You can also retain the ability to run 16-bit applications under the 32-bit version of Windows. |
Summary |
Most 32 bit applications will run quite happily under Windows 64. The main exceptions are:
Which runs faster 32-bit or 64-bit applications?This question is asked a lot and there is no general rule because it depends on the application and which CPU features they use. If we compared 32-bit and 64-bit applications in their native environments then 32-bit application usually use less memory than the equivalent 64-bit application because 64-bit versions use 64-bit values so they take up twice the space. The extra size affects the application startup and shutdown times and other activities that involve accessing the disk drives. Usually this means that the 32-bit application will run faster but 64-bit applications can access new and faster features in the 64-bit CPUs potentially giving improvements of up to 25% in processing speed. Once both 32-bit and 64-bit versions of a program are running on 64-bit Windows you have to ignore any performance on a 32-bit CPU. The 32-bit application now requires WOW64 to run so that should be included in any performance comparison. This means you need to include all the duplicated resources used to map the 32-bit application to the 64-bit environment it runs under. Duplicated resources are used for memory mapping and redirection of files locations and registry entries. The result is that the 32-bit application uses more memory and runs slower than on an equivalent 32-bit CPU but it may still be faster than the 64-bit application. |
Related Links |
Tags |
Windows on Windows 64, WOW64, 32 Applications under 64 bit Windows, 64 bit Windows Vista, 64 bit Windows 7, Windows Virtual PC, virtualization, dual boot, Securable |