将 32 位路径转换为其 WOW64 等效路径
我可以在 32 位应用程序中调用任何函数来将它认为正在使用的路径转换为它实际使用的路径吗? (例如,调用它将 Program Files 中的文件夹路径转换为 Program Files (x86) 中的路径,或者在 64 位系统上运行时反之亦然。)我需要这样做,以便当用户当在 GUI 中显示一个目录时(如浏览文件或目录时),他看到的是真实的目录,而不是应用程序本身认为它看到的目录。
我们需要同时支持 32 位和 64 位 Windows,因此这应该可以在这两种环境中工作。
编辑 处理WOW64的需要在于我的应用程序是安装程序的引导应用程序。 默认情况下,该产品在 32 位系统上安装在 Program Files 下,而在 64 位系统上,它安装在 Program Files (x86) 下。 让用户选择安装产品的位置(包括完全不同的硬盘驱动器,如果这是他想要或需要的)的对话; 并且它必须在两种环境下都能正常工作。 目前,即使在 64 位系统上,它也始终显示(并浏览)程序文件。
Is there any function that I can call to in a 32-bit app that would convert the paths that it thinks it's using to and from the paths that it's actually using? (For instance, call it to convert the path for a folder in Program Files to a path in Program Files (x86) or vice versa when running on a 64-bit system.) I need to do this so that, when the user is presented with a directory in the GUI (as when browsing for files or directories), he sees the real directory, rather than what the app itself thinks it sees.
We need to support both 32- and 64-bit Windows, so this should work in both environments.
Edit The need to deal with WOW64 lies in the fact that my app is the bootstrap application of an installer. By default, the product is installed under Program Files on a 32-bit system, while on a 64-bit system, it's installed under Program Files (x86). The dialogue that lets the user choose where to install the product (including on a different hard drive altogether if that's what he wants or needs); and it must work properly in both environments. Currently, it's always displaying (and browsing in) Program Files, even on 64-bit systems.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
浏览 Program Files 和 Windows\System32 是您的应用程序的用例吗? 我鼓励您放弃解决这个问题,因为它变得非常难看。 要么完全留在 32 位世界,要么重新编译为 x64。 生活在 WOW64 的“中间”世界将使您的代码变得更加复杂。
如果您确实想这样做,http://msdn .microsoft.com/en-us/library/aa365743(VS.85).aspx 就可以了。
Is browsing through Program Files and Windows\System32 a use-case for your app? I encourage you to abandon solving this problem, as it gets really ugly. Either stay all in the 32-bit world, or recompile for x64. Living in the "in-between" world of WOW64 will make your code much more complex.
If you really want to do this, http://msdn.microsoft.com/en-us/library/aa365743(VS.85).aspx will do the trick.
这里我有一个禁用 wow64 重定向的工作示例:
最好的问候
Here I have a working sample of disablig wow64 redirection:
Best regards