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-2023 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 
48 extern DWORD openvpnmsica_thread_data_idx;
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
66 extern "C" {
67 #endif
68 
69 #ifdef __GNUC__
70 #define DLLEXP_DECL __declspec(dllexport)
71 #else
72 #define DLLEXP_DECL
73 #define DLLEXP_EXPORT "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__
74 #endif
75 
76 
100 DLLEXP_DECL UINT __stdcall
101 FindSystemInfo(_In_ MSIHANDLE hInstall);
102 
103 
112 DLLEXP_DECL UINT __stdcall
113 CloseOpenVPNGUI(_In_ MSIHANDLE hInstall);
114 
115 
125 DLLEXP_DECL UINT __stdcall
126 StartOpenVPNGUI(_In_ MSIHANDLE hInstall);
127 
128 
138 DLLEXP_DECL UINT __stdcall
139 EvaluateTUNTAPAdapters(_In_ MSIHANDLE hInstall);
140 
141 
150 DLLEXP_DECL UINT __stdcall
151 ProcessDeferredAction(_In_ MSIHANDLE hInstall);
152 
153 
163 DLLEXP_DECL UINT __stdcall
164 CheckAndScheduleReboot(_In_ MSIHANDLE hInstall);
165 
166 #ifdef __cplusplus
167 }
168 #endif
169 
170 #endif /* ifndef MSICA_H */
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:634
DLLEXP_DECL
#define DLLEXP_DECL
Definition: openvpnmsica.h:72
StartOpenVPNGUI
DLLEXP_DECL UINT __stdcall StartOpenVPNGUI(_In_ MSIHANDLE hInstall)
Launches OpenVPN GUI.
Definition: openvpnmsica.c:361
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
_In_
#define _In_
Definition: basic.h:42
ProcessDeferredAction
DLLEXP_DECL UINT __stdcall ProcessDeferredAction(_In_ MSIHANDLE hInstall)
Perform scheduled deferred action.
Definition: openvpnmsica.c:963
FindSystemInfo
DLLEXP_DECL UINT __stdcall FindSystemInfo(_In_ MSIHANDLE hInstall)
Determines Windows information:
Definition: openvpnmsica.c:301
CloseOpenVPNGUI
DLLEXP_DECL UINT __stdcall CloseOpenVPNGUI(_In_ MSIHANDLE hInstall)
Find OpenVPN GUI window and send it a WM_CLOSE message.
Definition: openvpnmsica.c:338
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:1163
openvpnmsica_thread_data
Thread local storage data.
Definition: openvpnmsica.h:39