简体   繁体   English

卸载时未从 NSIS 安装程序调用 DLL 函数

[英]DLL Function is not calling from the NSIS installer when uninstalling

When uninstaling the software to do the complete cleanup calling the function in the C++ DLL .卸载软件以进行完整清理时调用 C++ DLL 中的函数。 To achieve this I am placing the DLL file in the temp directory.为此,我将 DLL 文件放在临时目录中。 Then in the Uninstall section calling the DLL function.然后在卸载部分调用 DLL 函数。 But it is not calling the function.但它没有调用该函数。

If I place that DLL file in the installed directory then it is calling the DLL function.如果我将该 DLL 文件放在安装目录中,则它正在调用 DLL 函数。 But I should not place it in the installed directory because I am calling this function when uninstalling.但是我不应该把它放在安装目录中,因为我在卸载时调用了这个函数。

Is it the correct way that I am doing?这是我正在做的正确方法吗? or is there any other way?或者还有其他方法吗?

Below is my code snippet:下面是我的代码片段:

Section "MyApp"

InitPluginsDir
SetOutPath $PluginsDir
File "C:\Desktop\KillNofificationSoftly.dll"
SetOutPath $Temp 
MessageBox MB_OK "Temp Path $Temp"
System::Call 'KERNEL32::AddDllDirectory(w "$PluginsDir")'

SetOutPath $INSTDIR  

SectionEnd

Section "Uninstall"

System::Call "$PluginsDir\KillNofificationSoftly.dll::KillMeSoftly() i.r0 ?e"
Pop $1 ; LastError
${If} $0 = 0
    MessageBox MB_OK "Success"
${EndIf}

SectionEnd

You are extracting the .DLL in the installer!您正在提取安装程序中的 .DLL! $PluginsDir is deleted when the installer finishes.安装程序完成$PluginsDir删除$PluginsDir Move all the code to the uninstaller section.将所有代码移至卸载程序部分。

If you are the author of this .DLL you should consider writing a NSIS plug-in, then it becomes just a single line of code, no need for System::Call .如果你是这个 .DLL 的作者,你应该考虑编写一个 NSIS 插件,然后它就变成了一行代码,不需要System::Call

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 卸载 NSIS 安装程序时如何更改位图图像 - How to change the bitmap image when uninstalling the NSIS installer 从NSIS调用.net dll - Calling .net dll from NSIS 在安装新版本之前卸载以前的安装程序时,如何使用NSIS隐藏从un.onInit弹出的消息框 - When Uninstalling the previous installer before installing the new how to hide the message box that is popping up from the un.onInit using NSIS 卸载时 NSIS 不删除文件 - NSIS not deleting files when uninstalling 卸载时需要从NSIS安装程序的计划任务中删除任务 - Need to remove tasks from Scheduled Tasks from NSIS installer while uninstalling 使用NSIS卸载以前的Wix安装程序时,将花费更长的时间,并且应用程序标题栏显示“ Not Responding” - When Uninstalling the previous Wix installer using NSIS it is taking longer time and the application title bar is showing “Not Responding” NSIS功能 - 退出安装程序 - NSIS Function - quit installer 从 NSIS 脚本调用 C++ dll 方法时如何使用 System::Call 和 MessageBox - How to use System::Call and MessageBox when calling the C++ dll method from the NSIS script 调用IPGlobalProperties.GetIPGlobalProperties()时,从NSIS脚本加载DLL时出错。 - Error loading DLL from NSIS script when calling to IPGlobalProperties.GetIPGlobalProperties() NSIS:使用带空格的绝对路径调用 DLL function - NSIS: calling DLL function with System::Call using absolute path with blanks
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM