Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions windows-msi/msi.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
<Binary Id="Service.js" SourceFile="script\Service.js"/>
<Binary Id="PlapReg.js" SourceFile="script\PlapReg.js"/>
<Binary Id="ACL.js" SourceFile="script\ACL.js"/>
<Binary Id="RegisterEventSource.js" SourceFile="script\RegisterEventSource.js"/>

<CustomAction Id="GetInstallDirForPlap" BinaryKey="PlapReg.js" JScriptCall="GetInstallDir" />
<CustomAction Id="UpdatePlapReg" BinaryKey="PlapReg.js" JScriptCall="UpdatePlapReg" Execute="deferred" Impersonate="no" />
Expand All @@ -95,6 +96,7 @@
<CustomAction Id="GetInstallDirForACL" BinaryKey="ACL.js" JScriptCall="GetInstallDir" Return="check" />
<CustomAction Id="SetACL" BinaryKey="ACL.js" JScriptCall="SetACL" Execute="deferred" Impersonate="no" Return="check" />

<CustomAction Id="RegisterEventSource" BinaryKey="RegisterEventSource.js" JScriptCall="RegisterEventSource" Execute="deferred" Impersonate="no" Return="check" />
<!--
Detect system information
-->
Expand All @@ -110,6 +112,7 @@
<Custom Action="UpdatePlapReg" After="InstallFiles"/>
<Custom Action="GetInstallDirForACL" After="SetProductDirParam">NOT Installed</Custom>
<Custom Action="SetACL" After="InstallFiles">NOT Installed</Custom>
<Custom Action="RegisterEventSource" After="InstallFiles">NOT Installed</Custom>
</InstallExecuteSequence>
<UI>
<ProgressText Action="FindSystemInfo">Detecting system information</ProgressText>
Expand Down
11 changes: 11 additions & 0 deletions windows-msi/script/RegisterEventSource.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function RegisterEventSource() {
var shell = new ActiveXObject("WScript.Shell");
var source = "OpenVPNService";
var logName = "Application";

var command = 'powershell -ExecutionPolicy Bypass -Command "if (-not [System.Diagnostics.EventLog]::SourceExists(\'' +
source + '\')) {[System.Diagnostics.EventLog]::CreateEventSource(\'' +
source + '\', \'' + logName + '\')}"';

shell.Run(command, 0, true); // 0 = hidden, true = wait until complete
}