|
|
@ -848,6 +848,27 @@ StatusDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) |
|
|
|
case WM_DESTROY: |
|
|
|
case WM_DESTROY: |
|
|
|
PostQuitMessage(0); |
|
|
|
PostQuitMessage(0); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case WM_OVPN_STOP: |
|
|
|
|
|
|
|
c = (connection_t *) GetProp(hwndDlg, cfgProp); |
|
|
|
|
|
|
|
c->state = disconnecting; |
|
|
|
|
|
|
|
RunDisconnectScript(c, false); |
|
|
|
|
|
|
|
EnableWindow(GetDlgItem(c->hwndStatus, ID_DISCONNECT), FALSE); |
|
|
|
|
|
|
|
EnableWindow(GetDlgItem(c->hwndStatus, ID_RESTART), FALSE); |
|
|
|
|
|
|
|
SetMenuStatus(c, disconnecting); |
|
|
|
|
|
|
|
SetDlgItemText(c->hwndStatus, ID_TXT_STATUS, LoadLocalizedString(IDS_NFO_STATE_WAIT_TERM)); |
|
|
|
|
|
|
|
SetEvent(c->exit_event); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case WM_OVPN_SUSPEND: |
|
|
|
|
|
|
|
c = (connection_t *) GetProp(hwndDlg, cfgProp); |
|
|
|
|
|
|
|
c->state = suspending; |
|
|
|
|
|
|
|
EnableWindow(GetDlgItem(c->hwndStatus, ID_DISCONNECT), FALSE); |
|
|
|
|
|
|
|
EnableWindow(GetDlgItem(c->hwndStatus, ID_RESTART), FALSE); |
|
|
|
|
|
|
|
SetMenuStatus(c, disconnecting); |
|
|
|
|
|
|
|
SetDlgItemText(c->hwndStatus, ID_TXT_STATUS, LoadLocalizedString(IDS_NFO_STATE_WAIT_TERM)); |
|
|
|
|
|
|
|
SetEvent(c->exit_event); |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
return FALSE; |
|
|
|
return FALSE; |
|
|
|
} |
|
|
|
} |
|
|
@ -913,31 +934,7 @@ ThreadOpenVPNStatus(void *p) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (msg.hwnd == NULL) |
|
|
|
if (IsDialogMessage(c->hwndStatus, &msg) == 0) |
|
|
|
{ |
|
|
|
|
|
|
|
switch (msg.message) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case WM_OVPN_STOP: |
|
|
|
|
|
|
|
c->state = disconnecting; |
|
|
|
|
|
|
|
RunDisconnectScript(c, false); |
|
|
|
|
|
|
|
EnableWindow(GetDlgItem(c->hwndStatus, ID_DISCONNECT), FALSE); |
|
|
|
|
|
|
|
EnableWindow(GetDlgItem(c->hwndStatus, ID_RESTART), FALSE); |
|
|
|
|
|
|
|
SetMenuStatus(c, disconnecting); |
|
|
|
|
|
|
|
SetDlgItemText(c->hwndStatus, ID_TXT_STATUS, LoadLocalizedString(IDS_NFO_STATE_WAIT_TERM)); |
|
|
|
|
|
|
|
SetEvent(c->exit_event); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case WM_OVPN_SUSPEND: |
|
|
|
|
|
|
|
c->state = suspending; |
|
|
|
|
|
|
|
EnableWindow(GetDlgItem(c->hwndStatus, ID_DISCONNECT), FALSE); |
|
|
|
|
|
|
|
EnableWindow(GetDlgItem(c->hwndStatus, ID_RESTART), FALSE); |
|
|
|
|
|
|
|
SetMenuStatus(c, disconnecting); |
|
|
|
|
|
|
|
SetDlgItemText(c->hwndStatus, ID_TXT_STATUS, LoadLocalizedString(IDS_NFO_STATE_WAIT_TERM)); |
|
|
|
|
|
|
|
SetEvent(c->exit_event); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (IsDialogMessage(c->hwndStatus, &msg) == 0) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
TranslateMessage(&msg); |
|
|
|
TranslateMessage(&msg); |
|
|
|
DispatchMessage(&msg); |
|
|
|
DispatchMessage(&msg); |
|
|
@ -1158,14 +1155,14 @@ out: |
|
|
|
void |
|
|
|
void |
|
|
|
StopOpenVPN(connection_t *c) |
|
|
|
StopOpenVPN(connection_t *c) |
|
|
|
{ |
|
|
|
{ |
|
|
|
PostThreadMessage(c->threadId, WM_OVPN_STOP, 0, 0); |
|
|
|
PostMessage(c->hwndStatus, WM_OVPN_STOP, 0, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
|
SuspendOpenVPN(int config) |
|
|
|
SuspendOpenVPN(int config) |
|
|
|
{ |
|
|
|
{ |
|
|
|
PostThreadMessage(o.conn[config].threadId, WM_OVPN_SUSPEND, 0, 0); |
|
|
|
PostMessage(o.conn[config].hwndStatus, WM_OVPN_SUSPEND, 0, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|