When I uninstall the program I get this error:
Cannot import dll: <utf8>c:\TestProg\IsStart.dll
What have I done wrong here? Can anybody help me to solve this problem?
CheckO4TaskMngrSvcStopAndUninstall
stops and deletes the O4TaskManager Service
:
Here's the code:
[Files]
Source: "IsStartServer.dll"; DestDir: "{tmp}"; DestName: IsStart.dll
Source: "IsStartServer.dll"; DestDir: "{app}"; DestName: IsStart.dll
Source: "sqlite3x86.dll"; DestDir: "{src}"; DestName: sqlite3.dll
Source: "sqlite3x86.dll"; DestDir: "{app}"; DestName: sqlite3.dll
Source: "sqlite3x64.dll"; DestDir: "{app}"
[Code]
function TaskMngrInst: LongBool;
external 'CheckO4TaskMngrSvcStopAndUninstall@files:IsStart.dll,sqlite3.dll stdcall loadwithalteredsearchpath setuponly';
function TaskMngrUninst: LongBool;
external 'CheckO4TaskMngrSvcStopAndUninstall@{app}\IsStart.dll stdcall uninstallonly';
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
TaskMngrInst();
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usUninstall then
begin
TaskMngrUninst();
DeleteFile(ExpandConstant('{app}\sqlite3.dll'));
DeleteFile(ExpandConstant('{app}\IsStart.dll'));
RenameFile('{app}\sqlite3x64.dll)', '{app}\sqlite3.dll');
end;
end;
I believe there was series of different problems (some of which were indeed based on my wrong suggestions).
The correct code is, imo:
[Files]
Source: "IsStartServer.dll"; DestDir: "{app}"; DestName: IsStart.dll
Source: "sqlite3x86.dll"; DestDir: "{app}"; DestName: sqlite3.dll
[Code]
function TaskMngrInst: LongBool;
external 'CheckO4TaskMngrSvcStopAndUninstall@files:IsStart.dll,sqlite3.dll stdcall loadwithalteredsearchpath setuponly';
function TaskMngrUninst: LongBool;
external 'CheckO4TaskMngrSvcStopAndUninstall@{app}\IsStart.dll stdcall loadwithalteredsearchpath uninstallonly';
The key points:
loadwithalteredsearchpath
flag in the import declaration for the uninstaller. You need it to load the dependencies (sqlite3.dll
).sqlite3.dll
) to the {app}
for the use by the uninstaller.sqlite3.dll
, not sqlite3x86.dll
).external
declaration has to match the destination filename (DestName: IsStart.dll
, DestName: sqlite3.dll
), not the original one.files:
prefix). Not when loading the DLL from a physical path ({app}\IsStart.dll
). The sole purpose for listing the dependency is for the installer to extract it (it does not load it, the primary DLL does, hence the the previous point). You do not need to list it, when loading physical files, as all files are (must be) installed already. If you use {app}\primary.dll,{app}\dependency.dll
, the uninstaller will actually try to load a file with a name {app}\primary.dll,{app}\dependency.dll
– obviously failing.{tmp}
nor {src}
.