WOW64:从32位进程中获取x64%common Programfiles%
题
我尝试的查询: ExpandEnvironmentStrings("%COMMONPROGRAMFILES%")
, GetSpecialPath(CSIDL_PROGRAM_FILES_COMMON)
.
所有人都解析为(通常) c:\\Program Files (x86)\\Common Files
来自我的32位应用程序。我需要检查(通常是) c:\\Program Files\\Common Files
64位申请。
解决方案
在64位操作系统上,programw6432环境变量指向c: program文件。英文版本的Windows上的32位应用程序的完整列表:
- programFiles => c: program文件(x86)
- programFiles(x86)=> c: program文件(x86)
- programw6432 => c: program文件
- communprogramfiles => c: program文件(x86) common文件
- communprogramfiles(x86)=> c: program文件(x86) common文件
- communprogramw6432 => c: program文件普通文件
只是一个提醒:该文件夹不应包含32位程序感兴趣的任何内容。从技术上讲。当心文件系统重定向器,它将从C: Program Files将文件请求重定向到C: Program Files(X86)。如果您实际上想访问该目录中的文件,则必须使用WOW64DisableWow64fSredirection()。
其他提示
%common Programw6432%
static string ProgramFilesx86()
{
if (8 == IntPtr.Size
|| (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))
{
return Environment.GetEnvironmentVariable("ProgramFiles(x86)");
}
return Environment.GetEnvironmentVariable("ProgramFiles");
}
这是您需要的吗?
不隶属于 StackOverflow