OpenVPN
win32-util.c File Reference
#include "syshead.h"
#include "buffer.h"
#include "win32-util.h"
Include dependency graph for win32-util.c:

Go to the source code of this file.

Macros

#define CMD_QUOTE_TRIGGERS   " &|<>^%()!"

Functions

WCHAR * wide_string (const char *utf8, struct gc_arena *gc)
static bool argv_element_needs_quotes (const char *str)
WCHAR * wide_cmd_line (const struct argv *a, struct gc_arena *gc)
char * utf16to8 (const wchar_t *utf16, struct gc_arena *gc)
static bool cmp_prefix (const char *str, const bool n, const char *pre)
bool win_safe_filename (const char *fn)
const char * win_get_tempdir (void)
bool win_path_in_dir (const WCHAR *path, const WCHAR *dir)
 Check whether path resides within directory dir.

Macro Definition Documentation

◆ CMD_QUOTE_TRIGGERS

#define CMD_QUOTE_TRIGGERS   " &|<>^%()!"

Definition at line 49 of file win32-util.c.

Referenced by argv_element_needs_quotes().

Function Documentation

◆ argv_element_needs_quotes()

bool argv_element_needs_quotes ( const char * str)
static

Definition at line 52 of file win32-util.c.

References CMD_QUOTE_TRIGGERS.

Referenced by wide_cmd_line().

◆ cmp_prefix()

bool cmp_prefix ( const char * str,
const bool n,
const char * pre )
static

Definition at line 145 of file win32-util.c.

Referenced by win_safe_filename().

◆ utf16to8()

char * utf16to8 ( const wchar_t * utf16,
struct gc_arena * gc )

Definition at line 119 of file win32-util.c.

References gc, and gc_malloc().

Referenced by strerror_win32().

◆ wide_cmd_line()

◆ wide_string()

◆ win_get_tempdir()

const char * win_get_tempdir ( void )

Definition at line 220 of file win32-util.c.

References M_ERRNO, M_WARN, and msg.

Referenced by platform_get_tmp_dir().

◆ win_path_in_dir()

bool win_path_in_dir ( const WCHAR * path,
const WCHAR * dir )

Check whether path resides within directory dir.

Unlike a plain string prefix match, this requires the match to end on a path-component boundary, so that "C:\\foo_evil\\bar" is not considered to be inside "C:\\foo". Both arguments are expected to be normalized absolute paths. The comparison is case-insensitive.

Returns
true if path is inside dir, false otherwise.

Definition at line 249 of file win32-util.c.

Referenced by plugin_in_trusted_dir(), and test_win_path_in_dir().

◆ win_safe_filename()

bool win_safe_filename ( const char * fn)

Definition at line 186 of file win32-util.c.

References cmp_prefix().

Referenced by platform_gen_path().