OpenVPN
Data Structures | Macros | Functions | Variables
openvpnmsica.h File Reference
#include <windows.h>
#include <msi.h>
#include "../tapctl/basic.h"
Include dependency graph for openvpnmsica.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  openvpnmsica_thread_data
 Thread local storage data. More...
 

Macros

#define ERROR_MSICA   2550L
 
#define ERROR_MSICA_ERRNO   2551L
 
#define OPENVPNMSICA_SAVE_MSI_SESSION(hInstall)
 Set MSI session handle in thread local storage. More...
 
#define DLLEXP_DECL
 
#define DLLEXP_EXPORT   "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__
 

Functions

DLLEXP_DECL UINT __stdcall FindSystemInfo (_In_ MSIHANDLE hInstall)
 Determines Windows information: More...
 
DLLEXP_DECL UINT __stdcall CloseOpenVPNGUI (_In_ MSIHANDLE hInstall)
 Find OpenVPN GUI window and send it a WM_CLOSE message. More...
 
DLLEXP_DECL UINT __stdcall StartOpenVPNGUI (_In_ MSIHANDLE hInstall)
 Launches OpenVPN GUI. More...
 
DLLEXP_DECL UINT __stdcall EvaluateTUNTAPAdapters (_In_ MSIHANDLE hInstall)
 Evaluate the TUNTAPAdapter table of the MSI package database and prepare a list of TAP adapters to install/remove. More...
 
DLLEXP_DECL UINT __stdcall ProcessDeferredAction (_In_ MSIHANDLE hInstall)
 Perform scheduled deferred action. More...
 
DLLEXP_DECL UINT __stdcall CheckAndScheduleReboot (_In_ MSIHANDLE hInstall)
 Schedule reboot after installation if reboot indication file is found in user's temp directory. More...
 

Variables

DWORD openvpnmsica_thread_data_idx
 MSI session handle thread local storage index. More...
 

Macro Definition Documentation

◆ DLLEXP_DECL

#define DLLEXP_DECL

Definition at line 72 of file openvpnmsica.h.

◆ DLLEXP_EXPORT

#define DLLEXP_EXPORT   "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__

Definition at line 73 of file openvpnmsica.h.

◆ ERROR_MSICA

#define ERROR_MSICA   2550L

Definition at line 32 of file openvpnmsica.h.

◆ ERROR_MSICA_ERRNO

#define ERROR_MSICA_ERRNO   2551L

Definition at line 33 of file openvpnmsica.h.

◆ OPENVPNMSICA_SAVE_MSI_SESSION

#define OPENVPNMSICA_SAVE_MSI_SESSION (   hInstall)
Value:

Set MSI session handle in thread local storage.

Definition at line 54 of file openvpnmsica.h.

Function Documentation

◆ CheckAndScheduleReboot()

DLLEXP_DECL UINT __stdcall CheckAndScheduleReboot ( _In_ MSIHANDLE  hInstall)

Schedule reboot after installation if reboot indication file is found in user's temp directory.

Parameters
hInstallHandle to the installation provided to the DLL custom action
Returns
ERROR_SUCCESS on success; An error code otherwise See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa368072.aspx

Definition at line 1163 of file openvpnmsica.c.

References debug_popup, FILE_NEED_REBOOT, M_WARN, msg, and OPENVPNMSICA_SAVE_MSI_SESSION.

◆ CloseOpenVPNGUI()

DLLEXP_DECL UINT __stdcall CloseOpenVPNGUI ( _In_ MSIHANDLE  hInstall)

Find OpenVPN GUI window and send it a WM_CLOSE message.

Parameters
hInstallHandle to the installation provided to the DLL custom action
Returns
ERROR_SUCCESS on success; An error code otherwise See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa368072.aspx

Definition at line 338 of file openvpnmsica.c.

References debug_popup.

◆ EvaluateTUNTAPAdapters()

DLLEXP_DECL UINT __stdcall EvaluateTUNTAPAdapters ( _In_ MSIHANDLE  hInstall)

Evaluate the TUNTAPAdapter table of the MSI package database and prepare a list of TAP adapters to install/remove.

Parameters
hInstallHandle to the installation provided to the DLL custom action
Returns
ERROR_SUCCESS on success; An error code otherwise See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa368072.aspx

Definition at line 634 of file openvpnmsica.c.

References debug_popup, M_ERRNO, M_NONFATAL, msg, msi_format_field(), msi_get_record_string(), msica_arg_seq_add_tail(), msica_arg_seq_free(), msica_arg_seq_init(), OPENVPNMSICA_SAVE_MSI_SESSION, PRIsLPTSTR, schedule_adapter_create(), schedule_adapter_delete(), and setup_sequence().

◆ FindSystemInfo()

DLLEXP_DECL UINT __stdcall FindSystemInfo ( _In_ MSIHANDLE  hInstall)

Determines Windows information:

  • Sets OPENVPNSERVICE MSI property to PID of OpenVPN Service if running, or its EXE path if configured for auto-start.
  • Finds existing TAP-Windows6 adapters and set TAPWINDOWS6ADAPTERS and ACTIVETAPWINDOWS6ADAPTERS properties with semicolon delimited list of all installed adapter GUIDs and active adapter GUIDs respectively.
  • Finds existing Wintun adapters and set WINTUNADAPTERS and ACTIVEWINTUNADAPTERS properties with semicolon delimited list of all installed adapter GUIDs and active adapter GUIDs respectively.
  • Finds existing ovpn-dco adapters and set OVPNDCOADAPTERS and ACTIVEOVPNDCOADAPTERS properties with semicolon delimited list of all installed adapter GUIDs and active adapter GUIDs respectively.
Parameters
hInstallHandle to the installation provided to the DLL custom action
Returns
ERROR_SUCCESS on success; An error code otherwise See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa368072.aspx

Definition at line 301 of file openvpnmsica.c.

References debug_popup, find_adapters(), OPENVPNMSICA_SAVE_MSI_SESSION, and TAP_WIN_COMPONENT_ID.

◆ ProcessDeferredAction()

DLLEXP_DECL UINT __stdcall ProcessDeferredAction ( _In_ MSIHANDLE  hInstall)

◆ StartOpenVPNGUI()

DLLEXP_DECL UINT __stdcall StartOpenVPNGUI ( _In_ MSIHANDLE  hInstall)

Launches OpenVPN GUI.

It's path is obtained by expanding the [#bin.openvpn_gui.exe] therefore, its Id field in File table must be "bin.openvpn_gui.exe".

Parameters
hInstallHandle to the installation provided to the DLL custom action
Returns
ERROR_SUCCESS on success; An error code otherwise See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa368072.aspx

Definition at line 361 of file openvpnmsica.c.

References debug_popup, M_ERRNO, M_FATAL, M_NONFATAL, msg, and OPENVPNMSICA_SAVE_MSI_SESSION.

Variable Documentation

◆ openvpnmsica_thread_data_idx

DWORD openvpnmsica_thread_data_idx

MSI session handle thread local storage index.

Definition at line 38 of file dllmain.c.

Referenced by DllMain(), and x_msg_va().

openvpnmsica_thread_data_idx
DWORD openvpnmsica_thread_data_idx
MSI session handle thread local storage index.
Definition: dllmain.c:38
openvpnmsica_thread_data::hInstall
MSIHANDLE hInstall
Definition: openvpnmsica.h:41
openvpnmsica_thread_data
Thread local storage data.
Definition: openvpnmsica.h:39