首页 文章

NSIS卸载程序不运行un.onInit

提问于
浏览
1

在我的.nsi文件中,我在 un.onInit 函数中有以下逻辑:

Function un.onInit

  MessageBox MB_YESNO "This will uninstall. Continue?" IDYES checkRunning
  checkRunning:
    FindProcDLL::FindProc "app.exe"
    IntCmp $R0 1 0 notRunning
    MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "${PRODUCT} is running, please close it so the installation can proceed." /SD IDCANCEL IDRETRY checkRunning
    Abort

  notRunning:
    !insertmacro Init "uninstaller"
FunctionEnd

但是,从不显示messageBox(以及进程正在运行的消息) . 所以我经历了很多文档,显然运行静默模式会阻止调用此方法,因此我将 SilentInstall normalSilentUnInstall normal 添加到.nsi文件中 . 但是,这也不起作用 .

我尝试通过手动转到uninstall.exe并运行安装程序来调用卸载程序,该安装程序检查是否已安装版本以及是否有调用:

uninst:
    ClearErrors
    ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
    ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}" "UninstallString"
    StrCmp $R0 "" done
    Abort

然而,这两种调用都不会触发“正常”模式 . 那么如何才能调用我的un.onInit函数呢?

编辑:

有人要求提供整个文件,here it is . 我只复制了相关部分,但如果需要更多,请随时查看 . 请注意,整个文件已经很老了,我只是更新它 .

1 回答

  • 0

    在升级MUI2(现代用户界面2.0),降级到NSIS 2.5并使用NsProcess插件后,我得到了它的工作 . 现在正在调用该函数,我的检查使用新插件 . FindProcDLL插件在NSIS> 2.46上被破坏

相关问题