我的目标是在[UninstallRun]中读取注册表项。
问题是,如果Inno Setup在安装过程中运行,则在此处调用函数GetRegistryVar()?应该在UnInstall进程运行时调用它。如果我启动UnInstall进程,函数GetRegistryVar()将不会在这里调用?只有CurUninstallStepChanged()和PGetRegistryVal()。所以我无法接收全局变量gStrPrnName?
[UninstallRun]
Filename: "{#dInst64bitDir}\{#dUnInstDrvExeName}"; Parameters: "-f {code:GetGlobalRegistryVar}"; WorkingDir: "{#dInst64bitDir}"; Flags: runhidden runascurrentuser;
[Code]
var
gStrPrnName: string;
function GetGlobalRegistryVar(Value: string): string;
begin
Result := gStrPrnName;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
case CurUninstallStep of
usUninstall:
begin
// ...insert code to perform pre-uninstall tasks here...
PGetRegistryVal(gStrPrnName);
end;
usPostUninstall:
begin
// ...insert code to perform post-uninstall tasks here...
end;
end;
end;
function PGetRegistryVal(Value: String): String;
var
strPrnName: string;
i: Integer;
begin
for i:=0 to 2 do
begin
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\GetDevice_1', 'Name', strPrnName) then
Result := strPrnName;
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\GetDevice_2', 'Name', strPrnName) then
Result := strPrnName;
...
end;
end;
有人为这个问题找到解决方案吗?
由于