【Windows】Program Files和Program Files (x86)的区别

On 64-bit Windows, 32-bit programs run in an emulation layer, and if you don’t like that, then don’t use the emulator

在64位Windows上,32位程序在仿真层中运行,如果您不喜欢这样做,则不要使用仿真器

Raymond

雷蒙德

December 22nd, 2008

2008年12月22日

On 64-bit Windows, 32-bit programs run in an emulation layer. This emulation layer simulates the x86 architecture, virtualizing the CPU, the file system, the registry, the environment variables, the system information functions, all that stuff. If a 32-bit program tries to look at the system, it will see a 32-bit system. For example, if the program calls the GetSystemInfo function to see what processor is running, it will be told that it’s running on a 32-bit processor, with a 32-bit address space, in a world with a 32-bit sky and 32-bit birds in the 32-bit trees.

在64位Windows上,32位程序在仿真层中运行。该仿真层模拟x86架构,虚拟化CPU,文件系统,注册表,环境变量,系统信息功能以及所有这些东西。如果32位程序试图查看系统,它将看到32位系统。例如,如果程序调用该GetSystemInfo函数以查看正在运行的处理器,则会被告知它正在32位处理器上运行,该32位处理器具有32位地址空间,在32位天空和32位环境中32位树中的小鸟。

And that’s the point of the emulation: To keep the 32-bit program happy by simulating a 32-bit execution environment.

这就是仿真的重点:通过模拟32位执行环境使32位程序满意。

Commenter Koro is writing an installer in the form of a 32-bit program that detects that it’s running on a 64-bit system and wants to copy files (and presumably set registry entries and do other installery things) into the 64-bit directories, but the emulation layer redirects the operations into the 32-bit locations. The question is “What is the way of finding the x64 Program Files directory from a 32-bit application?”

评论员科罗正在以32位程序的形式编写安装程序,该程序检测到它正在64位系统上运行,并希望将文件(并可能设置注册表项并执行其他安装工作)复制到64位目录中,但是仿真层将操作重定向到32位位置。问题是“从32位应用程序中查找x64程序文件目录的方式是什么?”

The answer is “It is better to work with the system than against it.” If you’re a 32-bit program, then you’re going to be fighting against the emulator each time you try to interact with the outside world. Instead, just recompile your installer as a 64-bit program. Have the 32-bit installer detect that it’s running on a 64-bit system and launch the 64-bit installer instead. The 64-bit installer will not run in the 32-bit emulation layer, so when it tries to copy a file or update a registry key, it will see the real 64-bit file system and the real 64-bit registry.

答案是“与系统配合使用比与系统配合使用更好。”如果您使用的是32位程序,则每次尝试与外界进行交互时,您都将与模拟器进行对抗。相反,只需将安装程序重新编译为64位程序。让32位安装程序检测到它正在64位系统上运行,然后启动64位安装程序。64位安装程序将不会在32位仿真层中运行,因此,当它尝试复制文件或更新注册表项时,它将看到真正的64位文件系统和真正的64位注册表。

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值