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-2024 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, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#ifndef MSICA_H
22#define MSICA_H
23
24#include <windows.h>
25#include <msi.h>
26#include "../tapctl/basic.h"
27
28
29/*
30 * Error codes (next unused 2552L)
31 */
32#define ERROR_MSICA 2550L
33#define ERROR_MSICA_ERRNO 2551L
34
35
40{
41 MSIHANDLE hInstall;
42};
43
44
49
50
54#define OPENVPNMSICA_SAVE_MSI_SESSION(hInstall) \
55 { \
56 struct openvpnmsica_thread_data *s = (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#endif
68
69/* Ensure that clang-cl, which does not understand the cl specific
70 * preprocessor defines like #pragma comment(linker, DLLEXP_EXPORT)
71 * is handled the same way as mingw and uses the alternative instead
72 * and does not define DLLEXP_EXPORT */
73#if defined(__GNUC__) || defined(__clang__)
74#define DLLEXP_DECL __declspec(dllexport)
75#else
76#define DLLEXP_DECL
77#define DLLEXP_EXPORT "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__
78#endif
79
80
104DLLEXP_DECL UINT __stdcall
105FindSystemInfo(_In_ MSIHANDLE hInstall);
106
107
116DLLEXP_DECL UINT __stdcall
117CloseOpenVPNGUI(_In_ MSIHANDLE hInstall);
118
119
129DLLEXP_DECL UINT __stdcall
130StartOpenVPNGUI(_In_ MSIHANDLE hInstall);
131
132
142DLLEXP_DECL UINT __stdcall
143EvaluateTUNTAPAdapters(_In_ MSIHANDLE hInstall);
144
145
154DLLEXP_DECL UINT __stdcall
155ProcessDeferredAction(_In_ MSIHANDLE hInstall);
156
157
167DLLEXP_DECL UINT __stdcall
168CheckAndScheduleReboot(_In_ MSIHANDLE hInstall);
169
170#ifdef __cplusplus
171}
172#endif
173
174#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:38
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:42