提交develop版本汉王app的windows打包脚本

This commit is contained in:
yangjiaxuan 2023-06-02 15:01:02 +08:00
parent bbafa2ea49
commit 31c1b49402
1 changed files with 337 additions and 0 deletions

View File

@ -0,0 +1,337 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "汉王扫描软件"
#define MyAppVersion GetFileVersion('..\..\x64\OEM\hanvon\sane.dll')
#define MyAppSetupName "HanvonScan_App_Setup"
#define MyAppDefSetupDir "HanvonScan"
#define MyAppPublisher "汉王科技股份有限公司"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{4486975C-CBCF-430B-BED1-427866D1738E}
AppName={#MyAppName}
AppVerName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName={pf}\{#MyAppDefSetupDir}
DefaultGroupName={#MyAppName}
VersionInfoVersion={#MyAppVersion}
OutputDir=..\..\package
OutputBaseFilename={#MyAppSetupName}_{#MyAppVersion} Compression=lzma
AppPublisher={#MyAppPublisher} SolidCompression=no
UninstallIconFile=uninstall.ico
SetupIconFile=HanvonScan_App.ico
LicenseFile=HanvonScan_App_License.txt
AlwaysShowComponentsList=true
ArchitecturesInstallIn64BitMode=x64
PrivilegesRequired=admin
DisableWelcomePage=no
[Languages]
Name: "zn"; MessagesFile: "compiler:Languages/ChineseSimp.isl"
[Components]
;Name: "Upgrade"; Description: "在线升级功能" ; Types: Full
Name: "Twain1000"; Description: "Hanvon HW-1000NS" ; Types: Full
Name: "Twain1002"; Description: "Hanvon HW-1000" ; Types: Full
Name: "Twain7000"; Description: "Hanvon HW-7000NS" ; Types: Full
Name: "Twain7002"; Description: "Hanvon HW-7000" ; Types: Full
Name: "Twain7039"; Description: "Hanvon HW-7039NS" ; Types: Full
Name: "Twain8000"; Description: "Hanvon HW-8000" ; Types: Full
Name: "Twain9000"; Description: "Hanvon HW-9000" ; Types: Full
[Files]
; app
Source: ".\HanvonScan_App.ico"; DestDir: "{app}\"; Flags: ignoreversion
Source: "..\..\..\..\code_app\doc\scanner\HanvonScan_App_Help_manual.pdf"; DestDir: "{app}\"; Flags: ignoreversion
Source: "..\..\..\..\code_app\doc\scanner\HanvonScan_scanSettings_Help_manual.pdf"; DestDir: "{app}\"; Flags: ignoreversion
; app32
Source: "..\..\x86\Release\HWTwainUI.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\HWTwainUser.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\hwusbdev.key"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\tessdata\*"; DestDir: "{app}\tessdata\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Qt\iconengines\*"; DestDir: "{app}\iconengines\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Qt\imageformats\*"; DestDir: "{app}\imageformats\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Qt\platforms\*"; DestDir: "{app}\platforms\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Qt\styles\*"; DestDir: "{app}\styles\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Qt\translations\*"; DestDir: "{app}\translations\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Qt\*.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\HanvonScan2.exe"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
;Source: "..\..\x86\Release\HWUpgradeApp.exe"; DestDir: "{app}\"; Flags: ignoreversion; Components: Upgrade; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\cnocr.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\doc_seg.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\ExportFile.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\FormEx.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\GetPdf.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\GetRtf.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\GetXls.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\hanwangOCRdetect.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\hasp_windows_113819.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\HWBase.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\HWImgFmt.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\HWImgProc.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
;Source: "..\..\x86\Release\HWVersion.dll"; DestDir: "{app}\"; Flags: ignoreversion; Components: Upgrade; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\HwOcrSdk.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\libmupdf.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\libzip.org.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\mp30.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\ofd.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\pdflib.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\PDFParse.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\tinyxml2.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\msvcp140.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\vcruntime140.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\concrt140.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\Release\zlib.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\OEM\hanvon\sane.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\OEM\hanvon\scanner.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x86\OEM\hanvon\lang.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\..\lang\*"; DestDir: "{app}\lang\"; Flags: ignoreversion; Check: not Is64BitInstallMode
; app64
Source: "..\..\x64\Release\HWTwainUI.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\HWTwainUser.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\TWAINDSM.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\hwusbdev.key"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\tessdata\*"; DestDir: "{app}\tessdata\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Qt\iconengines\*"; DestDir: "{app}\iconengines\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Qt\imageformats\*"; DestDir: "{app}\imageformats\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Qt\platforms\*"; DestDir: "{app}\platforms\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Qt\styles\*"; DestDir: "{app}\styles\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Qt\translations\*"; DestDir: "{app}\translations\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Qt\*.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\HanvonScan2.exe"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
;Source: "..\..\x64\Release\HWUpgradeApp.exe"; DestDir: "{app}\"; Flags: ignoreversion; Components: Upgrade; Check: Is64BitInstallMode
Source: "..\..\x64\Release\cnocr.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\doc_seg.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\ExportFile.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\FormEx.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\GetPdf.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\GetRtf.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\GetXls.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\hanwangOCRdetect.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\hasp_windows_x64_113819.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\HWBase.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\HWImgFmt.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\HWImgProc.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
;Source: "..\..\x64\Release\HWVersion.dll"; DestDir: "{app}\"; Flags: ignoreversion; Components: Upgrade; Check: Is64BitInstallMode
Source: "..\..\x64\Release\HwOcrSdk.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\libmupdf.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\libzip.org.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\mp30.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\ofd.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\pdflib.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\PDFParse.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\tinyxml2.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\msvcp140.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\vcruntime140.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\vcruntime140_1.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\concrt140.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\Release\zlib.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\OEM\hanvon\sane.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\OEM\hanvon\scanner.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x64\OEM\hanvon\lang.dll"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\..\lang\*"; DestDir: "{app}\lang\"; Flags: ignoreversion; Check: Is64BitInstallMode
; twain32
Source: "..\..\x86\Release\HWTwainUI.dll"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\..\..\code_app\doc\scanner\HanvonScan_scanSettings_Help_manual.pdf"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x86\Release\msvcp140.dll"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x86\Release\vcruntime140.dll"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x86\Release\concrt140.dll"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x86\OEM\hanvon\sane.dll"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x86\OEM\hanvon\scanner.dll"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x86\OEM\hanvon\lang.dll"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\..\lang\*"; DestDir: "{win}\twain_32\HanvonTwain\lang\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x86\Release\HWBase.dll"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x86\Release\HWImgFmt.dll"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x86\Release\HWImgProc.dll"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x86\Release\HWVersion.dll"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x86\Release\tessdata\*"; DestDir: "{win}\twain_32\HanvonTwain\tessdata\"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "..\..\x86\OEM\hanvon\hanvontwain1000.ds"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Components: Twain1000;
Source: "..\..\x86\OEM\hanvon\hanvontwain1002.ds"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Components: Twain1002;
Source: "..\..\x86\OEM\hanvon\hanvontwain7000.ds"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Components: Twain7000;
Source: "..\..\x86\OEM\hanvon\hanvontwain7002.ds"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Components: Twain7002;
Source: "..\..\x86\OEM\hanvon\hanvontwain7039.ds"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Components: Twain7039;
Source: "..\..\x86\OEM\hanvon\hanvontwain8000.ds"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Components: Twain8000;
Source: "..\..\x86\OEM\hanvon\hanvontwain9000.ds"; DestDir: "{win}\twain_32\HanvonTwain\"; Flags: ignoreversion; Components: Twain9000;
; twain64
Source: "..\..\x64\OEM\hanvon\hanvontwain1000.ds"; DestDir: "{win}\twain_64\HanvonTwain\"; Flags: ignoreversion; Components: Twain1000; Check: Is64BitInstallMode
Source: "..\..\x64\OEM\hanvon\hanvontwain1002.ds"; DestDir: "{win}\twain_64\HanvonTwain\"; Flags: ignoreversion; Components: Twain1002; Check: Is64BitInstallMode
Source: "..\..\x64\OEM\hanvon\hanvontwain7000.ds"; DestDir: "{win}\twain_64\HanvonTwain\"; Flags: ignoreversion; Components: Twain7000; Check: Is64BitInstallMode
Source: "..\..\x64\OEM\hanvon\hanvontwain7002.ds"; DestDir: "{win}\twain_64\HanvonTwain\"; Flags: ignoreversion; Components: Twain7002; Check: Is64BitInstallMode
Source: "..\..\x64\OEM\hanvon\hanvontwain7039.ds"; DestDir: "{win}\twain_64\HanvonTwain\"; Flags: ignoreversion; Components: Twain7039; Check: Is64BitInstallMode
Source: "..\..\x64\OEM\hanvon\hanvontwain8000.ds"; DestDir: "{win}\twain_64\HanvonTwain\"; Flags: ignoreversion; Components: Twain8000; Check: Is64BitInstallMode
Source: "..\..\x64\OEM\hanvon\hanvontwain9000.ds"; DestDir: "{win}\twain_64\HanvonTwain\"; Flags: ignoreversion; Components: Twain9000; Check: Is64BitInstallMode
Source: "..\..\vs\vc_redist.x86.exe"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\vs\vc_redist.x64.exe"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
;拷贝驱动
Source: "..\..\usb\hanvon\hanvonusbscan.inf"; DestDir: "{app}\driver\"; Flags: ignoreversion recursesubdirs;
Source: "..\..\usb\hanvon\hanvonusbscan.cat"; DestDir: "{app}\driver\"; Flags: ignoreversion recursesubdirs;
Source: "..\..\x86\Release\DPInst32.exe"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs; Check: not IsWin64
Source: "..\..\x64\Release\DPInst64.exe"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs; Check: IsWin64
; 临时使用
Source: "..\..\x86\Release\RemoveOldApp.exe"; DestDir: "{tmp}\"; Flags: ignoreversion
Source: "..\..\x86\Release\CheckNewApp.exe"; DestDir: "{app}\"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "..\..\x64\Release\CheckNewApp.exe"; DestDir: "{app}\"; Flags: ignoreversion; Check: Is64BitInstallMode
[INI]
[Icons]
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\HanvonScan2.exe"
Name: "{group}\{#MyAppName}"; Filename: "{app}\HanvonScan2.exe"
Name: "{group}\汉王扫描软件帮助文档"; Filename: "{app}\HanvonScan_App_Help_manual.pdf"
Name: "{group}\卸载"; Filename: "{uninstallexe}";
[Registry]
Root: HKLM; Subkey: "Software\HanvonScan"; ValueType: string; ValueName: "AppDirectory"; ValueData: "{app}"; Flags: uninsdeletekey
Root: HKLM; Subkey: "Software\HanvonScan"; ValueType: string; ValueName: "Application"; ValueData: "{app}\HanvonScan.exe"; Flags: uninsdeletekey
Root: HKLM; Subkey: "Software\HanvonScan"; ValueType: string; ValueName: "AppVersion"; ValueData: "{#MyAppVersion}"; Flags: uninsdeletekey
Root: HKLM; Subkey: "Software\HanvonScan"; ValueType: string; ValueName: "DriverPath"; ValueData: "{app}"; Flags: uninsdeletekey; Check: not Is64BitInstallMode
Root: HKLM; Subkey: "Software\HanvonScan"; ValueType: string; ValueName: "DriverPath"; ValueData: "{win}\twain_32\HanvonTwain"; Flags: uninsdeletekey; Check: Is64BitInstallMode
Root: HKLM; Subkey: "Software\HanvonScan"; ValueType: string; ValueName: "DriverPath64"; ValueData: "{app}"; Flags: uninsdeletekey; Check: Is64BitInstallMode
Root: HKLM; Subkey: "Software\WOW6432Node\HanvonScan"; ValueType: string; ValueName: "DriverPath"; ValueData: "{win}\twain_32\HanvonTwain"; Flags: uninsdeletekey; Check: Is64BitInstallMode
Root: HKLM; Subkey: "Software\WOW6432Node\HanvonScan"; ValueType: string; ValueName: "DriverPath64"; ValueData: "{app}"; Flags: uninsdeletekey; Check: Is64BitInstallMode
[Code]
var
globalInstallPath: String;
//初始化时把路径设置到编辑框
procedure InitializeWizard;
begin
WizardForm.DirEdit.Text := globalInstallPath;
end;
function GetInstallString(): String;
var
InstallPath: String;
begin
InstallPath := ExpandConstant('{pf}\{#MyAppDefSetupDir}');
if RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{4486975C-CBCF-430B-BED1-427866D1738E}_is1', 'Inno Setup: App Path') then
begin
RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{4486975C-CBCF-430B-BED1-427866D1738E}_is1', 'Inno Setup: App Path', InstallPath)
end
result := InstallPath;
end;
function InitializeSetup(): boolean;
var
ErrorCode: Integer;
ResultCode: Integer;
ResultStr: String;
UninstallContinue: Boolean;
CmdStr: String;
begin
Result := false;
globalInstallPath := GetInstallString();
CmdStr := GetCmdTail();
ExtractTemporaryFile('RemoveOldApp.exe');
if Exec(ExpandConstant('{tmp}\RemoveOldApp.exe'), 'OEM_HANWANG', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode) then
begin
if 0 = ErrorCode then
begin
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{4486975C-CBCF-430B-BED1-427866D1738E}_is1', 'UninstallString', ResultStr) then
begin
UninstallContinue := true;
if Pos('/verysilent', CmdStr) = 0 then
begin
if MsgBox('扫描软件已安装,是否卸载原版本?', mbConfirmation, MB_YESNO) <> IDYES then
begin
UninstallContinue := false;
end
end
if UninstallContinue then
begin
ResultStr := RemoveQuotes(ResultStr);
if Exec(ResultStr, '/verysilent', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
if 0 = ResultCode then
begin
Sleep(1000)
Result := true;
end
end
end
end
else
begin
Result := true;
end
end
else if 2 = ErrorCode then
begin
MsgBox('请先关闭旧版扫描软件!', mbInformation, MB_OK);
end
else
begin
MsgBox('卸载旧版扫描软件失败,停止安装!', mbInformation, MB_OK);
end
end
end;
function SetUninstallIcon(iconPath:string): Boolean;
var
InstalledVersion,SubKeyName: String;
begin
SubKeyName := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{4486975C-CBCF-430B-BED1-427866D1738E}_is1';
RegWriteStringValue(HKLM,SubKeyName,'DisplayIcon',iconPath);
end;
function InitializeUninstall(): Boolean;
var
ErrorCode: Integer;
begin
Result := false;
if Exec(ExpandConstant('{app}\CheckNewApp.exe'), 'OEM_HANWANG', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode) then
begin
if 0 = ErrorCode then
begin
Result := true;
end
else
begin
MsgBox('请先关闭扫描软件!', mbInformation, MB_OK);
end
end
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpFinished then
begin
SetUninstallIcon(ExpandConstant('{app}\HanvonScan_App.ico'));
DelTree(ExpandConstant('{win}\twain_32\HanvonTwain\x86'), True, True, True);
DelTree(ExpandConstant('{win}\twain_32\HanvonTwain\x64'), True, True, True);
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep:TUninstallStep);
begin
if CurUninstallStep = usDone then
begin
DelTree(ExpandConstant('{app}'), True, True, True);
DelTree(ExpandConstant('{win}\twain_32\HanvonTwain'), True, True, True);
DelTree(ExpandConstant('{win}\twain_64\HanvonTwain'), True, True, True);
end;
end;
[Run]
Filename: "{app}\vc_redist.x86.exe"; Parameters: "/s"; Flags: runascurrentuser; Check: not Is64BitInstallMode
Filename: "{app}\vc_redist.x64.exe"; Parameters: "/s"; Flags: runascurrentuser; Check: Is64BitInstallMode
Filename: "{app}\DPInst32"; Parameters: "/path ""{app}\driver"" /sw /se /lm /f"; Check: not IsWin64; Flags: runascurrentuser
Filename: "{app}\DPInst64"; Parameters: "/path ""{app}\driver"" /sw /se /lm /f"; Check: IsWin64; Flags: runascurrentuser
;Filename: "{app}\HWUpgradeApp.exe"; Parameters:"-type=postinstallinfo -appName=Scanner -oemName=Hanvon -desc=install/upgrade"; Components: Upgrade; Flags: runascurrentuser
Filename: "{app}\HanvonScan2.exe"; Description: "{cm:LaunchProgram, {#MyAppName}}"; Flags: postinstall nowait skipifsilent runascurrentuser
[UninstallRun]
; 卸载驱动
;Filename: "{app}\DPInst32"; Parameters: "/u ""{app}\driver\hanvonusbscan.inf"" /q /d"; Check: not IsWin64; Flags: runascurrentuser ;Filename: "{app}\DPInst64"; Parameters: "/u ""{app}\driver\hanvonusbscan.inf"" /q /d"; Check: IsWin64; Flags: runascurrentuser