Accessing files from System32 directory using 32 bit application on 64 bit machine

Problem:

I am trying to access few files from C:\Windows\System32\Winevt on Windows 7 – 64 bit machine through .net application.

When I build my application in 32 bit , I am not able to access this Winevt directory. It complians about directory not found.
But If I build my application in 64 bit mode, I am able to access this directory without any problem.

Do I have to do anything special to access this directory using 32 bit application on 64 bit machine?

Reason:

a computer that is running a 64-bit version of Windows Server 2003 or of Windows XP, a 32-bit application cannot access the following folder: %WinDir%\System32

This behavior occurs because Windows on Windows 64-bit (WOW64) provides file system redirection.
In a 64-bit version of Windows Server 2003 or of Windows XP, the %WinDir%\System32 folder is reserved for 64-bit applications. When a 32-bit application tries to access the System32 folder, access is redirected to the following folder:
%WinDir%\SysWOW64
By default, file system redirection is enabled.

Solution:

As a walk-around solution, 32-bit applications can access the native system directory by substituting %windir%\Sysnative for %windir%\System32. WOW64 recognizes Sysnative as a special alias used to indicate that the file system should not redirect the access.
So, if we want to access C:\Windows\System32\Winevt folder from 32-bit application, we can use C:\Windows\Sysnative\Winevt instead.

Social tagging: > > >

Leave a Reply