从 WOW64 启动 Shell Links (LNK) [英] Launching Shell Links (LNKs) from WOW64

查看:29
本文介绍了从 WOW64 启动 Shell Links (LNK)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的 32 位应用程序通过 ShellExecute 启动 Windows LNK 文件(Shell Links).当它尝试启动"指向 64 位二进制文​​件的链接(例如开始"菜单中的Internet Explorer(64 位)"快捷方式)时,它总是最终启动 32 位二进制文​​件.在内部,ShellExecute 错误地解析链接目标:LNK 中有一个隐藏字段,用于保存 FOLDERID_ProgramFiles.64 位应用将此解析到 64 位 Program Files 目录,但 32 位应用不会.

Our 32-Bit application launches Windows LNK files (Shell Links) via ShellExecute. When it tries to "launch" a link to a 64-Bit binary (such as the "Internet Explorer (64-Bit)" shortcut in Start Menu) it always ends up launching the 32-Bit binary. Internally, ShellExecute incorrectly resolves the link target: There's a hidden field inside the LNK which holds FOLDERID_ProgramFiles. A 64-Bit app resolves this to the 64-Bit Program Files directory, but a 32-Bit app won't.

Wow64DisableWow64FsRedirection 不会改变 ShellExecute 的这种行为.

Wow64DisableWow64FsRedirection does not change this behavior of ShellExecute.

除了经历 64 位蹦床"过程(由于我们的插件架构的工作方式,这不是一个选项),32 位应用程序是否有任何方法可以完全像 64 位应用程序一样启动 shell 链接应用会吗?

Besides going through a 64-Bit "trampoline" process (which is not an option due to how our plugin architecture works), Is there any way for a 32-Bit app to launch shell links exactly the way a 64-Bit app would?

推荐答案

Andrew:我试了一下,sysnative 文件夹没有做任何 Wow64DisableWow64FsRedirection 没有做的事情.问题是 ShellExecute 错误地假设链接指向 %programfiles(x86)%,而实际上它指向 %programfiles%(即使 %programfiles(x86)% 中没有这样的文件).

Andrew: I gave it a shot, and the sysnative folder does not do anything that Wow64DisableWow64FsRedirection doesn't already do. The problem is that ShellExecute mistakenly assumes that the link is pointing to %programfiles(x86)%, when it is in fact pointing to %programfiles% (Even when there is no such file in %programfiles(x86)%).

打开 64 位程序已经可以正常工作了.问题是指向 %programfiles% 目录的 .lnk 文件.

Opening 64bit programs already works perfectly fine. It's .lnk files pointing to the %programfiles% directory that are the problem.

这篇关于从 WOW64 启动 Shell Links (LNK)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆