Skip to content

Commit

Permalink
[phonegap#63] added prototype of the win installer
Browse files Browse the repository at this point in the history
Former-commit-id: 52e0726
  • Loading branch information
hermwong committed Jan 19, 2015
1 parent 87faf15 commit 720967d
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
1 change: 1 addition & 0 deletions installers/win/setup.exe.REMOVED.git-id
@@ -0,0 +1 @@
82075f07f18f114e4944dfd38ddb8510fdbaee68
79 changes: 79 additions & 0 deletions res/installers/win/pg-desktop.iss
@@ -0,0 +1,79 @@
; -- Example1.iss --
; Demonstrates copying 3 files and creating an icon.

; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!

[Setup]
AppName=PhoneGap Desktop
AppVersion=0.1.1
DefaultDirName={pf}\My Program\PhoneGap Desktop
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:Inno Setup Examples Output

[Files]
Source: "C:\Users\herm\Documents\HermWong\phonegap-gui\build\PhoneGap\win\PhoneGap.exe"; DestDir: "{app}"
Source: "C:\Users\herm\Documents\HermWong\phonegap-gui\build\PhoneGap\win\nw.pak"; DestDir: "{app}"
Source: "C:\Users\herm\Documents\HermWong\phonegap-gui\build\PhoneGap\win\libGLESv2.dll"; DestDir: "{app}"
Source: "C:\Users\herm\Documents\HermWong\phonegap-gui\build\PhoneGap\win\libEGL.dll"; DestDir: "{app}"
Source: "C:\Users\herm\Documents\HermWong\phonegap-gui\build\PhoneGap\win\icudtl.dat"; DestDir: "{app}"
Source: "C:\Users\herm\Documents\HermWong\phonegap-gui\build\PhoneGap\win\ffmpegsumo.dll"; DestDir: "{app}"

[Icons]
;Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"

[Code]
// Utility functions for Inno Setup
// used to add/remove programs from the windows firewall rules
// Code originally from http://news.jrsoftware.org/news/innosetup/msg43799.html
const
NET_FW_SCOPE_ALL = 0;
NET_FW_IP_VERSION_ANY = 2;
procedure SetFirewallException(AppName,FileName:string);
var
FirewallObject: Variant;
FirewallManager: Variant;
FirewallProfile: Variant;
begin
try
FirewallObject := CreateOleObject('HNetCfg.FwAuthorizedApplication');
FirewallObject.ProcessImageFileName := FileName;
FirewallObject.Name := AppName;
FirewallObject.Scope := NET_FW_SCOPE_ALL;
FirewallObject.IpVersion := NET_FW_IP_VERSION_ANY;
FirewallObject.Enabled := True;
FirewallManager := CreateOleObject('HNetCfg.FwMgr');
FirewallProfile := FirewallManager.LocalPolicy.CurrentProfile;
FirewallProfile.AuthorizedApplications.Add(FirewallObject);
except
end;
end;
procedure RemoveFirewallException( FileName:string );
var
FirewallManager: Variant;
FirewallProfile: Variant;
begin
try
FirewallManager := CreateOleObject('HNetCfg.FwMgr');
FirewallProfile := FirewallManager.LocalPolicy.CurrentProfile;
FireWallProfile.AuthorizedApplications.Remove(FileName);
except
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssPostInstall then
SetFirewallException('My Server', ExpandConstant('{app}')+'\TCPServer.exe');
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep=usPostUninstall then
RemoveFirewallException(ExpandConstant('{app}')+'\TCPServer.exe');
end;
5 changes: 5 additions & 0 deletions res/installers/win/readme.txt
@@ -0,0 +1,5 @@
Windows Installer Script requires Inno Setup to compile.

- load pg-desktop.iss into Inno Setup
- compile the pg-desktop.iss file
- it will generate a setup.exe file in the following location: C:\Users\<username>\Documents\Inno Setup Examples Output

0 comments on commit 720967d

Please sign in to comment.