Wrapper over EXE won't work - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

RichieRich
Posts: 4
Joined: Wed Nov 16, 2011 5:48 am

Wrapper over EXE won't work

I'm trying to wrap over an exe and add firewall exceptions. The installer runs, but nothing happens. Where do I look to find out what's going wrong?
I am following the instructions at http://www.advancedinstaller.com/user-g ... r-exe.html and have gone over them several times. I can't see what I might be doing wrong.
My vbs is:

Function Wrapper()
dim x86, x64
dim version64,version86
'Based on these properties we will make the installer selection.
version64 = Session.Property("VersionNT64")
version86 = Session.Property ("VersionNT")

'This is the property of the 1st temporary
'installer file added to the project.
x86 = Session.Property("AI_HICAPSCONNECT_1_0_2_96.EXE")

'This is the property of the 1st temporary
'installer file added to the project.
x64 = Session.Property("AI_HICAPSCONNECT_1_0_2_96.EXE")

set WshShell = CreateObject("WScript.Shell")

'If the machine uses Windows 64bits
If version64 <> "" then
WshShell.Run x64,1,false

'If the machine uses Windows 32bits
Else If version86 <> "" then
WshShell.Run x86,1,false
End If
End If

OpenExe("HICAPS Connect Client", "HicapsConnectClient.exe")
OpenExe("HICAPS Connect Service", "HicapsConnectService.exe")
OpenPort(11000)
OpenPort(11001)
End Function

Function OpenExe(name, fn)
'get the path to HICAPS dir
Set wshShell = CreateObject("WScript.Shell")
sPath = wshShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%")
if sPath = "%PROGRAMFILES(x86)%" then sPath = wshShell.ExpandEnvironmentStrings("%PROGRAMFILES%")
sPath = sPath & "\HICAPSConnect\"

Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy
Set objProfile = objPolicy.GetProfileByType(1)

Set objApplication = CreateObject("HNetCfg.FwAuthorizedApplication")
objApplication.Name = name
objApplication.IPVersion = 2
objApplication.ProcessImageFileName = sPath & fn
objApplication.RemoteAddresses = "*"
objApplication.Scope = 0
objApplication.Enabled = True

Set colApplications = objProfile.AuthorizedApplications
colApplications.Add(objApplication)
End Function

Function OpenPort(pn)
Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile

Set objPort = CreateObject("HNetCfg.FwOpenPort")
objPort.Port = pn
objPort.Name = "HICAPS Port " & pn
objPort.Enabled = TRUE
Set colPorts = objPolicy.GloballyOpenPorts

errReturn = colPorts.Add(objPort)
End Function
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Wrapper over EXE won't work

Hello,

Unfortunately it is not within our support boundaries to create or debug custom actions. However, here's a user guide FAQ to help you debug the custom action.

The recommended way to add firewall exceptions is to use our predefined functionality from Windows Firewall page.

Also, to make sure the steps from the article are implemented correctly, you can try to set them in a test project. This way you can isolate any faulty custom behavior you may have added subsequently to your main project.
If any step from the article seems unclear, please contact us.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”