mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2025-12-22 09:29:50 +00:00
added new inno setup config
This commit is contained in:
40
DnsServerWindowsSetup/helper.iss
Normal file
40
DnsServerWindowsSetup/helper.iss
Normal file
@@ -0,0 +1,40 @@
|
||||
[Code]
|
||||
{
|
||||
Helper functions
|
||||
}
|
||||
|
||||
{
|
||||
Checks to see if the installer is an 'upgrade'
|
||||
}
|
||||
function IsUpgrade: Boolean;
|
||||
var
|
||||
Value: string;
|
||||
UninstallKey: string;
|
||||
begin
|
||||
UninstallKey := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' +
|
||||
ExpandConstant('{#SetupSetting("AppId")}') + '_is1';
|
||||
Result := (RegQueryStringValue(HKLM, UninstallKey, 'UninstallString', Value) or
|
||||
RegQueryStringValue(HKCU, UninstallKey, 'UninstallString', Value)) and (Value <> '');
|
||||
end;
|
||||
|
||||
{
|
||||
Kills a running program by its filename
|
||||
}
|
||||
procedure TaskKill(fileName: String);
|
||||
var
|
||||
ResultCode: Integer;
|
||||
begin
|
||||
Exec(ExpandConstant('taskkill.exe'), '/f /im ' + '"' + fileName + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
|
||||
end;
|
||||
|
||||
|
||||
{
|
||||
Executes the MSI Uninstall by GUID functionality
|
||||
}
|
||||
function MsiExecUnins(appId: String): Integer;
|
||||
var
|
||||
ResultCode: Integer;
|
||||
begin
|
||||
ShellExec('', 'msiexec.exe', '/x ' + appId + ' /norestart /qb', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
|
||||
Result := ResultCode;
|
||||
end;
|
||||
Reference in New Issue
Block a user