Listing c:\windows\system32 Files in LabVIEW Yields Only a Few Results

Updated Aug 18, 2023

Reported In

Software

  • LabVIEW

Operating System

  • Windows

Issue Details

I am trying to list files in c:\windows\system32\drivers. Listing the folder using LabVIEW's List Folder function only yields very few results. How can I fix this?

Solution

This behavior happens because Windows automatically substitutes paths. In this case it occurs because
Windows 64-bit redirects %WinDir%\system32 to a different folder, whenever a 32-bit application tries to access it. See this external link for more information: File System Redirector - Microsoft Docs

Windows stores files and drivers for its native bitness in the %WinDir%\system32 directory. On Windows 64-bit, this directory is reserved for 64-bit applications. In case a 32-bit x86 application tries to access %WinDir%\system32, it gets redirected to %WinDir%\SysWOW64 instead.

If you want access to the 64-bit %WinDir%\system32 using a 32-bit application on Windows 64-bit, use these directories C:\Windows\Sysnative or %WinDir%\Sysnative instead:

Additional Information

Using LabVIEW 64-bit you can access the 64-bit directory %WinDir%/system32 directly.

In case you need programmatic access to %WinDir%/system32 on an older 64-bit version of Windows (e.g. 2003), you need to apply a hotfix by Microsoft first to make this path available: External link: A 32-bit application cannot access the system32 folder on a computer that is running a 64-bit version of Windows Server 2003 or of Windows XP.

Note: WOW64 stands for "Windows on Windows64". WOW64 is the compatibility layer that enables 64-bit Windows to run 32-bit applications.