SHGetSpecialFolderPath,如何从 32 位应用程序访问 64 位 CSIDL
有没有办法让在 64 位系统上运行的 32 位应用程序访问 64 位应用程序的默认文件夹?
例如,在 32 位应用程序中使用带有 CSIDL_PROGRAM_FILES 的 SHGetSpecialFolderPath 将返回“C:\Program Files (x86)”。如果从 64 位应用程序使用相同的调用,我将得到“C:\Program Files”。有没有办法获取来自 32 位应用程序的“C:\Program Files”?
此处的相关问题没有帮助 SHGetFolderPath() 32 位与 64 位在调用 SHGetSpecialFolderPath 之前也不会抑制 wow64 文件系统重定向
Is there a way from a 32bit application running on a 64bit system to have access to the default folders for 64bit applications?
For example, using SHGetSpecialFolderPath with CSIDL_PROGRAM_FILES from a 32bit application returns "C:\Program Files (x86)' If the same call was used from a 64bit application, I would get "C:\Program Files". Is there a way of getting that "C:\Program Files" from a 32bit application?
A related question here does not help SHGetFolderPath() 32 bit vs 64 bit nor does supressing the wow64 filesystem redirection before calling SHGetSpecialFolderPath
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
回答我自己的问题,似乎 SHGetSpecialFolderPath 是不可能的。在 Vista 及更高版本中,使用替换函数 SHGetKnownFolderPath 允许使用 FOLDERID_ProgramFilesX64
Answering my own question, it seems it is not possible with SHGetSpecialFolderPath. In Vista and later, using the replacement function SHGetKnownFolderPath allows it with FOLDERID_ProgramFilesX64
我相信拥有单独文件夹的全部原因是为了防止 32 位和 64 位应用程序混合。因此,您不需要看到属于与您的应用程序不同位数的文件夹。
您可能有一个很好的理由,但我在您发布的问题中没有看到任何理由。
I believe the whole reason for having separate folders was to prevent 32 and 64 bit applications from mixing. Therefore, you shouldn't need to see a folder belonging to a different bitness from your application.
You may have a very good reason, but I don't see one in your question as posted.