|
|
|
@ -354,9 +354,54 @@ FillLangListProc(UNUSED HANDLE module, UNUSED PTSTR type, UNUSED PTSTR stringId,
|
|
|
|
|
return TRUE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static BOOL
|
|
|
|
|
GetLaunchOnStartup() |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
WCHAR regPath[MAX_PATH], exePath[MAX_PATH];
|
|
|
|
|
BOOL result = FALSE; |
|
|
|
|
HKEY regkey; |
|
|
|
|
|
|
|
|
|
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_READ, ®key) == ERROR_SUCCESS) { |
|
|
|
|
|
|
|
|
|
if (GetRegistryValue(regkey, L"OpenVPN-GUI", regPath, MAX_PATH) && |
|
|
|
|
GetModuleFileNameW(NULL, exePath, MAX_PATH)) { |
|
|
|
|
if (_wcsicmp(regPath, exePath) == 0) |
|
|
|
|
result = TRUE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
RegCloseKey(regkey); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
SetLaunchOnStartup(BOOL value)
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
WCHAR exePath[MAX_PATH]; |
|
|
|
|
HKEY regkey; |
|
|
|
|
|
|
|
|
|
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_WRITE, ®key) == ERROR_SUCCESS) { |
|
|
|
|
|
|
|
|
|
if (value) { |
|
|
|
|
if (GetModuleFileNameW(NULL, exePath, MAX_PATH))
|
|
|
|
|
SetRegistryValue(regkey, L"OpenVPN-GUI", exePath); |
|
|
|
|
} |
|
|
|
|
else
|
|
|
|
|
RegDeleteValue(regkey, L"OpenVPN-GUI");
|
|
|
|
|
|
|
|
|
|
RegCloseKey(regkey); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
INT_PTR CALLBACK |
|
|
|
|
LanguageSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lParam) |
|
|
|
|
GeneralSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lParam) |
|
|
|
|
{ |
|
|
|
|
LPPSHNOTIFY psn; |
|
|
|
|
langProcData langData = { |
|
|
|
@ -379,6 +424,9 @@ LanguageSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lPa
|
|
|
|
|
/* Clear language id data for the selected item */ |
|
|
|
|
ComboBox_SetItemData(langData.languages, ComboBox_GetCurSel(langData.languages), 0); |
|
|
|
|
|
|
|
|
|
if (GetLaunchOnStartup()) |
|
|
|
|
Button_SetCheck(GetDlgItem(hwndDlg, ID_CHK_STARTUP), BST_CHECKED); |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case WM_NOTIFY: |
|
|
|
@ -391,6 +439,8 @@ LanguageSettingsDlgProc(HWND hwndDlg, UINT msg, UNUSED WPARAM wParam, LPARAM lPa
|
|
|
|
|
if (langId != 0) |
|
|
|
|
SetGUILanguage(langId); |
|
|
|
|
|
|
|
|
|
SetLaunchOnStartup(Button_GetCheck(GetDlgItem(hwndDlg, ID_CHK_STARTUP)) == BST_CHECKED); |
|
|
|
|
|
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR); |
|
|
|
|
return TRUE; |
|
|
|
|
} |
|
|
|
|