WoW64 explained

WoW64
Other Names:Windows 32-bit on Windows 64-bit
Developer:Microsoft
Operating System:Microsoft Windows
Platform:IA-64, x86-64, ARM64
Genre:Compatibility layer
License:Proprietary commercial software

In computing on Microsoft platforms, WoW64 (Windows 32-bit on Windows 64-bit) is a subsystem of the Windows operating system capable of running 32-bit applications on 64-bit Windows.[1] It is included in all 64-bit versions of Windows, except in Windows Server Server Core where it is an optional component, and Windows Nano Server where it is not included. WoW64 aims to take care of many of the differences between 32-bit Windows and 64-bit Windows, particularly involving structural changes to Windows itself.

Translation libraries

The WoW64 subsystem comprises a lightweight compatibility layer that has similar interfaces on all 64-bit versions of Windows. It aims to create a 32-bit environment that provides the interfaces required to run unmodified 32-bit Windows applications on a 64-bit system. WOW64 is implemented using several DLLs, some of which include:[2]

  1. Wow64.dll, the core interface to the Windows NT kernel that translates (thunks) between 32-bit and 64-bit calls, including pointer and call stack manipulations
  2. Wow64win.dll, which provides the appropriate entry-points for 32-bit applications (win32k thunks)
  3. A dll that allows 32-bit x86 instructions to be executed, which varies by instruction set architecture.
    • On x86-64, Wow64cpu.dll takes care of switching the processor from 32-bit to 64-bit mode. This is computationally cheap, as x86-64 machines have a native mode for running 32-bit x86 code.[3]
    • On IA-64 (Itanium 2), three files are needed for a slower software emulation: Wow64cpu.dll, a "CPU abstraction layer";, the x86 software emulator; and, the bridge between the emulator and the WOW64 system.[4]
    • On ARMv8 64-bit, for x86 emulation, and for switching to ARM32 mode.[2]

Registry and file system

The WoW64 subsystem also handles other key aspects of running 32-bit applications. It is involved in managing the interaction of 32-bit applications with the Windows components such as the Registry, which has distinct keys for 64-bit and 32-bit applications. For example, HKEY_LOCAL_MACHINE\Software\Wow6432Node is the 32-bit equivalent of HKEY_LOCAL_MACHINE\Software (although 32-bit applications are not aware of this redirection). Some Registry keys are mapped from 64-bit to their 32-bit equivalents, while others have their contents mirrored, depending on the edition of Windows.

The operating system uses the [[%SystemRoot%]]\system32 directory for its 64-bit library and executable files. This is done for backward compatibility reasons, as many legacy applications are hardcoded to use that path. When executing 32-bit applications, WoW64 transparently redirects access to "system32" (e.g. DLL loads) to %SystemRoot%\SysWoW64, which contains 32-bit libraries and executables. Exceptions from these redirects are:[5]

The redirection helps to keep 32-bit applications working without them needing to be aware of the WoW64 status.[5] If a 32-bit application wants to access the real %SystemRoot%\System32, it can do so through the pseudo-directory %SystemRoot%\sysnative since Windows Vista.[5] Detection of Wow64 status is possible via .

There are two Program Files directories each visible to both 32-bit and 64-bit applications. The directory that stores the 32 bit files is called to differentiate between the two, while the 64 bit maintains the traditional name without any additional qualifier. File system redirection is not used to maintain the separation; instead, WoW64 changes and similar query results to point installer programs to the correct directory.[6]

A few new directories are also found on ARM64, where WOW64 handles not only the running of 32-bit x86 programs, but also 32-bit ARM programs, which uses instead. ARM64 also supports the so-called CHPE "compiled-hybrid-PE", which has ARM64 code in a x86 dll container (for more efficient, emulation-free compatibility); these dlls are found in .[7]

Application compatibility

32-bit applications that include only 32-bit kernel-mode device drivers, or that plug into the process space of components that are implemented purely as 64-bit processes (e.g. Windows Explorer) cannot be executed on a 64-bit platform.

32-bit service applications are supported. The SysWOW64 folder located in the Windows folder on the OS drive contains several applications to support 32-bit applications (e.g. cmd.exe, odbcad32.exe, to register ODBC connections for 32-bit applications). 16-bit legacy applications for MS-DOS and early versions of Windows are usually incompatible with 64-bit versions of Windows Vista, 7, 8, and 10, but can be run on a 64-bit Windows OS via virtualization software. 32-bit versions of Windows XP, Vista, 7, 8, and 10 on the other hand, can usually run 16-bit applications with few to no problems. 16-bit applications cannot be directly run under x64 editions of Windows, because the CPU does not support VM86 mode when running in x64.

Internet Explorer is implemented as both a 32-bit and a 64-bit application because of the large number of 32-bit ActiveX components on the Internet that would not be able to plug into the 64-bit version.

Previously, the 32-bit version was used by-default and it was difficult to set the 64-bit version to be the default browser. This changed in Internet Explorer 10, which ran 32-bit add-ons inside a 64-bit session, eliminating the need to switch between the two versions. If a user was to go into the 32-bit folder (typically C:\Program Files (x86)\Internet Explorer) and double-click the iexplore.exe file there, the 64-bit version will still load. In Internet Explorer 9 and previous, this would load only the 32-bit version.

, a bug in the translation layer of the x64 version of WoW64[8] [9] also renders all 32-bit applications that rely on the Windows API function GetThreadContext incompatible. Such applications include application debuggers, call stack tracers (e.g. IDEs displaying call stack) and applications that use garbage collection (GC) engines. One of the more widely used but affected[10] GC engines is the Boehm GC. It is also used as the default garbage collector of the equally popular Mono. While Mono has introduced a new (but optional) GC as of October 2010 called SGen-GC, it performs stack scanning in the same manner as Boehm GC, thus also making it incompatible under WoW64. No fix has been provided as of July 2016, although workarounds have been suggested.[11]

Performance

According to Microsoft, 32-bit software running under WOW64 (x64) has similar performance to executing under 32-bit Windows, but with fewer threads possible. On a non-x64 system, WOW64 incurs a performance overhead due to the software emulation involved.[12]

A 32-bit application can be given a full 4 gigabytes of virtual memory on a 64-bit system, whereas on a 32-bit system, some of this addressable memory is lost because it is used by the kernel and memory-mapped peripherals such as the display adaptor, typically resulting in apps being able to use either 2GB or 3GB of RAM at most.

See also

External links

Notes and References

  1. Web site: QuinnRadich . DCtheGeek . msatranjr . 2020-08-19 . WOW64 Implementation Details . 2023-04-16 . 2023-04-16 . https://web.archive.org/web/20230416160609/https://learn.microsoft.com/en-gb/windows/win32/winprog64/wow64-implementation-details . learn.microsoft.com.
  2. Web site: WOW64 Implementation Details . 2018-04-21 . Microsoft.
  3. Web site: Eckels . Stephen . WOW64!Hooks: WOW64 Subsystem Internals and Hooking Techniques . Mandiant . en . November 9, 2020.
  4. Web site: WOW64 Implementation Details (Windows) . 26 April 2010. https://web.archive.org/web/20100426210819/http://msdn.microsoft.com/en-us/library/aa384274(VS.85).aspx . 2010-04-26 .  - Earlier version of article, which shows Wow64cpu.dll as part of the IA-64 implementation.
  5. Web site: File System Redirector (Windows). msdn.microsoft.com. 2 February 2023 .
  6. Web site: winapi - SHGetFolderPath 32 bit vs 64 bit . Stack Overflow . en.
  7. Web site: Beneš . Petr . WoW64 internals: re-discovering Heaven's Gate on ARM . mindless-area (wbenny.github.io) . November 4, 2018.
  8. Web site: WOW64 bug: GetThreadContext may return stale contents. 2010-11-15. Saw. Zach. November 13, 2010. Zach Saw's Blog.
  9. Web site: WOW64 OS bug: Old 32-bit XP apps failing under Win7 WOW64. 2010-11-15. November 11, 2010. Microsoft Developer Network.
  10. Web site: Discussions about the Boehm Garbage Collector (Boehm GC).. 2010-11-25.
  11. Web site: GetThreadContext returns stale register values on WOW64. 2016-07-23. Microsoft= 2016-07-23.
  12. Web site: Performance and Memory Consumption Under WOW64. Microsoft . 2013-05-06.