mirror of https://github.com/OpenVPN/openvpn-gui
fix loading of the proxy source from registry
parent
9d918954d5
commit
6934dfa783
337
proxy.c
337
proxy.c
|
@ -39,141 +39,143 @@
|
||||||
|
|
||||||
extern options_t o;
|
extern options_t o;
|
||||||
|
|
||||||
bool CALLBACK ProxySettingsDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, UNUSED LPARAM lParam)
|
bool CALLBACK
|
||||||
|
ProxySettingsDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, UNUSED LPARAM lParam)
|
||||||
{
|
{
|
||||||
HICON hIcon;
|
HICON hIcon;
|
||||||
LPPSHNOTIFY psn;
|
LPPSHNOTIFY psn;
|
||||||
|
|
||||||
switch (msg) {
|
|
||||||
|
|
||||||
|
switch (msg)
|
||||||
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
hIcon = LoadLocalizedIcon(ID_ICO_APP);
|
hIcon = LoadLocalizedIcon(ID_ICO_APP);
|
||||||
if (hIcon) {
|
if (hIcon)
|
||||||
SendMessage(hwndDlg, WM_SETICON, (WPARAM) (ICON_SMALL), (LPARAM) (hIcon));
|
{
|
||||||
SendMessage(hwndDlg, WM_SETICON, (WPARAM) (ICON_BIG), (LPARAM) (hIcon));
|
SendMessage(hwndDlg, WM_SETICON, (WPARAM) (ICON_SMALL), (LPARAM) (hIcon));
|
||||||
}
|
SendMessage(hwndDlg, WM_SETICON, (WPARAM) (ICON_BIG), (LPARAM) (hIcon));
|
||||||
|
}
|
||||||
|
|
||||||
/* Limit Port editbox to 5 chars. */
|
/* Limit Port editbox to 5 chars. */
|
||||||
SendMessage(GetDlgItem(hwndDlg, ID_EDT_PROXY_PORT), EM_SETLIMITTEXT, 5, 0);
|
SendMessage(GetDlgItem(hwndDlg, ID_EDT_PROXY_PORT), EM_SETLIMITTEXT, 5, 0);
|
||||||
|
|
||||||
LoadProxySettings(hwndDlg);
|
LoadProxySettings(hwndDlg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
case ID_RB_PROXY_OPENVPN:
|
case ID_RB_PROXY_OPENVPN:
|
||||||
if (HIWORD(wParam) == BN_CLICKED)
|
if (HIWORD(wParam) == BN_CLICKED)
|
||||||
{
|
{
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_RB_PROXY_HTTP), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_RB_PROXY_HTTP), FALSE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_RB_PROXY_SOCKS), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_RB_PROXY_SOCKS), FALSE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_EDT_PROXY_ADDRESS), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_EDT_PROXY_ADDRESS), FALSE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_EDT_PROXY_PORT), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_EDT_PROXY_PORT), FALSE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_TXT_PROXY_ADDRESS), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_TXT_PROXY_ADDRESS), FALSE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_TXT_PROXY_PORT), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_TXT_PROXY_PORT), FALSE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_RB_PROXY_MSIE:
|
case ID_RB_PROXY_MSIE:
|
||||||
if (HIWORD(wParam) == BN_CLICKED)
|
if (HIWORD(wParam) == BN_CLICKED)
|
||||||
{
|
{
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_RB_PROXY_HTTP), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_RB_PROXY_HTTP), FALSE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_RB_PROXY_SOCKS), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_RB_PROXY_SOCKS), FALSE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_EDT_PROXY_ADDRESS), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_EDT_PROXY_ADDRESS), FALSE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_EDT_PROXY_PORT), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_EDT_PROXY_PORT), FALSE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_TXT_PROXY_ADDRESS), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_TXT_PROXY_ADDRESS), FALSE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_TXT_PROXY_PORT), FALSE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_TXT_PROXY_PORT), FALSE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_RB_PROXY_MANUAL:
|
case ID_RB_PROXY_MANUAL:
|
||||||
if (HIWORD(wParam) == BN_CLICKED)
|
if (HIWORD(wParam) == BN_CLICKED)
|
||||||
{
|
{
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_RB_PROXY_HTTP), TRUE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_RB_PROXY_HTTP), TRUE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_RB_PROXY_SOCKS), TRUE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_RB_PROXY_SOCKS), TRUE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_EDT_PROXY_ADDRESS), TRUE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_EDT_PROXY_ADDRESS), TRUE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_EDT_PROXY_PORT), TRUE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_EDT_PROXY_PORT), TRUE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_TXT_PROXY_ADDRESS), TRUE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_TXT_PROXY_ADDRESS), TRUE);
|
||||||
EnableWindow(GetDlgItem(hwndDlg, ID_TXT_PROXY_PORT), TRUE);
|
EnableWindow(GetDlgItem(hwndDlg, ID_TXT_PROXY_PORT), TRUE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_RB_PROXY_HTTP:
|
case ID_RB_PROXY_HTTP:
|
||||||
if (HIWORD(wParam) == BN_CLICKED)
|
if (HIWORD(wParam) == BN_CLICKED)
|
||||||
{
|
{
|
||||||
SetDlgItemText(hwndDlg, ID_EDT_PROXY_ADDRESS, o.proxy_http_address);
|
SetDlgItemText(hwndDlg, ID_EDT_PROXY_ADDRESS, o.proxy_http_address);
|
||||||
SetDlgItemText(hwndDlg, ID_EDT_PROXY_PORT, o.proxy_http_port);
|
SetDlgItemText(hwndDlg, ID_EDT_PROXY_PORT, o.proxy_http_port);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_RB_PROXY_SOCKS:
|
case ID_RB_PROXY_SOCKS:
|
||||||
if (HIWORD(wParam) == BN_CLICKED)
|
if (HIWORD(wParam) == BN_CLICKED)
|
||||||
{
|
{
|
||||||
SetDlgItemText(hwndDlg, ID_EDT_PROXY_ADDRESS, o.proxy_socks_address);
|
SetDlgItemText(hwndDlg, ID_EDT_PROXY_ADDRESS, o.proxy_socks_address);
|
||||||
SetDlgItemText(hwndDlg, ID_EDT_PROXY_PORT, o.proxy_socks_port);
|
SetDlgItemText(hwndDlg, ID_EDT_PROXY_PORT, o.proxy_socks_port);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
psn = (LPPSHNOTIFY) lParam;
|
psn = (LPPSHNOTIFY) lParam;
|
||||||
if (psn->hdr.code == (UINT) PSN_KILLACTIVE)
|
if (psn->hdr.code == (UINT) PSN_KILLACTIVE)
|
||||||
{
|
{
|
||||||
SetWindowLong(hwndDlg, DWL_MSGRESULT,
|
SetWindowLong(hwndDlg, DWL_MSGRESULT, (CheckProxySettings(hwndDlg) ? FALSE : TRUE));
|
||||||
( CheckProxySettings(hwndDlg) ? FALSE : TRUE ));
|
return TRUE;
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
else if (psn->hdr.code == (UINT) PSN_APPLY)
|
else if (psn->hdr.code == (UINT) PSN_APPLY)
|
||||||
{
|
{
|
||||||
SaveProxySettings(hwndDlg);
|
SaveProxySettings(hwndDlg);
|
||||||
SetWindowLong(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR);
|
SetWindowLong(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
EndDialog(hwndDlg, LOWORD(wParam));
|
EndDialog(hwndDlg, LOWORD(wParam));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Check that proxy settings are valid */
|
/* Check that proxy settings are valid */
|
||||||
int CheckProxySettings(HWND hwndDlg)
|
int
|
||||||
|
CheckProxySettings(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
if (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_MANUAL) == BST_CHECKED)
|
if (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_MANUAL) == BST_CHECKED)
|
||||||
{
|
{
|
||||||
TCHAR text[100];
|
TCHAR text[100];
|
||||||
BOOL http = (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_HTTP) == BST_CHECKED);
|
BOOL http = (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_HTTP) == BST_CHECKED);
|
||||||
|
|
||||||
GetDlgItemText(hwndDlg, ID_EDT_PROXY_ADDRESS, text, _tsizeof(text));
|
GetDlgItemText(hwndDlg, ID_EDT_PROXY_ADDRESS, text, _tsizeof(text));
|
||||||
if (_tcslen(text) == 0)
|
if (_tcslen(text) == 0)
|
||||||
{
|
{
|
||||||
/* proxy address not specified */
|
/* proxy address not specified */
|
||||||
ShowLocalizedMsg((http ? IDS_ERR_HTTP_PROXY_ADDRESS : IDS_ERR_SOCKS_PROXY_ADDRESS));
|
ShowLocalizedMsg((http ? IDS_ERR_HTTP_PROXY_ADDRESS : IDS_ERR_SOCKS_PROXY_ADDRESS));
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetDlgItemText(hwndDlg, ID_EDT_PROXY_PORT, text, _tsizeof(text));
|
GetDlgItemText(hwndDlg, ID_EDT_PROXY_PORT, text, _tsizeof(text));
|
||||||
if (_tcslen(text) == 0)
|
if (_tcslen(text) == 0)
|
||||||
{
|
{
|
||||||
/* proxy port not specified */
|
/* proxy port not specified */
|
||||||
ShowLocalizedMsg((http ? IDS_ERR_HTTP_PROXY_PORT : IDS_ERR_SOCKS_PROXY_PORT));
|
ShowLocalizedMsg((http ? IDS_ERR_HTTP_PROXY_PORT : IDS_ERR_SOCKS_PROXY_PORT));
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long port = _tcstol(text, NULL, 10);
|
long port = _tcstol(text, NULL, 10);
|
||||||
if ((port < 1) || (port > 65535))
|
if ((port < 1) || (port > 65535))
|
||||||
{
|
{
|
||||||
/* proxy port range error */
|
/* proxy port range error */
|
||||||
ShowLocalizedMsg((http ? IDS_ERR_HTTP_PROXY_PORT_RANGE : IDS_ERR_SOCKS_PROXY_PORT_RANGE));
|
ShowLocalizedMsg((http ? IDS_ERR_HTTP_PROXY_PORT_RANGE : IDS_ERR_SOCKS_PROXY_PORT_RANGE));
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -210,122 +212,111 @@ LoadProxySettings(HWND hwndDlg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SaveProxySettings(HWND hwndDlg)
|
void
|
||||||
|
SaveProxySettings(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
HKEY regkey;
|
HKEY regkey;
|
||||||
DWORD dwDispos;
|
DWORD dwDispos;
|
||||||
TCHAR proxy_source_string[2] = _T("0");
|
TCHAR proxy_source_string[2] = _T("0");
|
||||||
TCHAR proxy_type_string[2] = _T("0");
|
TCHAR proxy_type_string[2] = _T("0");
|
||||||
|
|
||||||
/* Save Proxy Settings Source */
|
/* Save Proxy Settings Source */
|
||||||
if (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_OPENVPN) == BST_CHECKED)
|
if (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_OPENVPN) == BST_CHECKED)
|
||||||
{
|
{
|
||||||
o.proxy_source = config;
|
o.proxy_source = config;
|
||||||
proxy_source_string[0] = _T('0');
|
proxy_source_string[0] = _T('0');
|
||||||
}
|
}
|
||||||
if (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_MSIE) == BST_CHECKED)
|
else if (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_MSIE) == BST_CHECKED)
|
||||||
{
|
{
|
||||||
o.proxy_source = browser;
|
o.proxy_source = browser;
|
||||||
proxy_source_string[0] = _T('1');
|
proxy_source_string[0] = _T('1');
|
||||||
}
|
}
|
||||||
if (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_MANUAL) == BST_CHECKED)
|
else if (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_MANUAL) == BST_CHECKED)
|
||||||
{
|
{
|
||||||
o.proxy_source = manual;
|
o.proxy_source = manual;
|
||||||
proxy_source_string[0] = _T('2');
|
proxy_source_string[0] = _T('2');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save Proxy type, address and port */
|
/* Save Proxy type, address and port */
|
||||||
if (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_HTTP) == BST_CHECKED)
|
if (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_HTTP) == BST_CHECKED)
|
||||||
{
|
{
|
||||||
o.proxy_type = http;
|
o.proxy_type = http;
|
||||||
proxy_type_string[0] = _T('0');
|
proxy_type_string[0] = _T('0');
|
||||||
|
|
||||||
GetDlgItemText(hwndDlg, ID_EDT_PROXY_ADDRESS, o.proxy_http_address,
|
GetDlgItemText(hwndDlg, ID_EDT_PROXY_ADDRESS, o.proxy_http_address,
|
||||||
_tsizeof(o.proxy_http_address));
|
_tsizeof(o.proxy_http_address));
|
||||||
GetDlgItemText(hwndDlg, ID_EDT_PROXY_PORT, o.proxy_http_port,
|
GetDlgItemText(hwndDlg, ID_EDT_PROXY_PORT, o.proxy_http_port,
|
||||||
_tsizeof(o.proxy_http_port));
|
_tsizeof(o.proxy_http_port));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
o.proxy_type = socks;
|
o.proxy_type = socks;
|
||||||
proxy_type_string[0] = _T('1');
|
proxy_type_string[0] = _T('1');
|
||||||
|
|
||||||
GetDlgItemText(hwndDlg, ID_EDT_PROXY_ADDRESS, o.proxy_socks_address,
|
GetDlgItemText(hwndDlg, ID_EDT_PROXY_ADDRESS, o.proxy_socks_address,
|
||||||
_tsizeof(o.proxy_socks_address));
|
_tsizeof(o.proxy_socks_address));
|
||||||
GetDlgItemText(hwndDlg, ID_EDT_PROXY_PORT, o.proxy_socks_port,
|
GetDlgItemText(hwndDlg, ID_EDT_PROXY_PORT, o.proxy_socks_port,
|
||||||
_tsizeof(o.proxy_socks_port));
|
_tsizeof(o.proxy_socks_port));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open Registry for writing */
|
/* Open Registry for writing */
|
||||||
if (RegCreateKeyEx(HKEY_CURRENT_USER,
|
if (RegCreateKeyEx(HKEY_CURRENT_USER, GUI_REGKEY_HKCU, 0, _T(""), REG_OPTION_NON_VOLATILE,
|
||||||
GUI_REGKEY_HKCU,
|
KEY_WRITE, NULL, ®key, &dwDispos) != ERROR_SUCCESS)
|
||||||
0,
|
|
||||||
_T(""),
|
|
||||||
REG_OPTION_NON_VOLATILE,
|
|
||||||
KEY_WRITE,
|
|
||||||
NULL,
|
|
||||||
®key,
|
|
||||||
&dwDispos) != ERROR_SUCCESS)
|
|
||||||
{
|
{
|
||||||
/* error creating Registry-Key */
|
/* error creating Registry-Key */
|
||||||
ShowLocalizedMsg(IDS_ERR_CREATE_REG_HKCU_KEY, GUI_REGKEY_HKCU);
|
ShowLocalizedMsg(IDS_ERR_CREATE_REG_HKCU_KEY, GUI_REGKEY_HKCU);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save Settings to registry */
|
/* Save Settings to registry */
|
||||||
SetRegistryValue(regkey, _T("proxy_source"), proxy_source_string);
|
SetRegistryValue(regkey, _T("proxy_source"), proxy_source_string);
|
||||||
SetRegistryValue(regkey, _T("proxy_type"), proxy_type_string);
|
SetRegistryValue(regkey, _T("proxy_type"), proxy_type_string);
|
||||||
SetRegistryValue(regkey, _T("proxy_http_address"), o.proxy_http_address);
|
SetRegistryValue(regkey, _T("proxy_http_address"), o.proxy_http_address);
|
||||||
SetRegistryValue(regkey, _T("proxy_http_port"), o.proxy_http_port);
|
SetRegistryValue(regkey, _T("proxy_http_port"), o.proxy_http_port);
|
||||||
SetRegistryValue(regkey, _T("proxy_socks_address"), o.proxy_socks_address);
|
SetRegistryValue(regkey, _T("proxy_socks_address"), o.proxy_socks_address);
|
||||||
SetRegistryValue(regkey, _T("proxy_socks_port"), o.proxy_socks_port);
|
SetRegistryValue(regkey, _T("proxy_socks_port"), o.proxy_socks_port);
|
||||||
|
|
||||||
RegCloseKey(regkey);
|
RegCloseKey(regkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetProxyRegistrySettings()
|
|
||||||
|
void
|
||||||
|
GetProxyRegistrySettings()
|
||||||
{
|
{
|
||||||
LONG status;
|
LONG status;
|
||||||
HKEY regkey;
|
HKEY regkey;
|
||||||
TCHAR proxy_source_string[2] = _T("0");
|
TCHAR proxy_source_string[2] = _T("0");
|
||||||
TCHAR proxy_type_string[2] = _T("0");
|
TCHAR proxy_type_string[2] = _T("0");
|
||||||
|
|
||||||
/* Open Registry for reading */
|
/* Open Registry for reading */
|
||||||
status = RegOpenKeyEx(HKEY_CURRENT_USER,
|
status = RegOpenKeyEx(HKEY_CURRENT_USER, GUI_REGKEY_HKCU, 0, KEY_READ, ®key);
|
||||||
GUI_REGKEY_HKCU,
|
if (status != ERROR_SUCCESS)
|
||||||
0,
|
return;
|
||||||
KEY_READ,
|
|
||||||
®key);
|
|
||||||
|
|
||||||
/* Return if can't open the registry key */
|
/* get registry settings */
|
||||||
if (status != ERROR_SUCCESS) return;
|
GetRegistryValue(regkey, _T("proxy_http_address"), o.proxy_http_address, _tsizeof(o.proxy_http_address));
|
||||||
|
GetRegistryValue(regkey, _T("proxy_http_port"), o.proxy_http_port, _tsizeof(o.proxy_http_port));
|
||||||
|
GetRegistryValue(regkey, _T("proxy_socks_address"), o.proxy_socks_address, _tsizeof(o.proxy_socks_address));
|
||||||
|
GetRegistryValue(regkey, _T("proxy_socks_port"), o.proxy_socks_port, _tsizeof(o.proxy_socks_port));
|
||||||
|
GetRegistryValue(regkey, _T("proxy_source"), proxy_source_string, _tsizeof(proxy_source_string));
|
||||||
|
GetRegistryValue(regkey, _T("proxy_type"), proxy_type_string, _tsizeof(proxy_type_string));
|
||||||
|
|
||||||
|
if (proxy_source_string[0] == _T('0'))
|
||||||
|
{
|
||||||
|
o.proxy_source = config;
|
||||||
|
}
|
||||||
|
else if (proxy_source_string[0] == _T('1'))
|
||||||
|
{
|
||||||
|
o.proxy_source = browser;
|
||||||
|
}
|
||||||
|
else if (proxy_source_string[0] == _T('2'))
|
||||||
|
{
|
||||||
|
o.proxy_source = manual;
|
||||||
|
}
|
||||||
|
|
||||||
/* get registry settings */
|
o.proxy_type = (proxy_type_string[0] == _T('0') ? http : socks);
|
||||||
GetRegistryValue(regkey, _T("proxy_http_address"), o.proxy_http_address,
|
|
||||||
_tsizeof(o.proxy_http_address));
|
|
||||||
GetRegistryValue(regkey, _T("proxy_http_port"), o.proxy_http_port,
|
|
||||||
_tsizeof(o.proxy_http_port));
|
|
||||||
GetRegistryValue(regkey, _T("proxy_socks_address"), o.proxy_socks_address,
|
|
||||||
_tsizeof(o.proxy_socks_address));
|
|
||||||
GetRegistryValue(regkey, _T("proxy_socks_port"), o.proxy_socks_port,
|
|
||||||
_tsizeof(o.proxy_socks_port));
|
|
||||||
GetRegistryValue(regkey, _T("proxy_source"), proxy_source_string,
|
|
||||||
_tsizeof(proxy_source_string));
|
|
||||||
GetRegistryValue(regkey, _T("proxy_type"), proxy_type_string,
|
|
||||||
_tsizeof(proxy_type_string));
|
|
||||||
|
|
||||||
if (proxy_source_string[0] == _T('1'))
|
RegCloseKey(regkey);
|
||||||
o.proxy_source = config;
|
|
||||||
if (proxy_source_string[0] == _T('2'))
|
|
||||||
o.proxy_source = browser;
|
|
||||||
if (proxy_source_string[0] == _T('3'))
|
|
||||||
o.proxy_source = manual;
|
|
||||||
|
|
||||||
if (proxy_type_string[0] == _T('1'))
|
|
||||||
o.proxy_type = socks;
|
|
||||||
|
|
||||||
RegCloseKey(regkey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue