OpenVPN
|
#include "msica_op.h"
#include "../tapctl/error.h"
#include "../tapctl/tap.h"
#include <windows.h>
#include <malloc.h>
#include <msiquery.h>
#include <objbase.h>
Go to the source code of this file.
Data Structures | |
struct | msica_op_hdr |
Operation data persist header. More... | |
Functions | |
void | msica_op_seq_init (_Inout_ struct msica_op_seq *seq) |
Initializes operation sequence. More... | |
void | msica_op_seq_free (_Inout_ struct msica_op_seq *seq) |
Frees operation sequence. More... | |
struct msica_op * | msica_op_create_bool (_In_ enum msica_op_type type, _In_ int ticks, _In_opt_ struct msica_op *next, _In_ bool value) |
Allocates and fills a new msica_op_bool operation. More... | |
struct msica_op * | msica_op_create_string (_In_ enum msica_op_type type, _In_ int ticks, _In_opt_ struct msica_op *next, _In_z_ LPCTSTR value) |
Allocates and fills a new msica_op_string operation. More... | |
struct msica_op * | msica_op_create_multistring_va (_In_ enum msica_op_type type, _In_ int ticks, _In_opt_ struct msica_op *next, _In_ va_list arglist) |
Allocates and fills a new msica_op_multistring operation. More... | |
struct msica_op * | msica_op_create_guid (_In_ enum msica_op_type type, _In_ int ticks, _In_opt_ struct msica_op *next, _In_ const GUID *value) |
Allocates and fills a new msica_op_guid operation. More... | |
struct msica_op * | msica_op_create_guid_string (_In_ enum msica_op_type type, _In_ int ticks, _In_opt_ struct msica_op *next, _In_ const GUID *value_guid, _In_z_ LPCTSTR value_str) |
Allocates and fills a new msica_op_guid_string operation. More... | |
void | msica_op_seq_add_head (_Inout_ struct msica_op_seq *seq, _Inout_ struct msica_op *operation) |
Inserts operation(s) to the beginning of the operation sequence. More... | |
void | msica_op_seq_add_tail (_Inout_ struct msica_op_seq *seq, _Inout_ struct msica_op *operation) |
Appends operation(s) to the end of the operation sequence. More... | |
DWORD | msica_op_seq_save (_In_ const struct msica_op_seq *seq, _In_ HANDLE hFile) |
Saves the operation sequence to the file. More... | |
DWORD | msica_op_seq_load (_Inout_ struct msica_op_seq *seq, _In_ HANDLE hFile) |
Loads the operation sequence from the file. More... | |
static DWORD | msica_op_tap_interface_create_exec (_Inout_ const struct msica_op_string *op, _Inout_ struct msica_session *session) |
static DWORD | msica_op_tap_interface_delete (_In_ struct tap_interface_node *pInterfaceList, _In_ struct tap_interface_node *pInterface, _Inout_ struct msica_session *session) |
static DWORD | msica_op_tap_interface_delete_by_name_exec (_Inout_ const struct msica_op_string *op, _Inout_ struct msica_session *session) |
static DWORD | msica_op_tap_interface_delete_by_guid_exec (_Inout_ const struct msica_op_guid *op, _Inout_ struct msica_session *session) |
static DWORD | msica_op_tap_interface_set_name_exec (_Inout_ const struct msica_op_guid_string *op, _Inout_ struct msica_session *session) |
static DWORD | msica_op_file_delete_exec (_Inout_ const struct msica_op_string *op, _Inout_ struct msica_session *session) |
static DWORD | msica_op_file_move_exec (_Inout_ const struct msica_op_multistring *op, _Inout_ struct msica_session *session) |
void | openvpnmsica_session_init (_Inout_ struct msica_session *session, _In_ MSIHANDLE hInstall, _In_ bool continue_on_error, _In_ bool rollback_enabled) |
Initializes execution session. More... | |
DWORD | msica_op_seq_process (_Inout_ const struct msica_op_seq *seq, _Inout_ struct msica_session *session) |
Executes all operations in sequence. More... | |
struct msica_op* msica_op_create_bool | ( | _In_ enum msica_op_type | type, |
_In_ int | ticks, | ||
_In_opt_ struct msica_op * | next, | ||
_In_ bool | value | ||
) |
Allocates and fills a new msica_op_bool operation.
type | Operation type |
ticks | Number of ticks on the progress indicator this operation represents |
next | Pointer to the next operation in the sequence |
value | Boolean value |
Definition at line 75 of file msica_op.c.
References msica_op_bool::base, M_FATAL, M_NONFATAL, malloc, msg, MSICA_OP_TYPE_DATA, msica_op::next, msica_op_hdr::ticks, msica_op::ticks, msica_op::type, msica_op_hdr::type, and msica_op_bool::value.
Referenced by EvaluateTAPInterfaces().
struct msica_op* msica_op_create_guid | ( | _In_ enum msica_op_type | type, |
_In_ int | ticks, | ||
_In_opt_ struct msica_op * | next, | ||
_In_ const GUID * | value | ||
) |
Allocates and fills a new msica_op_guid operation.
type | Operation type |
ticks | Number of ticks on the progress indicator this operation represents |
next | Pointer to the next operation in the sequence |
value | Pointer to GUID value |
Definition at line 181 of file msica_op.c.
References msica_op_guid::base, M_FATAL, M_NONFATAL, malloc, msg, MSICA_OP_TYPE_DATA, msica_op::next, msica_op_hdr::ticks, msica_op::ticks, msica_op::type, msica_op_hdr::type, and msica_op_guid::value.
Referenced by msica_op_tap_interface_create_exec().
struct msica_op* msica_op_create_guid_string | ( | _In_ enum msica_op_type | type, |
_In_ int | ticks, | ||
_In_opt_ struct msica_op * | next, | ||
_In_ const GUID * | value_guid, | ||
_In_z_ LPCTSTR | value_str | ||
) |
Allocates and fills a new msica_op_guid_string operation.
type | Operation type |
ticks | Number of ticks on the progress indicator this operation represents |
next | Pointer to the next operation in the sequence |
value_guid | Pointer to GUID value |
value_str | String value |
Definition at line 211 of file msica_op.c.
References msica_op_guid_string::base, M_FATAL, M_NONFATAL, malloc, msg, MSICA_OP_TYPE_DATA, msica_op::next, msica_op_hdr::ticks, msica_op::ticks, msica_op::type, msica_op_hdr::type, msica_op_guid_string::value_guid, and msica_op_guid_string::value_str.
Referenced by msica_op_tap_interface_set_name_exec().
struct msica_op* msica_op_create_multistring_va | ( | _In_ enum msica_op_type | type, |
_In_ int | ticks, | ||
_In_opt_ struct msica_op * | next, | ||
_In_ va_list | arglist | ||
) |
Allocates and fills a new msica_op_multistring operation.
type | Operation type |
ticks | Number of ticks on the progress indicator this operation represents |
next | Pointer to the next operation in the sequence |
arglist | List of non-empty strings. The last string must be NULL. |
Definition at line 136 of file msica_op.c.
References msica_op_multistring::base, M_FATAL, M_NONFATAL, malloc, msg, MSICA_OP_TYPE_DATA, msica_op::next, msica_op_hdr::ticks, msica_op::ticks, msica_op::type, msica_op_hdr::type, and msica_op_multistring::value.
Referenced by msica_op_create_multistring().
struct msica_op* msica_op_create_string | ( | _In_ enum msica_op_type | type, |
_In_ int | ticks, | ||
_In_opt_ struct msica_op * | next, | ||
_In_z_ LPCTSTR | value | ||
) |
Allocates and fills a new msica_op_string operation.
type | Operation type |
ticks | Number of ticks on the progress indicator this operation represents |
next | Pointer to the next operation in the sequence |
value | String value |
Definition at line 105 of file msica_op.c.
References msica_op_string::base, M_FATAL, M_NONFATAL, malloc, msg, MSICA_OP_TYPE_DATA, msica_op::next, msica_op_hdr::ticks, msica_op::ticks, msica_op::type, msica_op_hdr::type, and msica_op_string::value.
Referenced by EvaluateTAPInterfaces(), msica_op_file_delete_exec(), msica_op_tap_interface_delete(), and ProcessDeferredAction().
|
static |
Definition at line 783 of file msica_op.c.
References free, M_ERRNO, M_FATAL, M_NONFATAL, malloc, msg, MSICA_CLEANUP_ACTION_COMMIT, MSICA_CLEANUP_ACTION_ROLLBACK, msica_op_create_multistring(), msica_op_create_string(), msica_op_file_delete, msica_op_file_move, msica_op_seq_add_head(), msica_op_seq_add_tail(), and PRIsLPTSTR.
Referenced by msica_op_seq_process().
|
static |
Definition at line 882 of file msica_op.c.
References M_ERRNO, M_NONFATAL, msg, MSICA_CLEANUP_ACTION_ROLLBACK, msica_op_create_multistring(), msica_op_file_move, msica_op_seq_add_head(), and PRIsLPTSTR.
Referenced by msica_op_seq_process().
void msica_op_seq_add_head | ( | _Inout_ struct msica_op_seq * | seq, |
_Inout_ struct msica_op * | operation | ||
) |
Inserts operation(s) to the beginning of the operation sequence.
seq | Pointer to operation sequence |
operation | Pointer to the operation to insert. All operations in the list are added until the list is terminated with msica_op.next field set to NULL. Operations must be allocated using malloc(). |
Definition at line 244 of file msica_op.c.
References msica_op::next.
Referenced by msica_op_file_delete_exec(), msica_op_file_move_exec(), msica_op_seq_is_empty(), msica_op_tap_interface_create_exec(), msica_op_tap_interface_delete(), and msica_op_tap_interface_set_name_exec().
void msica_op_seq_add_tail | ( | _Inout_ struct msica_op_seq * | seq, |
_Inout_ struct msica_op * | operation | ||
) |
Appends operation(s) to the end of the operation sequence.
seq | Pointer to operation sequence |
operation | Pointer to the operation to append. All operations in the list are added until the list is terminated with msica_op.next field set to NULL. Operations must be allocated using malloc(). |
Definition at line 270 of file msica_op.c.
References msica_op::next.
Referenced by EvaluateTAPInterfaces(), msica_op_file_delete_exec(), msica_op_seq_is_empty(), msica_op_seq_load(), and ProcessDeferredAction().
void msica_op_seq_free | ( | _Inout_ struct msica_op_seq * | seq | ) |
Frees operation sequence.
seq | Pointer to operation sequence |
Definition at line 62 of file msica_op.c.
References free, and msica_op::next.
Referenced by EvaluateTAPInterfaces(), and ProcessDeferredAction().
void msica_op_seq_init | ( | _Inout_ struct msica_op_seq * | seq | ) |
Initializes operation sequence.
seq | Pointer to uninitialized operation sequence |
Definition at line 54 of file msica_op.c.
Referenced by EvaluateTAPInterfaces(), and openvpnmsica_session_init().
DWORD msica_op_seq_load | ( | _Inout_ struct msica_op_seq * | seq, |
_In_ HANDLE | hFile | ||
) |
Loads the operation sequence from the file.
seq | Pointer to uninitialized or empty operation sequence |
hFile | Handle of the file opened with GENERIC_READ access |
Definition at line 362 of file msica_op.c.
References free, M_ERRNO, M_FATAL, M_NONFATAL, malloc, msg, msica_op_seq_add_tail(), msica_op::next, msica_op_hdr::size_data, msica_op_hdr::ticks, msica_op::ticks, msica_op::type, and msica_op_hdr::type.
Referenced by msica_op_seq_is_empty(), and ProcessDeferredAction().
DWORD msica_op_seq_process | ( | _Inout_ const struct msica_op_seq * | seq, |
_Inout_ struct msica_session * | session | ||
) |
Executes all operations in sequence.
seq | Pointer to operation sequence |
session | MSI session. The execution updates its members, most notably rollback_enabled and fills cleanup sequences with commit/rollback operations. |
Definition at line 963 of file msica_op.c.
References M_NONFATAL, msg, msica_op_file_delete, msica_op_file_delete_exec(), msica_op_file_move, msica_op_file_move_exec(), msica_op_rollback_enable, msica_op_tap_interface_create, msica_op_tap_interface_create_exec(), msica_op_tap_interface_delete_by_guid, msica_op_tap_interface_delete_by_guid_exec(), msica_op_tap_interface_delete_by_name, msica_op_tap_interface_delete_by_name_exec(), msica_op_tap_interface_set_name, msica_op_tap_interface_set_name_exec(), and msica_op::next.
Referenced by ProcessDeferredAction().
DWORD msica_op_seq_save | ( | _In_ const struct msica_op_seq * | seq, |
_In_ HANDLE | hFile | ||
) |
Saves the operation sequence to the file.
seq | Pointer to operation sequence |
hFile | Handle of the file opened with GENERIC_WRITE access |
Definition at line 297 of file msica_op.c.
References M_ERRNO, M_NONFATAL, msg, MSICA_OP_TYPE_DATA, msica_op::next, msica_op_hdr::size_data, msica_op_hdr::ticks, msica_op_hdr::type, msica_op_string::value, and msica_op_multistring::value.
Referenced by EvaluateTAPInterfaces(), msica_op_seq_is_empty(), and ProcessDeferredAction().
|
static |
Definition at line 425 of file msica_op.c.
References M_NONFATAL, msg, MSICA_CLEANUP_ACTION_ROLLBACK, msica_op_create_guid(), msica_op_seq_add_head(), msica_op_tap_interface_delete_by_guid, tap_interface_node::pNext, PRIsLPTSTR, tap_create_interface(), tap_delete_interface(), tap_free_interface_list(), tap_list_interfaces(), tap_set_interface_name(), and TAP_WIN_COMPONENT_ID.
Referenced by msica_op_seq_process().
|
static |
Definition at line 524 of file msica_op.c.
References MSICA_CLEANUP_ACTION_ROLLBACK, msica_op_create_string(), msica_op_seq_add_head(), msica_op_tap_interface_create, and tap_delete_interface().
Referenced by msica_op_tap_interface_delete_by_guid_exec(), and msica_op_tap_interface_delete_by_name_exec().
|
static |
Definition at line 635 of file msica_op.c.
References msica_op_tap_interface_delete(), tap_interface_node::pNext, tap_free_interface_list(), and tap_list_interfaces().
Referenced by msica_op_seq_process().
|
static |
Definition at line 580 of file msica_op.c.
References msica_op_tap_interface_delete(), tap_interface_node::pNext, tap_free_interface_list(), and tap_list_interfaces().
Referenced by msica_op_seq_process().
|
static |
Definition at line 693 of file msica_op.c.
References M_NONFATAL, msg, MSICA_CLEANUP_ACTION_ROLLBACK, msica_op_create_guid_string(), msica_op_seq_add_head(), msica_op_tap_interface_set_name, tap_interface_node::pNext, PRIsLPOLESTR, PRIsLPTSTR, tap_free_interface_list(), tap_list_interfaces(), and tap_set_interface_name().
Referenced by msica_op_seq_process().
void openvpnmsica_session_init | ( | _Inout_ struct msica_session * | session, |
_In_ MSIHANDLE | hInstall, | ||
_In_ bool | continue_on_error, | ||
_In_ bool | rollback_enabled | ||
) |
Initializes execution session.
session | Pointer to an uninitialized execution session |
hInstall | Installer handle |
continue_on_error | Continue execution on operation error? |
rollback_enabled | Is rollback enabled? |
Definition at line 946 of file msica_op.c.
References MSICA_CLEANUP_ACTION_COUNT, and msica_op_seq_init().
Referenced by ProcessDeferredAction().