[英]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.