以前编写的inno setup脚本,涵盖了自定义安装界面,调用dll等等应用 (转)
以前编写的inno setup脚本,涵盖了自定义安装界面,调用dll等等应用 (转)
- ; Script generated by the Inno Setup 脚本向导.
- ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
- ; 为1的时候表示定义成试用版本
- #define VERSION_TYPE ReadIni('Setup.ini', 'SetupType', 'type', '0')
- #if VERSION_TYPE == "2"
- #define LIVE_VERSION
- #define MyAppName "流媒体系统(PMS)"
- #define MyAppId "1954A698-2322-46F1-B732-8DDF96693DA5"
- #define MyOutputBaseFilename "live_server_setup"
- #elif VERSION_TYPE == "1"
- #define VOD_VERSION
- #define MyAppName "流媒体系统(PMS)"
- #define MyAppId "DA255679-F103-4170-8B75-B9A7EF4CBC1B"
- #define MyOutputBaseFilename "vod_server_setup"
- #else
- #define FULL_VERSION
- #define MyAppName "流媒体系统(PMS)"
- #define MyAppId "4AC618B5-8C69-4D47-918A-261AA895B6D7"
- #define MyOutputBaseFilename "full_server_setup"
- #endif
- #define RegUrl "http://www.xxx.net"
- #define MyAppVersion "1.0"
- #define MyAppPublisher "XXX科技有限公司"
- #define MyAppURL "http://www.xxx.net"
- #define MyAppExeName "InstanceConfig.exe"
- [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={{{#MyAppId}}
- AppMutex={{{#MyAppId}}
- AppName={#MyAppName}
- AppVersion={#MyAppVersion}
- AppPublisher={#MyAppPublisher}
- AppPublisherURL={#MyAppURL}
- AppSupportURL={#MyAppURL}
- AppUpdatesURL={#MyAppURL}
- DefaultDirName={pf}\xxx\media server
- DefaultGroupName={#MyAppName}
- AllowNoIcons=yes
- LicenseFile=license.txt
- OutputDir=output
- OutputBaseFilename={#MyOutputBaseFilename}
- SetupIconFile=setup.ico
- Compression=lzma
- SolidCompression=yes
- VersionInfoVersion={#MyAppVersion}
- VersionInfoCompany={#MyAppPublisher}
- VersionInfoCopyright=Copyright (C) 2010-2013
- VersionInfoProductName={#MyAppName}
- VersionInfoProductVersion={#MyAppVersion}
- [Languages]
- Name: cn; MessagesFile: compiler:Languages\chinese.isl
- [Files]
- ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
- ; 用来检测安装程序中输入的注册码是否有效
- Source: ..\build\register_help.dll; Flags: dontcopy
- Source: ..\build\libeay32.dll; Flags: dontcopy
- Source: ..\build\vcredist2008_x86.exe; Flags: dontcopy
- #ifdef FULL_VERSION
- Source: ..\build\server.conf; DestDir: {app}
- Source: ..\build\media_service.exe; DestDir: {app}
- Source: ..\build\libmysql.dll; DestDir: {app}
- Source: ..\build\libeay32.dll; DestDir: {app}
- Source: ..\build\zlib1.dll; DestDir: {app}
- Source: ..\build\register_check.exe; DestDir: {app}
- Source: ..\build\QtCore4.dll; DestDir: {app}
- Source: ..\build\QtGui4.dll; DestDir: {app}
- Source: ..\build\mglobal.dll; DestDir: {app}
- Source: ..\build\msvcp100.dll; DestDir: {app}
- Source: ..\build\msvcr100.dll; DestDir: {app}
- Source: ..\build\initconfig.exe; DestDir: {app}
- Source: ..\build\InstanceConfig.exe; DestDir: {app}
- ;Source: ..\build\php-fpm.exe; DestDir: {app}
- Source: ..\build\管理统计页面.url; DestDir: {app}
- Source: ..\build\示例页面.url; DestDir: {app}
- Source: ..\build\launchlist; DestDir: {app}
- ;Source: ..\build\phpcgi; DestDir: {app}
- Source: ..\build\lighttpd.conf; DestDir: {app}\lmp\lighttpd\conf; Flags: ignoreversion
- Source: ..\build\my.ini; DestDir: {app}\lmp\mysql; Flags: ignoreversion
- ; web服务器整套目录
- Source: ..\build\lmp\*; DestDir: {app}\lmp; Flags: recursesubdirs createallsubdirs
- ; doc文档目录
- Source: ..\doc\*; DestDir: {app}\help; Flags: recursesubdirs createallsubdirs
- ; 播放器相关目录
- Source: ..\build\swfs\*; DestDir: {app}\swfs; Flags: recursesubdirs createallsubdirs
- ; 播放器SDK相关目录
- Source: ..\build\scriptlib\*; DestDir: {app}\scriptlib; Flags: recursesubdirs createallsubdirs
- #endif
- [Dirs]
- Name: {app}\videos
- [Tasks]
- Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}
- [Icons]
- Name: {group}\sample\示例页面; Filename: {app}\示例页面.url
- Name: {group}\help\安装说明; Filename: {app}\help\安装说明.pdf
- Name: {group}\help\功能说明; Filename: {app}\help\功能说明.pdf
- Name: {group}\help\开发说明; Filename: {app}\help\开发说明.pdf
- Name: {group}\help\配置说明; Filename: {app}\help\配置说明.pdf
- Name: {group}\help\统计模块; Filename: {app}\help\统计模块.pdf
- Name: {group}\流媒体系统(PMS)系统配置; Filename: {app}\{#MyAppExeName}
- Name: {group}\{cm:UninstallProgram, PMS系统配置}; Filename: {uninstallexe}
- Name: {group}\流媒体系统(PMS)统计管理; Filename: {app}\管理统计页面.url; IconFilename: {app}\{#MyAppExeName};
- Name: {commondesktop}\流媒体系统(PMS)统计管理; Filename: {app}\管理统计页面.url; Tasks: desktopicon; IconFilename: {app}\{#MyAppExeName};
- Name: {commondesktop}\流媒体系统(PMS)系统配置; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon
- Name: {commondesktop}\ 开启PMS服 务; Filename: {app}\media_service.exe; Parameters: -r; IconFilename: {app}\{#MyAppExeName}; Tasks: desktopicon
- Name: {commondesktop}\ 停止PMS服 务; Filename: {app}\media_service.exe; Parameters: -s; IconFilename: {app}\{#MyAppExeName}; Tasks: desktopicon
- [Run]
- ; 删除服务
- Filename: {app}\media_service.exe; Parameters: -u; Flags: runhidden
- ; 安装服务
- Filename: {app}\media_service.exe; Parameters: -i; Flags: runhidden
- [UninstallRun]
- ; 停止服务
- Filename: {app}\media_service.exe; Parameters: -s; Flags: runhidden
- ; 删除服务
- Filename: {app}\media_service.exe; Parameters: -u; Flags: runhidden
- [CustomMessages]
- Key_Form_Caption=注册向导
- Key_Form_Description=将序列号提交给xxx以获取注册码
- Key_Form_codeLabel_Caption0=序列号:
- Key_Form_keyLabel_Caption0=注册码:
- Domain_Form_Caption=域名设置
- Domain_Form_Description=配置当前服务器域名
- [Messages]
- BeveledLabel=xxx网络科技
- [Code]
- var
- codeLabel: TLabel;
- keyLabel: TLabel;
- key: TMemo;
- code: TMemo;
- keyPage: TWizardPage;
- domainEdit: TNewEdit;
- domainPage: TWizardPage;
- // 获取序列号
- function getCode(szCode: PChar; inLen: Integer): Integer;
- external 'getCode@files:register_help.dll,libeay32.dll,msvcr100.dll stdcall setuponly delayload loadwithalteredsearchpath';
- // 进行检查
- function regCheck(const regKey: PChar): Boolean;
- external 'regCheck@files:register_help.dll,libeay32.dll,msvcr100.dll stdcall setuponly delayload loadwithalteredsearchpath';
- // 进行注册
- function regSave(const regKey, regPath: PChar): Boolean;
- external 'regSave@files:register_help.dll,libeay32.dll,msvcr100.dll stdcall setuponly delayload loadwithalteredsearchpath';
- // 清理注册
- procedure regClear(const regPath: PChar);
- external 'regClear@files:register_help.dll,libeay32.dll,msvcr100.dll stdcall setuponly delayload loadwithalteredsearchpath';
- function OpenSCManager(const machine: LongInt; const dbName: LongInt; access: Dword):LongInt;
- external 'OpenSCManagerA@Advapi32.dll stdcall';
- function OpenService(svcMgr: LongInt; const svcName: pchar; access: Dword):LongInt;
- external 'OpenServiceA@Advapi32.dll stdcall';
- function CloseServiceHandle(svc: LongInt):Boolean;
- external 'CloseServiceHandle@Advapi32.dll stdcall';
- ///判定服务是否存在
- function serviceExists(name: string): boolean;
- var
- SvcMgr, Svc: LongInt;
- begin
- Result := False;
- SvcMgr := OpenSCManager(0,0,1);
- if SvcMgr = 0 then Exit;
- Svc := OpenService(SvcMgr, PChar(name), 4);
- if Svc = 0 then
- begin
- CloseServiceHandle(SvcMgr);
- Exit;
- end;
- CloseServiceHandle(Svc);
- CloseServiceHandle(SvcMgr);
- Result := true;
- end;
- ///停止服务
- procedure stopService;
- var
- ResultCode: Integer;
- begin
- Exec(ExpandConstant('{tmp}\media_service.exe'), '-s', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
- end;
- { Key_Form_ShouldSkipPage }
- function Key_Form_ShouldSkipPage(Page: TWizardPage): Boolean;
- var
- codeStr: String;
- begin
- SetLength(codeStr, 1024);
- getCode(PChar(codeStr), 1024);
- code.Text := codeStr;
- Result := False;
- end;
- // 注册码编辑框改变事件
- procedure Key_Form_KeyChange(Sender: TObject);
- begin
- // 检测注册码
- if regCheck(PChar(key.Text)) then
- WizardForm.NextButton.Enabled := True
- else
- WizardForm.NextButton.Enabled := False;
- end;
- procedure RegURLLabelOnClick(Sender: TObject);
- var
- ErrorCode: Integer;
- begin
- ShellExec('open', ExpandConstant('{#RegURL}'), '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
- end;
- { Key_Form_CreatePage }
- function Key_Form_CreatePage(PreviousPageId: Integer): Integer;
- var
- URLLabel: TNewStaticText;
- begin
- keyPage := CreateCustomPage(
- PreviousPageId,
- ExpandConstant('{cm:Key_Form_Caption}'),
- ExpandConstant('{cm:Key_Form_Description}')
- );
- { codeLabel }
- codeLabel := TLabel.Create(keyPage);
- with codeLabel do
- begin
- Parent := keyPage.Surface;
- Caption := ExpandConstant('{cm:Key_Form_codeLabel_Caption0}');
- Left := ScaleX(0);
- Top := ScaleY(0);
- Width := ScaleX(40);
- Height := ScaleY(13);
- end;
- { keyLabel }
- keyLabel := TLabel.Create(keyPage);
- with keyLabel do
- begin
- Parent := keyPage.Surface;
- Caption := ExpandConstant('{cm:Key_Form_keyLabel_Caption0}');
- Left := ScaleX(0);
- Top := ScaleY(82);
- Width := ScaleX(40);
- Height := ScaleY(13);
- end;
- { key }
- key := TMemo.Create(keyPage);
- with key do
- begin
- Parent := keyPage.Surface;
- Left := ScaleX(0);
- Top := ScaleY(98);
- Width := ScaleX(410);
- Height := ScaleY(106);
- ScrollBars := ssVertical;
- TabOrder := 0;
- OnChange := @Key_Form_KeyChange;
- end;
- { code }
- code := TMemo.Create(keyPage);
- with code do
- begin
- Parent := keyPage.Surface;
- Left := ScaleX(0);
- Top := ScaleY(16);
- Width := ScaleX(410);
- Height := ScaleY(60);
- ReadOnly := True;
- ScrollBars := ssVertical;
- TabOrder := 1;
- end;
- with keyPage do
- begin
- OnShouldSkipPage := @Key_Form_ShouldSkipPage;
- end;
- Result := keyPage.ID;
- URLLabel := TNewStaticText.Create(keyPage);
- with URLLabel do
- begin
- Caption := '获取注册码';
- Cursor := crHand;
- OnClick := @RegURLLabelOnClick;
- Parent := keyPage.Surface;
- Font.Style := URLLabel.Font.Style + [fsUnderline];
- Font.Color := clBlue;
- Left := ScaleX(350);
- Top := ScaleY(210);
- end;
- end;
- { 设置域名页面相关代码 }
- procedure Domain_Form_EditChange(sender: TObject);
- begin
- if domainEdit.Text = '' then
- WizardForm.NextButton.Enabled := False
- else
- WizardForm.NextButton.Enabled := True;
- end;
- function Domain_Form_CreatePage(PreviousPageId: Integer): Integer;
- var
- domainLabel: TNewStaticText;
- begin
- domainPage := CreateCustomPage(
- PreviousPageId,
- ExpandConstant('{cm:Domain_Form_Caption}'),
- ExpandConstant('{cm:Domain_Form_Description}')
- );
- domainLabel := TNewStaticText.Create(domainPage);
- with domainLabel do
- begin
- Parent := domainPage.Surface;
- Caption := '请确保输入的域名是有效的,并指向当前服务器IP,否则可以直接填写本机' + #13#10 + 'IP地址,或者保持默认值不变';
- Left := ScaleX(0);
- Top := ScaleY(60);
- Width := ScaleX(400);
- Height := ScaleY(28);
- end;
- domainEdit := TNewEdit.Create(domainPage);
- with domainEdit do
- begin
- Parent := domainPage.Surface;
- Text := GetComputerNameString;
- Left := ScaleX(0);
- Top := ScaleY(90);
- Width := ScaleX(400);
- Height := ScaleY(13);
- OnChange := @Domain_Form_EditChange;
- end;
- end;
- procedure URLLabelOnClick(Sender: TObject);
- var
- ErrorCode: Integer;
- begin
- ShellExec('open', ExpandConstant('{#MyAppURL}'), '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
- end;
- // 安装初始化
- function InitializeSetup(): Boolean;
- begin
- if serviceExists('MediaSrv') then
- begin //服务存在,先停止它
- if MsgBox('服务已经存在,要继续吗?', mbConfirmation, MB_YESNO) = IDNO then
- begin
- Result := False;
- Exit;
- end;
- ExtractTemporaryFile('media_service.exe');
- ExtractTemporaryFile('msvcr100.dll');
- ExtractTemporaryFile('msvcp100.dll');
- stopService;
- end;
- result := True;
- end;
- procedure InitializeWizard();
- var
- URLLabel: TNewStaticText;
- begin
- Key_Form_CreatePage(wpSelectDir);
- Domain_Form_CreatePage(keyPage.ID);
- URLLabel := TNewStaticText.Create(WizardForm);
- with URLLabel do
- begin
- Caption := ExpandConstant('{#MyAppURL}');
- Cursor := crHand;
- OnClick := @URLLabelOnClick;
- Parent := WizardForm;
- Font.Style := URLLabel.Font.Style + [fsUnderline];
- Font.Color := clBlue;
- Left := ScaleX(20);
- Top := WizardForm.ClientHeight - ScaleY(30);
- end;
- end;
- // 页面切换事件
- procedure CurPageChanged(CurPageID: Integer);
- var
- ResultCode: Integer;
- file: String;
- buf: String;
- begin
- WizardForm.BackButton.Enabled := True;
- if CurPageID = keyPage.ID then
- WizardForm.NextButton.Enabled := False
- else if CurPageID = wpFinished then
- begin
- ///////////////////////////////////////////////////////////
- // 帮助设置HOST_NAME为用户设置的域名
- file := ExpandConstant('{app}\lmp\htdocs\sample\config.php');
- if LoadStringFromFile(file, buf) then
- begin
- StringChangeEx(buf, '%HOST_NAME%', domainEdit.Text, False);
- SaveStringToFile(file, buf, False);
- end;
- file := ExpandConstant('{app}\管理统计页面.url');
- if LoadStringFromFile(file, buf) then
- begin
- StringChangeEx(buf, '%HOST_NAME%', domainEdit.Text, False);
- SaveStringToFile(file, buf, False);
- end;
- file := ExpandConstant('{app}\示例页面.url');
- if LoadStringFromFile(file, buf) then
- begin
- StringChangeEx(buf, '%HOST_NAME%', domainEdit.Text, False);
- SaveStringToFile(file, buf, False);
- end;
- ///////////////////////////////////////////////////////////
- // 禁用完成按钮
- WizardForm.NextButton.Enabled := False;
- // 正式写入注册文件
- regSave(PChar(key.Text), WizardDirValue);
- // 执行自动初始化
- Exec(ExpandConstant('{app}\initconfig.exe'), '', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
- // 执行配置设置
- Exec(ExpandConstant('{app}\InstanceConfig.exe'), '-r', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
- // 启动服务
- Exec(ExpandConstant('{app}\media_service.exe'), '-r', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
- // 启用完成按钮
- WizardForm.NextButton.Enabled := True;
- end
- else if CurPageID = wpInstalling then
- begin
- // 安装运行时库
- ExtractTemporaryFile('vcredist2008_x86.exe');
- // 执行2008库安装
- Exec(ExpandConstant('{tmp}\vcredist2008_x86.exe'), '/q', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
- end
- else if CurPageID = domainPage.ID then
- begin
- WizardForm.BackButton.Enabled := False;
- end;
- end;
- // 卸载
- procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
- begin
- if CurUninstallStep = usUninstall then
- begin
- DeleteFile(ExpandConstant('{app}\lsc'));
- end;
- end;
- // 检查重启逻辑
- function UninstallNeedRestart(): Boolean;
- begin
- if serviceExists('MediaSrv') then
- result := True
- else
- result := False;
- end;
以前编写的inno setup脚本,涵盖了自定义安装界面,调用dll等等应用 (转)的更多相关文章
- inno setup脚本,涵盖了自定义安装界面,调用dll等等应用
; Script generated by the Inno Setup 脚本向导. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETU ...
- Inno Setup脚本语法大全
Inno Setup脚本语法大全 ResourceShare Bruce 11个月前 (10-28) 6136浏览 0评论 Inno Setup 是什么?Inno Setup 是一个免费的 Win ...
- Inno Setup 脚本
给你个我用的例子: Delphi/Pascal code ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2 ...
- Inno Setup自定义安装界面脚本
; 脚本由 Inno Setup 脚本向导 生成! ; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档! #define MyAppName "RemoteCard&quo ...
- Inno Setup脚本
某天夜晚一场狂风暴雨,由于办公室座位旁的窗户没关,笔记本电脑泡了一夜水,无法开机,无奈送修,里面的大量资料也不知道会不会丢失. is的脚本只有重新写了,重新研究了一下检测程序是否正在运行的判断方法,另 ...
- INNO SETUP脚本向导创建的基本脚本
脚本范例分析:先来看看一段用INNO SETUP脚本向导创建的基本脚本的[Setup]段: [Setup] AppName=Premiere 6.5 汉化补丁-----------------(程 ...
- 在Unicode版Inno Setup中使用ISSkin给安装程序添加皮肤
原文 http://www.cnblogs.com/2356/archive/2009/10/27/1590565.html 在Unicode版Inno Setup中使用ISSkin给安装程序添加皮肤 ...
- 【转载】inno setup 水波纹效果,检测安装vcredist_x86.exe等
以下inno setup脚本,实现了:1.水波纹效果 2.安装时检测是否安装其他版本,并在欢迎页面添加文字提示 4.检测安装vcredist_x86.exe 3.卸载时添加提示 ; 脚本由 Inno ...
- 使用Inno SetUp脚本打包Winform程序
在开发桌面程序时,往往需要用到打包工具将程序打包为exe可执行文件. 之前在项目中用了下 InstallShield Limited Edition for Visual Studio 2015,它 ...
随机推荐
- poj 1363
这是一道数据结构的问题,用到了栈的知识.题目大意讲的是每一次有N辆车从A到B,但是要将车辆的顺序重新排列,可以通过中转站C来辅助排列,但是C符合先进后出的原则,这一点和栈的特性相同. 整个重新排序的过 ...
- 关于 MAXScript 如何获取当前max版本
用到了 GetFileVersion 相关文档在此:http://docs.autodesk.com/3DSMAX/16/ENU/MAXScript-Help/index.html?url=files ...
- App_Offline.htm 功能
在ASP.NET 2.0 站点根目录下,只要存在 App_Offline.htm 文件,那么所有对.aspx的请求都将转向App_Offline.htm .而且浏览器的地址栏显示的是所请求的.aspx ...
- 12-factor
简介 如今,软件通常会作为一种服务来交付,它们被称为网络应用程序,或软件即服务(SaaS).12-Factor 为构建如下的 SaaS 应用提供了方法论: 使用标准化流程自动配置,从而使新的开发者花费 ...
- 使用Script Component源处理不规则平面文件
微软 BI 系列随笔 - SSIS 2012 高级应用 - Script Component处理不规则平面文件 场景介绍 在使用SSIS从平面文件导入源数据时,最常遇到的是以下两种情况: 导入规则的平 ...
- WPF中嵌入普通Win32程序的方法
公司现在在研发基于.Net中WPF技术的产品,由于要兼容旧有产品,比如一些旧有的Win32程序.第三方的Win32程序等等,还要实现自动登录这些外部Win32程序,因此必须能够将这些程序整合到我们的系 ...
- IntelliJ IDEA热加载自动更新(Update classes and resources )
IntelliJ IDEA默认文件是自动保存的,但是手头有个项目jsp文件改动后,在tomcat中不能立即响应变化.想要jsp文件改动后立刻看到变化,可以通过修改配置来实现. ...
- 黄聪: 50 个 Bootstrap 插件
Bootstrap是快速开发Web应用程序的前端工具包.它是一个CSS和HTML的集合,它使用了最新的浏览器技术,给你的Web开发提供了时尚的版式,表单,buttons,表格,网格系统等等. 本文向你 ...
- 【学+原】CSS3的2D动画 ——仿NOMOS手表
看CSS3妙味课堂中有一课是介绍如何做钟表界面,然后三根针都能随着时间转动,然后自己在那个简易的版本上做了一些进一部改进. 最关键的知识点应该是transform-origin这个样式,要选对旋转的中 ...
- Object类概述
Object:类 Object 是类层次结构的根类.每个类都使用 Object 作为超类.每个类都直接或者间接的继承自Object类. Object类的方法:public int hashCode() ...