* @return ERROR_SUCCESS on success; An error code otherwise
*/
static UINT
-openvpnmsica_setup_sequence(
+setup_sequence(
_In_ MSIHANDLE hInstall,
_In_z_ LPCTSTR szProperty,
_In_ struct msica_arg_seq *seq)
* title.
*/
static void
-_openvpnmsica_debug_popup(_In_z_ LPCTSTR szFunctionName)
+_debug_popup(_In_z_ LPCTSTR szFunctionName)
{
TCHAR szTitle[0x100], szMessage[0x100+MAX_PATH], szProcessPath[MAX_PATH];
MessageBox(NULL, szMessage, szTitle, MB_OK);
}
-#define openvpnmsica_debug_popup(f) _openvpnmsica_debug_popup(f)
+#define debug_popup(f) _debug_popup(f)
#else /* ifdef _DEBUG */
-#define openvpnmsica_debug_popup(f)
+#define debug_popup(f)
#endif /* ifdef _DEBUG */
* See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa368072.aspx
*/
static UINT
-openvpnmsica_set_openvpnserv_state(_In_ MSIHANDLE hInstall)
+set_openvpnserv_state(_In_ MSIHANDLE hInstall)
{
UINT uiResult;
#pragma comment(linker, DLLEXP_EXPORT)
#endif
- openvpnmsica_debug_popup(TEXT(__FUNCTION__));
+ debug_popup(TEXT(__FUNCTION__));
BOOL bIsCoInitialized = SUCCEEDED(CoInitialize(NULL));
OPENVPNMSICA_SAVE_MSI_SESSION(hInstall);
- openvpnmsica_set_openvpnserv_state(hInstall);
+ set_openvpnserv_state(hInstall);
if (bIsCoInitialized)
{
#pragma comment(linker, DLLEXP_EXPORT)
#endif
- openvpnmsica_debug_popup(TEXT(__FUNCTION__));
+ debug_popup(TEXT(__FUNCTION__));
UINT uiResult;
BOOL bIsCoInitialized = SUCCEEDED(CoInitialize(NULL));
#endif
UNREFERENCED_PARAMETER(hInstall); /* This CA is does not interact with MSI session (report errors, access properties, tables, etc.). */
- openvpnmsica_debug_popup(TEXT(__FUNCTION__));
+ debug_popup(TEXT(__FUNCTION__));
/* Find OpenVPN GUI window. */
HWND hWnd = FindWindow(TEXT("OpenVPN-GUI"), NULL);
#pragma comment(linker, DLLEXP_EXPORT)
#endif
- openvpnmsica_debug_popup(TEXT(__FUNCTION__));
+ debug_popup(TEXT(__FUNCTION__));
UINT uiResult;
BOOL bIsCoInitialized = SUCCEEDED(CoInitialize(NULL));
* @return ERROR_SUCCESS on success; An error code otherwise
*/
static DWORD
-openvpnmsica_schedule_interface_create(_Inout_ struct msica_arg_seq *seq, _Inout_opt_ struct msica_arg_seq *seqRollback, _In_z_ LPCTSTR szDisplayName, _Inout_ int *iTicks)
+schedule_interface_create(
+ _Inout_ struct msica_arg_seq *seq,
+ _Inout_opt_ struct msica_arg_seq *seqRollback,
+ _In_z_ LPCTSTR szDisplayName,
+ _Inout_ int *iTicks)
{
/* Get all available network interfaces. */
struct tap_interface_node *pInterfaceList = NULL;
* @return ERROR_SUCCESS on success; An error code otherwise
*/
static DWORD
-openvpnmsica_schedule_interface_delete(_Inout_ struct msica_arg_seq *seq, _Inout_opt_ struct msica_arg_seq *seqCommit, _Inout_opt_ struct msica_arg_seq *seqRollback, _In_z_ LPCTSTR szDisplayName, _Inout_ int *iTicks)
+schedule_interface_delete(
+ _Inout_ struct msica_arg_seq *seq,
+ _Inout_opt_ struct msica_arg_seq *seqCommit,
+ _Inout_opt_ struct msica_arg_seq *seqRollback,
+ _In_z_ LPCTSTR szDisplayName,
+ _Inout_ int *iTicks)
{
/* Get available TUN/TAP interfaces. */
struct tap_interface_node *pInterfaceList = NULL;
#pragma comment(linker, DLLEXP_EXPORT)
#endif
- openvpnmsica_debug_popup(TEXT(__FUNCTION__));
+ debug_popup(TEXT(__FUNCTION__));
UINT uiResult;
BOOL bIsCoInitialized = SUCCEEDED(CoInitialize(NULL));
free(szValue);
/* Component is or should be installed. Schedule interface creation. */
- if (openvpnmsica_schedule_interface_create(
+ if (schedule_interface_create(
&seqInstallTAPInterfaces,
bRollbackEnabled ? &seqInstallTAPInterfacesRollback : NULL,
szDisplayNameEx,
* Note: On interface removal (product is being uninstalled), we tolerate dwResult error.
* Better a partial uninstallation than no uninstallation at all.
*/
- openvpnmsica_schedule_interface_delete(
+ schedule_interface_delete(
&seqUninstallTAPInterfaces,
bRollbackEnabled ? &seqUninstallTAPInterfacesCommit : NULL,
bRollbackEnabled ? &seqUninstallTAPInterfacesRollback : NULL,
}
/* Store deferred custom action parameters. */
- if ((uiResult = openvpnmsica_setup_sequence(hInstall, TEXT("InstallTAPInterfaces" ), &seqInstallTAPInterfaces )) != ERROR_SUCCESS
- || (uiResult = openvpnmsica_setup_sequence(hInstall, TEXT("InstallTAPInterfacesCommit" ), &seqInstallTAPInterfacesCommit )) != ERROR_SUCCESS
- || (uiResult = openvpnmsica_setup_sequence(hInstall, TEXT("InstallTAPInterfacesRollback" ), &seqInstallTAPInterfacesRollback )) != ERROR_SUCCESS
- || (uiResult = openvpnmsica_setup_sequence(hInstall, TEXT("UninstallTAPInterfaces" ), &seqUninstallTAPInterfaces )) != ERROR_SUCCESS
- || (uiResult = openvpnmsica_setup_sequence(hInstall, TEXT("UninstallTAPInterfacesCommit" ), &seqUninstallTAPInterfacesCommit )) != ERROR_SUCCESS
- || (uiResult = openvpnmsica_setup_sequence(hInstall, TEXT("UninstallTAPInterfacesRollback"), &seqUninstallTAPInterfacesRollback)) != ERROR_SUCCESS)
+ if ((uiResult = setup_sequence(hInstall, TEXT("InstallTAPInterfaces" ), &seqInstallTAPInterfaces )) != ERROR_SUCCESS
+ || (uiResult = setup_sequence(hInstall, TEXT("InstallTAPInterfacesCommit" ), &seqInstallTAPInterfacesCommit )) != ERROR_SUCCESS
+ || (uiResult = setup_sequence(hInstall, TEXT("InstallTAPInterfacesRollback" ), &seqInstallTAPInterfacesRollback )) != ERROR_SUCCESS
+ || (uiResult = setup_sequence(hInstall, TEXT("UninstallTAPInterfaces" ), &seqUninstallTAPInterfaces )) != ERROR_SUCCESS
+ || (uiResult = setup_sequence(hInstall, TEXT("UninstallTAPInterfacesCommit" ), &seqUninstallTAPInterfacesCommit )) != ERROR_SUCCESS
+ || (uiResult = setup_sequence(hInstall, TEXT("UninstallTAPInterfacesRollback"), &seqUninstallTAPInterfacesRollback)) != ERROR_SUCCESS)
{
goto cleanup_hRecordProg;
}
* @return TRUE on success; FALSE otherwise
*/
static BOOL
-openvpnmsica_parse_guid(_In_z_ LPCWSTR szArg, _Out_ GUID *guid)
+parse_guid(
+ _In_z_ LPCWSTR szArg,
+ _Out_ GUID *guid)
{
if (swscanf_s(szArg, _L(PRIXGUID), PRIGUID_PARAM_REF(*guid)) != 11)
{
#pragma comment(linker, DLLEXP_EXPORT)
#endif
- openvpnmsica_debug_popup(TEXT(__FUNCTION__));
+ debug_popup(TEXT(__FUNCTION__));
UINT uiResult;
BOOL bIsCoInitialized = SUCCEEDED(CoInitialize(NULL));
{
/* Delete the interface by GUID. */
GUID guid;
- if (!openvpnmsica_parse_guid(szArg[i] + 7, &guid))
+ if (!parse_guid(szArg[i] + 7, &guid))
{
goto invalid_argument;
}
{
/* Enable the interface. */
GUID guid;
- if (!openvpnmsica_parse_guid(szArg[i] + 7, &guid))
+ if (!parse_guid(szArg[i] + 7, &guid))
{
goto invalid_argument;
}
{
/* Disable the interface. */
GUID guid;
- if (!openvpnmsica_parse_guid(szArg[i] + 8, &guid))
+ if (!parse_guid(szArg[i] + 8, &guid))
{
goto invalid_argument;
}