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 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 
88 DLLEXP_DECL UINT __stdcall
89 FindSystemInfo(_In_ MSIHANDLE hInstall);
90 
91 
101 DLLEXP_DECL UINT __stdcall
102 FindTAPInterfaces(_In_ MSIHANDLE hInstall);
103 
104 
113 DLLEXP_DECL UINT __stdcall
114 CloseOpenVPNGUI(_In_ MSIHANDLE hInstall);
115 
116 
126 DLLEXP_DECL UINT __stdcall
127 StartOpenVPNGUI(_In_ MSIHANDLE hInstall);
128 
129 
139 DLLEXP_DECL UINT __stdcall
141 
142 
151 DLLEXP_DECL UINT __stdcall
153 
154 #ifdef __cplusplus
155 }
156 #endif
157 
158 #endif /* ifndef MSICA_H */
DLLEXP_DECL UINT __stdcall FindSystemInfo(_In_ MSIHANDLE hInstall)
Determines Windows information:
Definition: openvpnmsica.c:442
Thread local storage data.
Definition: openvpnmsica.h:39
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.
Definition: openvpnmsica.c:631
#define _In_
Definition: basic.h:34
DLLEXP_DECL UINT __stdcall FindTAPInterfaces(_In_ MSIHANDLE hInstall)
Find existing TAP interfaces and set TAPINTERFACES property with semicolon delimited list of installe...
Definition: openvpnmsica.c:466
#define DLLEXP_DECL
Definition: openvpnmsica.h:72
DLLEXP_DECL UINT __stdcall StartOpenVPNGUI(_In_ MSIHANDLE hInstall)
Launches OpenVPN GUI.
Definition: openvpnmsica.c:654
DWORD openvpnmsica_thread_data_idx
MSI session handle thread local storage index.
Definition: dllmain.c:40
DLLEXP_DECL UINT __stdcall EvaluateTAPInterfaces(_In_ MSIHANDLE hInstall)
Evaluate the TAPInterface table of the MSI package database and prepare a list of TAP interfaces to i...
Definition: openvpnmsica.c:740