25#ifndef OPENVPN_WIN32_H
26#define OPENVPN_WIN32_H
38#define SYS_PATH_ENV_VAR_NAME "SystemRoot"
39#define NETSH_PATH_SUFFIX "\\system32\\netsh.exe"
40#define WIN_ROUTE_PATH_SUFFIX "\\system32\\route.exe"
41#define WIN_IPCONFIG_PATH_SUFFIX "\\system32\\ipconfig.exe"
42#define WIN_NET_PATH_SUFFIX "\\system32\\net.exe"
43#define WMIC_PATH_SUFFIX "\\system32\\wbem\\wmic.exe"
51#ifndef IN6_ARE_ADDR_EQUAL
52#define IN6_ARE_ADDR_EQUAL(a, b) \
53 (memcmp((const void *)(a), (const void *)(b), sizeof(struct in6_addr)) == 0)
52#define IN6_ARE_ADDR_EQUAL(a, b) \ …
64 SECURITY_ATTRIBUTES
sa;
65 SECURITY_DESCRIPTOR
sd;
68#define HANDLE_DEFINED(h) ((h) != NULL && (h) != INVALID_HANDLE_VALUE)
88#define NE32_PERSIST_EVENT (1<<0)
89#define NE32_WRITE_EVENT (1<<1)
94 return event->read != NULL;
154#define WSO_MODE_UNDEF 0
155#define WSO_MODE_SERVICE 1
156#define WSO_MODE_CONSOLE 2
170#define WSO_FORCE_SERVICE 1
171#define WSO_FORCE_CONSOLE 2
175 const char *exit_event_name,
176 bool exit_event_initial_state);
203#define IOSTATE_INITIAL 0
204#define IOSTATE_QUEUED 1
205#define IOSTATE_IMMEDIATE_RETURN 2
291bool win_wfp_block(
const NET_IFINDEX index,
const HANDLE msg_channel, BOOL dns_only);
293bool win_wfp_uninit(
const NET_IFINDEX index,
const HANDLE msg_channel);
Wrapper structure for dynamically allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
Contains all state information for one tunnel.
Packet geometry parameters.
Garbage collection arena used to keep track of dynamically allocated memory.
Container for unidirectional cipher and HMAC key material.
struct sockaddr_in6 addr6
bool console_mode_save_defined
char old_window_title[256]
SOCKET socket_descriptor_t
static bool net_event_win32_defined(const struct net_event_win32 *ne)
static bool defined_net_event_win32(const struct rw_handle *event)
void init_net_event_win32(struct rw_handle *event, long network_events, socket_descriptor_t sd, unsigned int flags)
void net_event_win32_init(struct net_event_win32 *ne)
void net_event_win32_close(struct net_event_win32 *ne)
void win32_signal_open(struct win32_signal *ws, int force, const char *exit_event_name, bool exit_event_initial_state)
void overlapped_io_init(struct overlapped_io *o, const struct frame *frame, BOOL event_state)
bool win_wfp_block(const NET_IFINDEX index, const HANDLE msg_channel, BOOL dns_only)
void window_title_generate(const char *title)
#define IOSTATE_IMMEDIATE_RETURN
void set_win_sys_path(const char *newpath, struct env_set *es)
void close_net_event_win32(struct rw_handle *event, socket_descriptor_t sd, unsigned int flags)
void window_title_clear(struct window_title *wt)
bool get_openvpn_reg_value(const WCHAR *key, WCHAR *value, DWORD size)
Fetches a registry value for OpenVPN registry key.
void window_title_save(struct window_title *wt)
void semaphore_clear(struct semaphore *s)
bool unprotect_buffer_win32(char *buf, size_t len)
Decrypt a previously encrypted region of memory using CryptUnProtectMemory() with access restricted t...
bool protect_buffer_win32(char *buf, size_t len)
Encrypt a region of memory using CryptProtectMemory() with access restricted to the current process.
bool plugin_in_trusted_dir(const WCHAR *plugin_path)
Checks if a plugin is located in a trusted directory.
void semaphore_close(struct semaphore *s)
static bool overlapped_io_active(struct overlapped_io *o)
void net_event_win32_reset_write(struct net_event_win32 *ne)
bool semaphore_lock(struct semaphore *s, int timeout_milliseconds)
void net_event_win32_start(struct net_event_win32 *ne, long network_events, socket_descriptor_t sd)
bool win_wfp_uninit(const NET_IFINDEX index, const HANDLE msg_channel)
void fork_to_self(const char *cmdline)
char * overlapped_io_state_ascii(const struct overlapped_io *o)
static long net_event_win32_get_event_mask(const struct net_event_win32 *ne)
bool send_msg_iservice(HANDLE pipe, const void *data, size_t size, ack_message_t *ack, const char *context)
void overlapped_io_close(struct overlapped_io *o)
void netcmd_semaphore_release(void)
void win32_sleep(const int n)
int openvpn_execve(const struct argv *a, const struct env_set *es, const unsigned int flags)
void semaphore_release(struct semaphore *s)
void set_win_sys_path_via_env(struct env_set *es)
long reset_net_event_win32(struct rw_handle *event, socket_descriptor_t sd)
void window_title_restore(const struct window_title *wt)
struct semaphore netcmd_semaphore
char * get_win_sys_path(void)
bool win32_service_interrupt(struct win32_signal *ws)
void win32_pause(struct win32_signal *ws)
static void net_event_win32_clear_selected_events(struct net_event_win32 *ne, long selected_events)
static struct rw_handle * net_event_win32_get_event(struct net_event_win32 *ne)
void netcmd_semaphore_init(void)
void netcmd_semaphore_lock(void)
void win32_signal_close(struct win32_signal *ws)
const char * win32_version_string(struct gc_arena *gc)
Get Windows version string with architecture info.
void win32_signal_clear(struct win32_signal *ws)
int win32_signal_get(struct win32_signal *ws)
void net_event_win32_reset(struct net_event_win32 *ne)
void netcmd_semaphore_close(void)
void set_pause_exit_win32(void)
bool init_security_attributes_allow_all(struct security_attributes *obj)
void semaphore_open(struct semaphore *s, const char *name)
void net_event_win32_stop(struct net_event_win32 *ne)