首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在NSIS脚本中是否有替代InvokeShellVerb的方法?

在NSIS脚本中是否有替代InvokeShellVerb的方法?
EN

Stack Overflow用户
提问于 2016-06-29 07:27:56
回答 1查看 212关注 0票数 0

我想在windows 10中插入任务栏的快捷方式。脚本工作正常,但我的实用程序被检测为恶意程序特洛伊木马。微软已经删除了这个动词,这可能是原因之一。那么,是否有任何其他方法可以通过编程来锁定/解锁任何程序。

代码语言:javascript
复制
    OutFile "C:\PinUnpinExe\PinUnpinShortcut.exe"

!include 'StdUtils.nsh'
!include FileFunc.nsh

SilentInstall silent
RequestExecutionLevel user ;no elevation needed
ShowInstDetails hide

var inputParam
Section
    ${GetParameters} $inputParam
    System::Call "kernel32::GetCurrentDirectory(i ${NSIS_MAX_STRLEN}, t .r0)"
    ${StdUtils.InvokeShellVerb} $0 "$0" "abc.exe" $inputParam
SectionEnd

这一行被检测为病毒。

代码语言:javascript
复制
 ${StdUtils.InvokeShellVerb} $0 "$0" "abc.exe" $inputParam

我对其他语言解决方案也很满意。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-06-29 11:33:01

不要以编程的方式插入快捷键,任务栏是用户来放置他们最喜欢的图标!

要解锁您可以这样做(NSIS 3+):

代码语言:javascript
复制
!include "LogicLib.nsh"
!include "Win\COM.nsh"

!macro UnpinShortcut lnkpath
Push $0
Push $1
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_StartMenuPin} ${IID_IStartMenuPinnedList} r0 ""
${If} $0 P<> 0
    System::Call 'SHELL32::SHCreateItemFromParsingName(ws, p0, g "${IID_IShellItem}", *p0r1)' "${lnkpath}"
    ${If} $1 P<> 0
        ${IStartMenuPinnedList::RemoveFromList} $0 '(r1)'
        ${IUnknown::Release} $1 ""
    ${EndIf}
    ${IUnknown::Release} $0 ""
${EndIf}
Pop $1
Pop $0
!macroend

Section Uninstall
!insertmacro UnpinShortcut "$SMPrograms\MyApp.lnk"
SectionEnd
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38093044

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档