The 'Sysnative' folder in 64-bit Windows explained
In this article we explained that in a 64-bit Windows the System32 folder is intended for 64-bit binary files (DLL files etc.) and the SysWOW64 folder is intended for 32-bit binary files. In the article we also explained that if a 32-bit application includes the "\System32" folder name in a folder path, the system automatically makes a redirection to the SysWOW64 folder. This is to prevent compatibility problems when applications are compiled to 64-bit executables.
But if a 32-bit application really needs access to the 64-bit System32 folder in a 64-bit Windows; is it possible? The answer is yes, it is possible, and in this article we will show you how this can be done.
The 'Sysnative' folder
As explained above, accessing the 64-bit System32 folder from a 32-bit application by simply inserting "\System32" in the folder path is not possible. A redirection to the SysWOW64 folder is made automatically by the system if you try that. But there is another folder name that can be used instead: Sysnative.
Sysnative is a virtual folder, a special alias, that can be used to access the 64-bit System32 folder from a 32-bit application or script. If you for example specify this folder path in your application's source code:
the following folder path is actually used:
The 'Sysnative' folder is invisible in Windows Explorer
If you start Windows Explorer and open the Windows folder on your hard disk, you may notice that the Sysnative folder is not shown. The main reason to this is that Windows Explorer is a 64-bit program (when run in a 64-bit Windows), and the Sysnative folder is only visible and accessible from 32-bit software. If 64-bit software need access to the 64-bit system folder in Windows, the only option is to use the System32 folder name (for example: C:\Windows\System32).
Using the 'Sysnative' folder will help you access 64-bit tools from 32-bit code
Some tools in a 64-bit Windows only exist in a 64-bit version; there is no 32-bit version available. And some of these tools are located in the 64-bit System32 folder. One example is the nbtstat tool that is used to help troubleshoot NetBIOS name resolution problems. If you try to run the nbtstat tool from 32-bit code (for example from an application or from script) and use a path like C:\Windows\System32, you will get a "File not found" error. The file can not be found; although Windows Explorer shows that the nbtstat program file actually is located in the C:\Windows\System32 folder.
The solution to this (somewhat confusing) problem is to include the virtual Sysnative folder in the folder path when you want to run the tool. For example like this:
The file path above will give you access to the 64-bit nbtstat tool from a 32-bit application or from a 32-bit script. We recommend you to read this article / blog post (at Scottie’s Tech.Info) to get more details about this.
Supported by Windows Vista and later
The virtual Sysnative folder is supported by Windows Vista and later. So it works also with Windows 7 and Windows 8, but not with Windows XP (unless a special hotfix from Microsoft is installed). The Sysnative folder is also available on Windows Server 2008 and Windows Server 2012.
The Sysnative folder is only available in a 64-bit Windows. A 32-bit Windows does not have any Sysnative folder. Instead, accessing files in the 32-bit system folder is very easy and intuitive; the System32 folder name can be used in the folder path, for example: C:\Windows\System32.
We recommend you to also read this article on Microsoft's website:
Windows Dev Center: File System Redirector
SamLogic Visual Installer
More articles are available from the article index page.
|Article written by: Mika Larramo|