OpenVPN
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-2025 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
39{
40 MSIHANDLE hInstall;
41};
42
43
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
66extern "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 */
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...
DLLEXP_DECL UINT __stdcall CheckAndScheduleReboot(_In_ MSIHANDLE hInstall)
Schedule reboot after installation if reboot indication file is found in user's temp directory.
DLLEXP_DECL UINT __stdcall StartOpenVPNGUI(_In_ MSIHANDLE hInstall)
Launches OpenVPN GUI.
#define DLLEXP_DECL
DLLEXP_DECL UINT __stdcall ProcessDeferredAction(_In_ MSIHANDLE hInstall)
Perform scheduled deferred action.
DLLEXP_DECL UINT __stdcall CloseOpenVPNGUI(_In_ MSIHANDLE hInstall)
Find OpenVPN GUI window and send it a WM_CLOSE message.
DWORD openvpnmsica_thread_data_idx
MSI session handle thread local storage index.
Definition dllmain.c:37
DLLEXP_DECL UINT __stdcall FindSystemInfo(_In_ MSIHANDLE hInstall)
Determines Windows information:
Thread local storage data.
MSIHANDLE hInstall
Handle to the installation session.
#define _In_
Definition basic.h:41