OpenVPN
src
openvpnmsica
openvpnmsica.h
Go to the documentation of this file.
1
/*
2
* openvpnmsica -- Custom Action DLL to provide OpenVPN-specific support to MSI packages
3
* https://community.openvpn.net/openvpn/wiki/OpenVPNMSICA
4
*
5
* Copyright (C) 2018-2026 Simon Rozman <simon@rozman.si>
6
*
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License version 2
9
* as published by the Free Software Foundation.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License along
17
* with this program; if not, see <https://www.gnu.org/licenses/>.
18
*/
19
20
#ifndef MSICA_H
21
#define MSICA_H
22
23
#include <windows.h>
24
#include <msi.h>
25
#include "
../tapctl/basic.h
"
26
27
28
/*
29
* Error codes (next unused 2552L)
30
*/
31
#define ERROR_MSICA 2550L
32
#define ERROR_MSICA_ERRNO 2551L
33
34
38
struct
openvpnmsica_thread_data
39
{
40
MSIHANDLE
hInstall
;
41
};
42
43
47
extern
DWORD
openvpnmsica_thread_data_idx
;
48
49
53
#define OPENVPNMSICA_SAVE_MSI_SESSION(hInstall) \
54
{ \
55
struct openvpnmsica_thread_data *s = \
56
(struct openvpnmsica_thread_data *)TlsGetValue(openvpnmsica_thread_data_idx); \
57
s->hInstall = (hInstall); \
58
}
59
60
61
/*
62
* Exported DLL Functions
63
*/
64
65
#ifdef __cplusplus
66
extern
"C"
67
{
68
#endif
69
70
/* Ensure that clang-cl, which does not understand the cl specific
71
* preprocessor defines like #pragma comment(linker, DLLEXP_EXPORT)
72
* is handled the same way as mingw and uses the alternative instead
73
* and does not define DLLEXP_EXPORT */
74
#if defined(__GNUC__) || defined(__clang__)
75
#define DLLEXP_DECL __declspec(dllexport)
76
#else
77
#define DLLEXP_DECL
78
#define DLLEXP_EXPORT "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__
79
#endif
80
81
101
DLLEXP_DECL
UINT __stdcall
FindSystemInfo
(
_In_
MSIHANDLE hInstall);
102
103
112
DLLEXP_DECL
UINT __stdcall
CloseOpenVPNGUI
(
_In_
MSIHANDLE hInstall);
113
114
124
DLLEXP_DECL
UINT __stdcall
StartOpenVPNGUI
(
_In_
MSIHANDLE hInstall);
125
126
136
DLLEXP_DECL
UINT __stdcall
EvaluateTUNTAPAdapters
(
_In_
MSIHANDLE hInstall);
137
138
147
DLLEXP_DECL
UINT __stdcall
ProcessDeferredAction
(
_In_
MSIHANDLE hInstall);
148
149
159
DLLEXP_DECL
UINT __stdcall
CheckAndScheduleReboot
(
_In_
MSIHANDLE hInstall);
160
161
#ifdef __cplusplus
162
}
163
#endif
164
165
#endif
/* ifndef MSICA_H */
openvpnmsica_thread_data_idx
DWORD openvpnmsica_thread_data_idx
MSI session handle thread local storage index.
Definition
dllmain.c:37
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 in...
Definition
openvpnmsica.c:632
CheckAndScheduleReboot
DLLEXP_DECL UINT __stdcall CheckAndScheduleReboot(_In_ MSIHANDLE hInstall)
Schedule reboot after installation if reboot indication file is found in user's temp directory.
Definition
openvpnmsica.c:1182
StartOpenVPNGUI
DLLEXP_DECL UINT __stdcall StartOpenVPNGUI(_In_ MSIHANDLE hInstall)
Launches OpenVPN GUI.
Definition
openvpnmsica.c:366
DLLEXP_DECL
#define DLLEXP_DECL
Definition
openvpnmsica.h:77
ProcessDeferredAction
DLLEXP_DECL UINT __stdcall ProcessDeferredAction(_In_ MSIHANDLE hInstall)
Perform scheduled deferred action.
Definition
openvpnmsica.c:978
CloseOpenVPNGUI
DLLEXP_DECL UINT __stdcall CloseOpenVPNGUI(_In_ MSIHANDLE hInstall)
Find OpenVPN GUI window and send it a WM_CLOSE message.
Definition
openvpnmsica.c:341
FindSystemInfo
DLLEXP_DECL UINT __stdcall FindSystemInfo(_In_ MSIHANDLE hInstall)
Determines Windows information:
Definition
openvpnmsica.c:313
openvpnmsica_thread_data
Thread local storage data.
Definition
openvpnmsica.h:39
openvpnmsica_thread_data::hInstall
MSIHANDLE hInstall
Handle to the installation session.
Definition
openvpnmsica.h:40
basic.h
_In_
#define _In_
Definition
basic.h:41
Generated by
1.15.0