I'm developing a library for obtaining information from files in the portable executable format.
It is important for me that the library works in both 32-bit and 64-bit modes.
During testing, I used hard paths for example: L"C:\Windows\System32\ntoskrnl.exe" to display a list of exported functions.
In Windows 10, I discovered that in administrator mode, my 32-bit application returns error code 2 (ERROR_FILE_NOT_FOUND) when trying to open an existing file, while the 64-bit application successfully opens this file.
In Windows 7 on another computer, both applications successfully open this file.
In addition, I discovered that many applications on Windows 10, in particular Total Commander, winhex, x32dbg, ollydbg, do not see many files in the System32 folder.
I can read them from disk by jumping around the file system, is there any easier way?
As mentioned by Mark Rotteveel the Windows on Windows 64 (WOW64) performs automatic redirection of certain file system (e.g. C:\Windows\System32, C:\Program Files) directories and registry keys (e.g. HKLM\Software, HKCU\Software) for 32-bit programs running on 64-bit systems.
The file system redirection can be turned off by calling Wow64DisableWow64FsRedirection and then re-enabled with Wow64RevertWow64FsRedirection
For the registry there is a flag (KEY_WOW64_32KEY) in the RegOpenKeyEx function to see the 32-bit view of the registry.