1
私はInno Setupスクリプトで作業していますが、アンインストール中にカスタムDLLを呼び出して復帰操作を行います。残念ながら、UnloadDLLとDeleteFileを呼び出したにもかかわらず、アンインストールが完了してDLLが終了し、その依存関係は削除されませんでした。 UnloadDLLが失敗するのはなぜですか? LoadLibraryでDLLダイナミックをロードする可能性はありますか?私はこれに関するいくつかの機能を見てきましたが、それらはすべて廃止されました。Inno Setup:アンインストール時にUnloadDLLが動作しない
は、ここでは、コードです:
function Revert(param: String): cardinal;
external '[email protected]{app}\Revert.dll cdecl delayload uninstallonly';
procedure RevertAll();
var
param: String;
dataDirectory: String;
temp: String;
i: Integer;
begin
dataDirectory := ExpandConstant('{commonappdata}\MyAppData');
StringChangeEx(dataDirectory, '\', '\\', True);
param := '{"dataDirectory": "' + dataDirectory + '", "registryPath" : "SOFTWARE\\MyReg\\Key"}';
Revert(param);
temp := ExpandConstant('{app}\Revert.dll');
for i := 0 to 10 do
begin
UnloadDLL(temp);
Sleep(500);
if DeleteFile(temp) then
break;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if (CurUninstallStep = usUninstall) then
begin
RevertAll();
end
end;
を '何を返しDeleteFile'ん? –
falseを返します。 – dJonzo
ちょっとした注意: 'StringChangeEx(dataDirectory、 '\'、 '\\'、True);'はちょっと危険です。 "\\"がすでに 'dataDirectory'に存在する場合、結果は" \\\\ "になります! –