[英]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.