简体   繁体   English

从32位应用程序检查时,Windows 10 bash.exe(Linux用户空间)不存在

[英]Windows 10 bash.exe (linux user space) does not exist when checked from 32 bit app

When 32bit app like java or python is trying to open c:\\windows\\system32\\bash.exe this file simply not found. 当像Java或Python这样的32位应用程序试图打开c:\\windows\\system32\\bash.exe根本找不到此文件。

How ever, it works perfectly if process ir 64bit. 但是,如果处理64位,它会完美工作。 I've created a simple C app to check how it works. 我创建了一个简单的C应用程序以检查其工作方式。

#include <stdio.h>
#include <windows.h>

int main(int argc, char *argv[]) {
char* path;
OFSTRUCT junk;

if (argc  != 2) {
 printf("provide path to file");
 return 1;
}
path = argv[1];
if( fopen( path, "r")) {
    printf("OK: Runtime reports file exists");
} else {
    printf("ERR: Runtime reports file does not exist");
}

printf("\n");
if (OpenFile(path, &junk,OF_EXIST) != HFILE_ERROR) {
    printf("OK: Win32API reports file exists");
} else {
    printf("ERR: Win32API reports file does not exist");
}

return 0;

} }

It reports OK/OK when compiled and linked as x64 and ERR/ERR when compiled as x86. 当编译并链接为x64时报告OK / OK,而编译为x86则报告ERR / ERR。 How could it be? 怎么会这样? Does there is some way to "hide" file from 32 bit apps in Windows? 是否有某种方法可以从Windows中的32位应用程序“隐藏”文件?

This is the file system redirector in action. 这是正在使用的文件系统重定向器

In most cases, whenever a 32-bit application attempts to access %windir%\\System32, the access is redirected to %windir%\\SysWOW64. 在大多数情况下,每当32位应用程序尝试访问%windir%\\ System32时,访问都会重定向到%windir%\\ SysWOW64。

So, your 32-bit application is looking for C:\\Windows\\SysWOW64\\bash.exe instead, which presumably doesn't exist. 因此,您的32位应用程序正在查找C:\\Windows\\SysWOW64\\bash.exe ,它可能不存在。

The recommended way to override it: 推荐的替代方法:

32-bit applications can access the native system directory by substituting %windir%\\Sysnative for %windir%\\System32. 通过将%windir%\\ Sysnative替换为%windir%\\ System32,32位应用程序可以访问本机系统目录。 WOW64 recognizes Sysnative as a special alias used to indicate that the file system should not redirect the access. WOW64将Sysnative识别为特殊别名,用于表示文件系统不应重定向访问。

Note that there are similar redirections for the registry as well. 请注意, 注册表也有类似的重定向。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows 10上64位进程的32位进程的GetModuleFileNameEx - GetModuleFileNameEx on 32bit process from 64bit process on windows 10 ShellExecute打印动词无法在64位Windows上从32位应用程序打印 - ShellExecute print verb fails to print from 32 bit app on 64 bit windows 将UWP应用提交到Windows 10 Store时,“ Windows 10 Team”选项是什么意思? - What does “Windows 10 Team” option mean when submitting a UWP app to Windows 10 Store? 有没有办法从Win32应用程序检测Windows 10中的Focus Assist(以前称为Quiet Hours)的更改 - Is there a way to detect changes in Focus Assist (formerly Quiet Hours) in Windows 10 from a Win32 App 从32位进程中枚举32位进程时,CreateToolhelp32Snapshot失败 - CreateToolhelp32Snapshot fails when enumerating a 32bit process from a 32 bit process 在64位Windows平台上运行32位Delphi应用程序时出现问题 - Problems running a 32-bit Delphi app on a 64-bit Windows platform 将32位和64位应用程序(使用相同的代码)编译到一个exe中 - Compile 32 bit and 64 bit application (with same code) into one exe 从Windows 10上的Win32 GUI应用程序输出到控制台 - Output to console from a Win32 GUI application on Windows 10 如何从32位代码启动64位的Windows进程? - How to launch a Windows process as 64-bit from 32-bit code? 从 32 位进程打开 %SystemRoot%\system32\calc.exe 会重定向到另一个文件。 哪个,为什么以及如何? - Opening %SystemRoot%\system32\calc.exe from a 32-bit process redirects to another file. Which, why and how?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM