| 220 | |
| 221 | |
| 222 | void |
| 223 | SaveProxySettings(HWND hwndDlg) |
| 224 | { |
| 225 | HKEY regkey; |
| 226 | DWORD dwDispos; |
| 227 | TCHAR proxy_source_string[2] = _T("0"); |
| 228 | TCHAR proxy_type_string[2] = _T("0"); |
| 229 | TCHAR proxy_subkey[MAX_PATH]; |
| 230 | |
| 231 | /* Save Proxy Settings Source */ |
| 232 | if (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_OPENVPN) == BST_CHECKED) |
| 233 | { |
| 234 | o.proxy_source = config; |
| 235 | proxy_source_string[0] = _T('0'); |
| 236 | } |
| 237 | else if (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_MSIE) == BST_CHECKED) |
| 238 | { |
| 239 | o.proxy_source = windows; |
| 240 | proxy_source_string[0] = _T('1'); |
| 241 | } |
| 242 | else if (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_MANUAL) == BST_CHECKED) |
| 243 | { |
| 244 | o.proxy_source = manual; |
| 245 | proxy_source_string[0] = _T('2'); |
| 246 | } |
| 247 | |
| 248 | /* Save Proxy type, address and port */ |
| 249 | if (IsDlgButtonChecked(hwndDlg, ID_RB_PROXY_HTTP) == BST_CHECKED) |
| 250 | { |
| 251 | o.proxy_type = http; |
| 252 | proxy_type_string[0] = _T('0'); |
| 253 | |
| 254 | GetDlgItemText( |
| 255 | hwndDlg, ID_EDT_PROXY_ADDRESS, o.proxy_http_address, _countof(o.proxy_http_address)); |
| 256 | GetDlgItemText(hwndDlg, ID_EDT_PROXY_PORT, o.proxy_http_port, _countof(o.proxy_http_port)); |
| 257 | } |
| 258 | else |
| 259 | { |
| 260 | o.proxy_type = socks; |
| 261 | proxy_type_string[0] = _T('1'); |
| 262 | |
| 263 | GetDlgItemText( |
| 264 | hwndDlg, ID_EDT_PROXY_ADDRESS, o.proxy_socks_address, _countof(o.proxy_socks_address)); |
| 265 | GetDlgItemText( |
| 266 | hwndDlg, ID_EDT_PROXY_PORT, o.proxy_socks_port, _countof(o.proxy_socks_port)); |
| 267 | } |
| 268 | |
| 269 | /* Open Registry for writing */ |
| 270 | _sntprintf_0(proxy_subkey, _T("%ls\\proxy"), GUI_REGKEY_HKCU); |
| 271 | if (RegCreateKeyEx(HKEY_CURRENT_USER, |
| 272 | proxy_subkey, |
| 273 | 0, |
| 274 | _T(""), |
| 275 | REG_OPTION_NON_VOLATILE, |
| 276 | KEY_WRITE, |
| 277 | NULL, |
| 278 | ®key, |
| 279 | &dwDispos) |
no test coverage detected