Browse Source

replace GUI_* with PACKAGE_* macros

pull/1/head
Heiko Hund 15 years ago
parent
commit
6939cb8792
  1. 4
      localization.c
  2. 12
      main.c
  3. 3
      main.h
  4. 68
      openvpn.c
  5. 10
      openvpn_config.c
  6. 22
      openvpn_monitor_process.c
  7. 14
      options.c
  8. 70
      passphrase.c
  9. 16
      proxy.c
  10. 26
      registry.c
  11. 12
      scripts.c
  12. 22
      service.c
  13. 4
      tray.c
  14. 8
      viewlog.c

4
localization.c

@ -25,6 +25,8 @@
#include <tchar.h>
#include <stdio.h>
#include <stdarg.h>
#include "config.h"
#include "main.h"
#include "localization.h"
#include "openvpn-gui-res.h"
@ -80,7 +82,7 @@ SetGUILanguage(LANGID langId)
HKEY regkey;
if (RegCreateKeyEx(HKEY_CURRENT_USER, GUI_REGKEY_HKCU, 0, NULL, 0,
KEY_WRITE, NULL, &regkey, NULL) != ERROR_SUCCESS )
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CREATE_REG_HKCU_KEY, GUI_REGKEY_HKCU);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CREATE_REG_HKCU_KEY, GUI_REGKEY_HKCU);
SetRegistryValueNumeric(regkey, "ui_language", langId);
gui_language = langId;

12
main.c

@ -23,6 +23,8 @@
#include <windows.h>
#include <shlwapi.h>
#include <Pbt.h>
#include "config.h"
#include "tray.h"
#include "openvpn.h"
#include "openvpn_config.h"
@ -73,10 +75,10 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
if (!(o.debug_fp = fopen(DEBUG_FILE, "w")))
{
/* can't open debug file */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OPEN_DEBUG_FILE, DEBUG_FILE);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OPEN_DEBUG_FILE, DEBUG_FILE);
exit(1);
}
PrintDebug("Starting OpenVPN GUI v%s", GUI_VERSION);
PrintDebug("Starting OpenVPN GUI v%s", PACKAGE_VERSION);
#endif
@ -89,7 +91,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
else
{
/* can't load riched20.dll */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_LOAD_RICHED20);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_LOAD_RICHED20);
exit(1);
}
@ -98,7 +100,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
if (shell32_version < PACKVERSION(5,0))
{
/* shell32.dll version to low */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_SHELL_DLL_VERSION, shell32_version);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_SHELL_DLL_VERSION, shell32_version);
exit(1);
}
#ifdef DEBUG
@ -113,7 +115,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
if ((FindWindow (szClassName, NULL)) != NULL)
{
/* GUI already running */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_GUI_ALREADY_RUNNING);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_GUI_ALREADY_RUNNING);
exit(1);
}

3
main.h

@ -33,9 +33,6 @@
/* Define this to disable Change Password support */
//#define DISABLE_CHANGE_PASSWORD
#define GUI_NAME "OpenVPN GUI"
#define GUI_VERSION "1.0.3"
/* Registry key for User Settings */
#define GUI_REGKEY_HKCU "Software\\Nilings\\OpenVPN-GUI"

68
openvpn.c

@ -29,6 +29,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <process.h>
#include <richedit.h>
#include "config.h"
#include "tray.h"
#include "main.h"
#include "openvpn.h"
@ -40,7 +43,6 @@
#include "proxy.h"
#include "passphrase.h"
#include "localization.h"
#include <richedit.h>
extern struct options o;
@ -63,12 +65,12 @@ int CreateExitEvent(int config)
if (GetLastError() == ERROR_ACCESS_DENIED)
{
/* service mustn't be running, while using old version */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_STOP_SERV_OLD_VER);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_STOP_SERV_OLD_VER);
}
else
{
/* error creating exit event */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_CREATE_EVENT, o.cnn[config].exit_event_name);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_CREATE_EVENT, o.cnn[config].exit_event_name);
}
return(false);
}
@ -83,7 +85,7 @@ int CreateExitEvent(int config)
if (o.cnn[config].exit_event == NULL)
{
/* error creating exit event */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_CREATE_EVENT, o.cnn[config].exit_event_name);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_CREATE_EVENT, o.cnn[config].exit_event_name);
return(false);
}
}
@ -113,7 +115,7 @@ int SetProcessPriority(DWORD *priority)
else
{
/* unknown priority */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_UNKNOWN_PRIORITY, o.priority_string);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_UNKNOWN_PRIORITY, o.priority_string);
return (false);
}
@ -167,7 +169,7 @@ int StartOpenVPN(int config)
if (is_connected)
{
/* only one simultanious connection on old version */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_ONE_CONN_OLD_VER);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_ONE_CONN_OLD_VER);
return(false);
}
}
@ -176,7 +178,7 @@ int StartOpenVPN(int config)
if ((ConfigFileOptionExist(config, "log ")) ||
(ConfigFileOptionExist(config, "log-append ")))
{
if (MessageBox(NULL, LoadLocalizedString(IDS_ERR_OPTION_LOG_IN_CONFIG), GUI_NAME, MB_YESNO | MB_DEFBUTTON2 | MB_ICONWARNING) != IDYES)
if (MessageBox(NULL, LoadLocalizedString(IDS_ERR_OPTION_LOG_IN_CONFIG), PACKAGE_NAME, MB_YESNO | MB_DEFBUTTON2 | MB_ICONWARNING) != IDYES)
return(false);
}
@ -196,7 +198,7 @@ int StartOpenVPN(int config)
if ((o.append_string[0] != '0') && (o.append_string[0] != '1'))
{
/* append_log must be 0 or 1 */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_LOG_APPEND_BOOL, o.append_string);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_LOG_APPEND_BOOL, o.append_string);
goto failed;
}
@ -226,13 +228,13 @@ int StartOpenVPN(int config)
if (!InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION))
{
/* Init Sec. Desc. failed */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_INIT_SEC_DESC);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_INIT_SEC_DESC);
goto failed;
}
if (!SetSecurityDescriptorDacl (&sd, TRUE, NULL, FALSE))
{
/* set Dacl failed */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_SET_SEC_DESC_ACL);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_SET_SEC_DESC_ACL);
goto failed;
}
@ -241,7 +243,7 @@ int StartOpenVPN(int config)
if (!CreatePipe(&hOutputReadTmp,&hOutputWrite,&sa,0))
{
/* CreatePipe failed. */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CREATE_PIPE_OUTPUT);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CREATE_PIPE_OUTPUT);
goto failed;
}
@ -253,7 +255,7 @@ int StartOpenVPN(int config)
TRUE,DUPLICATE_SAME_ACCESS))
{
/* DuplicateHandle failed. */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_DUP_HANDLE_ERR_WRITE);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_DUP_HANDLE_ERR_WRITE);
goto failed;
}
@ -261,7 +263,7 @@ int StartOpenVPN(int config)
if (!CreatePipe(&hInputRead,&hInputWriteTmp,&sa,0))
{
/* CreatePipe failed. */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CREATE_PIPE_INPUT);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CREATE_PIPE_INPUT);
goto failed;
}
@ -276,7 +278,7 @@ int StartOpenVPN(int config)
DUPLICATE_SAME_ACCESS))
{
/* Duplicate Handle failed. */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_DUP_HANDLE_OUT_READ);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_DUP_HANDLE_OUT_READ);
goto failed;
}
@ -287,7 +289,7 @@ int StartOpenVPN(int config)
DUPLICATE_SAME_ACCESS))
{
/* DuplicateHandle failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_DUP_HANDLE_IN_WRITE);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_DUP_HANDLE_IN_WRITE);
goto failed;
}
@ -295,7 +297,7 @@ int StartOpenVPN(int config)
if (!CloseHandle(hOutputReadTmp) || !CloseHandle(hInputWriteTmp))
{
/* Close Handle failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CLOSE_HANDLE_TMP);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CLOSE_HANDLE_TMP);
CloseHandle (o.cnn[config].exit_event);
return(0);
}
@ -326,7 +328,7 @@ int StartOpenVPN(int config)
&proc_info))
{
/* CreateProcess failed */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_CREATE_PROCESS,
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_CREATE_PROCESS,
o.exe_path,
command_line,
o.cnn[config].config_dir);
@ -344,7 +346,7 @@ int StartOpenVPN(int config)
!CloseHandle (hErrorWrite))
{
/* CloseHandle failed */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_CLOSE_HANDLE);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_CLOSE_HANDLE);
CloseHandle (o.cnn[config].exit_event);
return(false);
}
@ -368,7 +370,7 @@ int StartOpenVPN(int config)
if (hThread == NULL)
{
/* CreateThread failed */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_CREATE_THREAD_STATUS);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_CREATE_THREAD_STATUS);
goto failed;
}
@ -467,7 +469,7 @@ BOOL CALLBACK StatusDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (!hwndLogWindow)
{
/* Create RichEd LogWindow Failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CREATE_EDIT_LOGWINDOW);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CREATE_EDIT_LOGWINDOW);
return FALSE;
}
@ -480,7 +482,7 @@ BOOL CALLBACK StatusDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
strcpy(charformat.szFaceName, "MS Sans Serif");
if ((SendMessage(hwndLogWindow, EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM) &charformat) && CFM_SIZE) == 0) {
/* set size failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_SET_SIZE);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_SET_SIZE);
}
/* Set Size and Posision of controls */
@ -611,7 +613,7 @@ int VerifyAutoConnections()
if (match == false)
{
/* autostart config not found */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_AUTOSTART_CONF, o.auto_connect[i]);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_AUTOSTART_CONF, o.auto_connect[i]);
return false;
}
}
@ -661,7 +663,7 @@ int CheckVersion()
else
{
/* CreateEvent failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_VERSION_CREATE_EVENT);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_VERSION_CREATE_EVENT);
return(false);
}
}
@ -687,13 +689,13 @@ int CheckVersion()
if (!InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION))
{
/* Init Sec. Desc. failed */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_INIT_SEC_DESC);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_INIT_SEC_DESC);
return(0);
}
if (!SetSecurityDescriptorDacl (&sd, TRUE, NULL, FALSE))
{
/* Set Dacl failed */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_SET_SEC_DESC_ACL);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_SET_SEC_DESC_ACL);
return(0);
}
@ -701,7 +703,7 @@ int CheckVersion()
if (!CreatePipe(&hInputRead,&hInputWriteTmp,&sa,0))
{
/* create pipe failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CREATE_PIPE_IN_READ);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CREATE_PIPE_IN_READ);
return(0);
}
@ -709,7 +711,7 @@ int CheckVersion()
if (!CreatePipe(&hOutputReadTmp,&hOutputWrite,&sa,0))
{
/* CreatePipe failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CREATE_PIPE_OUTPUT);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CREATE_PIPE_OUTPUT);
return(0);
}
@ -720,7 +722,7 @@ int CheckVersion()
DUPLICATE_SAME_ACCESS))
{
/* DuplicateHandle failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_DUP_HANDLE_OUT_READ);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_DUP_HANDLE_OUT_READ);
return(0);
}
@ -731,7 +733,7 @@ int CheckVersion()
DUPLICATE_SAME_ACCESS))
{
/* DuplicateHandle failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_DUP_HANDLE_IN_WRITE);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_DUP_HANDLE_IN_WRITE);
return(0);
}
@ -740,7 +742,7 @@ int CheckVersion()
if (!CloseHandle(hOutputReadTmp) || !CloseHandle(hInputWriteTmp))
{
/* CloseHandle failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CLOSE_HANDLE_TMP);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CLOSE_HANDLE_TMP);
return(0);
}
@ -766,7 +768,7 @@ int CheckVersion()
&proc_info))
{
/* CreateProcess failed */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_CREATE_PROCESS,
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_CREATE_PROCESS,
o.exe_path,
command_line,
bin_path);
@ -849,7 +851,7 @@ int CheckVersion()
|| !CloseHandle (hInputRead) || !CloseHandle(exit_event))
{
/* CloseHandle failed */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_CLOSE_HANDLE);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_CLOSE_HANDLE);
return(0);
}
@ -939,7 +941,7 @@ void ThreadOpenVPNStatus(int config)
if (hThread == NULL)
{
/* CreateThread failed */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_THREAD_READ_STDOUT);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_THREAD_READ_STDOUT);
ExitThread(0);
}

10
openvpn_config.c

@ -21,6 +21,8 @@
#include <windows.h>
#include "config.h"
#include "main.h"
#include "openvpn-gui-res.h"
#include "options.h"
@ -121,7 +123,7 @@ int AddConfigFileToList(int config, TCHAR filename[], TCHAR config_dir[])
if (!modext(log_file, _tsizeof(log_file), o.cnn[config].config_file, _T("log")))
{
/* cannot construct logfile-name */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_LOG_CONSTRUCT, o.cnn[config].config_file);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_LOG_CONSTRUCT, o.cnn[config].config_file);
return(false);
}
_sntprintf_0(o.cnn[config].log_path, _T("%s\\%s"), o.log_dir, log_file);
@ -170,7 +172,7 @@ BuildFileList()
if (o.num_configs >= MAX_CONFIGS)
{
/* too many configs */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_MANY_CONFIGS, MAX_CONFIGS);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_MANY_CONFIGS, MAX_CONFIGS);
break;
}
@ -219,7 +221,7 @@ BuildFileList()
if (o.num_configs >= MAX_CONFIGS)
{
/* too many configs */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_MANY_CONFIGS, MAX_CONFIGS);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_MANY_CONFIGS, MAX_CONFIGS);
FindClose (find_handle);
return(true);
}
@ -236,7 +238,7 @@ BuildFileList()
else
{
/* Config filename already exists */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CONFIG_EXIST, find_obj.cFileName);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CONFIG_EXIST, find_obj.cFileName);
}
}

22
openvpn_monitor_process.c

@ -27,6 +27,8 @@
#include <windows.h>
#include <stdio.h>
#include <time.h>
#include "config.h"
#include "main.h"
#include "options.h"
#include "openvpn.h"
@ -90,7 +92,7 @@ int ReadLineFromStdOut(HANDLE hStdOut, int config, char *line)
else
{
/* error reading from pipe */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_READ_STDOUT_PIPE);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_READ_STDOUT_PIPE);
return(-1);
}
}
@ -149,7 +151,7 @@ int ReadLineFromStdOut(HANDLE hStdOut, int config, char *line)
else
{
/* error reading from pipe */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_READ_STDOUT_PIPE);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_READ_STDOUT_PIPE);
return(-1);
}
}
@ -252,7 +254,7 @@ void monitor_openvpnlog_while_connecting(int config, char *line)
{
StopOpenVPN(config);
/* Cert expired... */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CERT_EXPIRED);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CERT_EXPIRED);
}
/* Check for "certificate is not yet valid" message */
@ -260,7 +262,7 @@ void monitor_openvpnlog_while_connecting(int config, char *line)
{
StopOpenVPN(config);
/* Cert not yet valid */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CERT_NOT_YET_VALID);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CERT_NOT_YET_VALID);
}
/* Check for "Notified TAP-Win32 driver to set a DHCP IP" message */
@ -343,7 +345,7 @@ void monitor_openvpnlog_while_reconnecting(int config, char *line)
{
/* Cert expired */
StopOpenVPN(config);
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CERT_EXPIRED);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CERT_EXPIRED);
}
/* Check for "certificate is not yet valid" message */
@ -351,7 +353,7 @@ void monitor_openvpnlog_while_reconnecting(int config, char *line)
{
StopOpenVPN(config);
/* Cert not yet valid */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CERT_NOT_YET_VALID);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CERT_NOT_YET_VALID);
}
/* Check for "Notified TAP-Win32 driver to set a DHCP IP" message */
@ -401,7 +403,7 @@ void WatchOpenVPNProcess(int config)
/* Open log file */
if ((fd=fopen(o.cnn[config].log_path, filemode)) == NULL)
ShowLocalizedMsg (GUI_NAME, IDS_ERR_OPEN_LOG_WRITE, o.cnn[config].log_path);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_OPEN_LOG_WRITE, o.cnn[config].log_path);
LogWindow = GetDlgItem(o.cnn[config].hwndStatus, ID_EDT_LOG);
while(TRUE)
@ -487,7 +489,7 @@ void WatchOpenVPNProcess(int config)
EnableWindow(GetDlgItem(o.cnn[config].hwndStatus, ID_RESTART), FALSE);
SetForegroundWindow(o.cnn[config].hwndStatus);
ShowWindow(o.cnn[config].hwndStatus, SW_SHOW);
ShowLocalizedMsg(GUI_NAME, IDS_NFO_CONN_TERMINATED, o.cnn[config].config_name);
ShowLocalizedMsg(PACKAGE_NAME, IDS_NFO_CONN_TERMINATED, o.cnn[config].config_name);
/* Close Status Window */
SendMessage(o.cnn[config].hwndStatus, WM_CLOSE, 0, 0);
@ -522,7 +524,7 @@ void WatchOpenVPNProcess(int config)
/* Zero psw attempt counter */
o.cnn[config].failed_psw_attempts = 0;
ShowLocalizedMsg(GUI_NAME, IDS_NFO_CONN_FAILED, o.cnn[config].config_name);
ShowLocalizedMsg(PACKAGE_NAME, IDS_NFO_CONN_FAILED, o.cnn[config].config_name);
/* Set connect_status = "Not Connected" */
o.cnn[config].connect_status=DISCONNECTED;
@ -565,7 +567,7 @@ void WatchOpenVPNProcess(int config)
/* Zero psw attempt counter */
o.cnn[config].failed_psw_attempts = 0;
ShowLocalizedMsg(GUI_NAME, IDS_NFO_RECONN_FAILED, o.cnn[config].config_name);
ShowLocalizedMsg(PACKAGE_NAME, IDS_NFO_RECONN_FAILED, o.cnn[config].config_name);
/* Set connect_status = "Not Connected" */
o.cnn[config].connect_status=DISCONNECTED;

14
options.c

@ -20,12 +20,14 @@
*
*/
#include "options.h"
#include "main.h"
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <windows.h>
#include "config.h"
#include "options.h"
#include "main.h"
#include "openvpn-gui-res.h"
#include "localization.h"
@ -155,7 +157,7 @@ add_option (struct options *options,
if (auto_connect_nr == MAX_CONFIGS)
{
/* Too many configs */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_MANY_CONFIGS, MAX_CONFIGS);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_MANY_CONFIGS, MAX_CONFIGS);
exit(1);
}
@ -267,7 +269,7 @@ add_option (struct options *options,
else
{
/* Unrecognized option or missing parameter */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_BAD_OPTION, p[0]);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_BAD_OPTION, p[0]);
exit(1);
}
return i;
@ -289,7 +291,7 @@ parse_argv (struct options* options,
if (strncmp(p[0], "--", 2))
{
/* Missing -- before option. */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_BAD_PARAMETER, p[0]);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_BAD_PARAMETER, p[0]);
exit(0);
}
else
@ -328,7 +330,7 @@ int ConfigFileOptionExist(int config, const char *option)
if (!(fp=fopen(configfile_path, "r")))
{
/* can't open config file */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OPEN_CONFIG, configfile_path);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OPEN_CONFIG, configfile_path);
return(0);
}

70
passphrase.c

@ -20,6 +20,8 @@
*/
#include <windows.h>
#include "config.h"
#include "main.h"
#include "options.h"
#include "passphrase.h"
@ -87,14 +89,14 @@ void CheckPrivateKeyPassphrasePrompt (char *line, int config)
strlen(passphrase_ascii), &nCharsWritten, NULL))
{
/* PassPhrase -> stdin failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_PASSPHRASE2STDIN);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_PASSPHRASE2STDIN);
}
}
if (!WriteFile(o.cnn[config].hStdIn, "\r\n",
2, &nCharsWritten, NULL))
{
/* CR -> stdin failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CR2STDIN);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CR2STDIN);
}
/* Remove Passphrase prompt from lastline buffer */
line[0]='\0';
@ -122,7 +124,7 @@ void CheckPrivateKeyPassphrasePrompt (char *line, int config)
strlen(passphrase_ascii), &nCharsWritten, NULL))
{
/* PassPhrase -> stdin failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_PASSPHRASE2STDIN);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_PASSPHRASE2STDIN);
}
}
else
@ -131,7 +133,7 @@ void CheckPrivateKeyPassphrasePrompt (char *line, int config)
1, &nCharsWritten, NULL))
{
/* CR -> stdin failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CR2STDIN);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CR2STDIN);
}
}
/* Remove Passphrase prompt from lastline buffer */
@ -164,7 +166,7 @@ void CheckAuthUsernamePrompt (char *line, int config)
if (!WriteFile(o.cnn[config].hStdIn, user_auth.username,
strlen(user_auth.username), &nCharsWritten, NULL))
{
ShowLocalizedMsg(GUI_NAME, IDS_ERR_AUTH_USERNAME2STDIN);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_AUTH_USERNAME2STDIN);
}
}
else
@ -172,7 +174,7 @@ void CheckAuthUsernamePrompt (char *line, int config)
if (!WriteFile(o.cnn[config].hStdIn, "\n",
1, &nCharsWritten, NULL))
{
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CR2STDIN);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CR2STDIN);
}
}
@ -181,7 +183,7 @@ void CheckAuthUsernamePrompt (char *line, int config)
if (!WriteFile(o.cnn[config].hStdIn, user_auth.password,
strlen(user_auth.password), &nCharsWritten, NULL))
{
ShowLocalizedMsg(GUI_NAME, IDS_ERR_AUTH_PASSWORD2STDIN);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_AUTH_PASSWORD2STDIN);
}
}
else
@ -189,7 +191,7 @@ void CheckAuthUsernamePrompt (char *line, int config)
if (!WriteFile(o.cnn[config].hStdIn, "\n",
1, &nCharsWritten, NULL))
{
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CR2STDIN);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CR2STDIN);
}
}
@ -314,7 +316,7 @@ void ShowChangePassphraseDialog(int config)
if (hThread == NULL)
{
/* error creating thread */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_CREATE_PASS_THREAD);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_CREATE_PASS_THREAD);
return;
}
@ -389,21 +391,21 @@ BOOL CALLBACK ChangePassphraseDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam,
if (!ConfirmNewPassword (hwndDlg))
{
/* passwords don't match */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_PWD_DONT_MATCH);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_PWD_DONT_MATCH);
break;
}
/* Check minimum length of password */
if (NewPasswordLengh(hwndDlg) < MIN_PASSWORD_LEN)
{
ShowLocalizedMsg(GUI_NAME, IDS_ERR_PWD_TO_SHORT, MIN_PASSWORD_LEN);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_PWD_TO_SHORT, MIN_PASSWORD_LEN);
break;
}
/* Check if the new password is empty. */
if (NewPasswordLengh(hwndDlg) == 0)
{
if (MessageBox(NULL, LoadLocalizedString(IDS_NFO_EMPTY_PWD), GUI_NAME, MB_YESNO) != IDYES)
if (MessageBox(NULL, LoadLocalizedString(IDS_NFO_EMPTY_PWD), PACKAGE_NAME, MB_YESNO) != IDYES)
break;
}
@ -424,7 +426,7 @@ BOOL CALLBACK ChangePassphraseDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam,
else
{
/* Unknown key format */
ShowLocalizedMsg (GUI_NAME, IDS_ERR_UNKNOWN_KEYFILE_FORMAT);
ShowLocalizedMsg (PACKAGE_NAME, IDS_ERR_UNKNOWN_KEYFILE_FORMAT);
}
DestroyWindow(hwndDlg);
@ -582,7 +584,7 @@ int ParseKeyFilenameLine(int config, char *keyfilename, unsigned int keyfilename
if (j >= (keyfilenamesize - 1))
{
/* key filename to long */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_KEY_FILENAME_TO_LONG);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_KEY_FILENAME_TO_LONG);
return(0);
}
i++;
@ -629,7 +631,7 @@ int ChangePasswordPEM(HWND hwndDlg)
ConvertUnicode2Ascii(oldpsw_unicode, oldpsw, sizeof(oldpsw));
if (!ConvertUnicode2Ascii(newpsw_unicode, newpsw, sizeof(newpsw)))
{
ShowLocalizedMsg(GUI_NAME, IDS_ERR_INVALID_CHARS_IN_PSW);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_INVALID_CHARS_IN_PSW);
return(-1);
}
@ -639,7 +641,7 @@ int ChangePasswordPEM(HWND hwndDlg)
if (! (fp = fopen (keyfile, "r")))
{
/* can't open key file */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OPEN_PRIVATE_KEY_FILE, keyfile);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OPEN_PRIVATE_KEY_FILE, keyfile);
return(0);
}
@ -647,7 +649,7 @@ int ChangePasswordPEM(HWND hwndDlg)
if (! (privkey = PEM_read_PrivateKey (fp, NULL, NULL, oldpsw)))
{
/* wrong password */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OLD_PWD_INCORRECT);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OLD_PWD_INCORRECT);
fclose(fp);
return(-1);
}
@ -658,7 +660,7 @@ int ChangePasswordPEM(HWND hwndDlg)
if (! (fp = fopen (keyfile, "w")))
{
/* can't open file rw */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OPEN_WRITE_KEY, keyfile);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OPEN_WRITE_KEY, keyfile);
EVP_PKEY_free(privkey);
return(0);
}
@ -672,7 +674,7 @@ int ChangePasswordPEM(HWND hwndDlg)
0, 0, NULL)))
{
/* error writing new key */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_WRITE_NEW_KEY, keyfile);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_WRITE_NEW_KEY, keyfile);
EVP_PKEY_free(privkey);
fclose(fp);
return(0);
@ -686,7 +688,7 @@ int ChangePasswordPEM(HWND hwndDlg)
(UCHAR*) newpsw, (int) strlen(newpsw), 0, NULL)))
{
/* can't write new key */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_WRITE_NEW_KEY, keyfile);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_WRITE_NEW_KEY, keyfile);
EVP_PKEY_free(privkey);
fclose(fp);
return(0);
@ -697,7 +699,7 @@ int ChangePasswordPEM(HWND hwndDlg)
fclose(fp);
/* signal success to user */
ShowLocalizedMsg(GUI_NAME, IDS_NFO_PWD_CHANGED);
ShowLocalizedMsg(PACKAGE_NAME, IDS_NFO_PWD_CHANGED);
return(1);
}
@ -731,7 +733,7 @@ int ChangePasswordPKCS12(HWND hwndDlg)
ConvertUnicode2Ascii(oldpsw_unicode, oldpsw, sizeof(oldpsw));
if (!ConvertUnicode2Ascii(newpsw_unicode, newpsw, sizeof(newpsw)))
{
ShowLocalizedMsg(GUI_NAME, IDS_ERR_INVALID_CHARS_IN_PSW);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_INVALID_CHARS_IN_PSW);
return(-1);
}
@ -739,7 +741,7 @@ int ChangePasswordPKCS12(HWND hwndDlg)
if (!(fp = fopen(keyfile, "rb")))
{
/* error opening file */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OPEN_PRIVATE_KEY_FILE, keyfile);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OPEN_PRIVATE_KEY_FILE, keyfile);
return(0);
}
p12 = d2i_PKCS12_fp(fp, NULL);
@ -747,7 +749,7 @@ int ChangePasswordPKCS12(HWND hwndDlg)
if (!p12)
{
/* error reading PKCS #12 */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_READ_PKCS12, keyfile);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_READ_PKCS12, keyfile);
return(0);
}
@ -755,7 +757,7 @@ int ChangePasswordPKCS12(HWND hwndDlg)
if (!PKCS12_parse(p12, oldpsw, &privkey, &cert, &ca))
{
/* old password incorrect */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OLD_PWD_INCORRECT);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OLD_PWD_INCORRECT);
PKCS12_free(p12);
return(-1);
}
@ -771,7 +773,7 @@ int ChangePasswordPKCS12(HWND hwndDlg)
if (!p12)
{
/* create failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CREATE_PKCS12);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CREATE_PKCS12);
return(0);
}
@ -783,7 +785,7 @@ int ChangePasswordPKCS12(HWND hwndDlg)
/* Open keyfile for writing */
if (!(fp = fopen(keyfile, "wb")))
{
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OPEN_WRITE_KEY, keyfile);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OPEN_WRITE_KEY, keyfile);
PKCS12_free(p12);
return(0);
}
@ -794,7 +796,7 @@ int ChangePasswordPKCS12(HWND hwndDlg)
PKCS12_free(p12);
fclose(fp);
/* signal success to user */
ShowLocalizedMsg(GUI_NAME, IDS_NFO_PWD_CHANGED);
ShowLocalizedMsg(PACKAGE_NAME, IDS_NFO_PWD_CHANGED);
return(1);
}
@ -827,7 +829,7 @@ int GetKeyFilename(int config, char *keyfilename, unsigned int keyfilenamesize,
if (!(fp=fopen(configfile_path, "r")))
{
/* can't open config file */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OPEN_CONFIG, configfile_path);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OPEN_CONFIG, configfile_path);
return(0);
}
@ -838,13 +840,13 @@ int GetKeyFilename(int config, char *keyfilename, unsigned int keyfilenamesize,
if (found_key)
{
/* only one key option */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_ONLY_ONE_KEY_OPTION);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_ONLY_ONE_KEY_OPTION);
return(0);
}
if (found_pkcs12)
{
/* key XOR pkcs12 */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_ONLY_KEY_OR_PKCS12);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_ONLY_KEY_OR_PKCS12);
return(0);
}
found_key=1;
@ -857,13 +859,13 @@ int GetKeyFilename(int config, char *keyfilename, unsigned int keyfilenamesize,
if (found_pkcs12)
{
/* only one pkcs12 option */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_ONLY_ONE_PKCS12_OPTION);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_ONLY_ONE_PKCS12_OPTION);
return(0);
}
if (found_key)
{
/* only key XOR pkcs12 */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_ONLY_KEY_OR_PKCS12);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_ONLY_KEY_OR_PKCS12);
return(0);
}
found_pkcs12=1;
@ -876,7 +878,7 @@ int GetKeyFilename(int config, char *keyfilename, unsigned int keyfilenamesize,
if ((!found_key) && (!found_pkcs12))
{
/* must have key or pkcs12 option */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_HAVE_KEY_OR_PKCS12);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_HAVE_KEY_OR_PKCS12);
return(0);
}

16
proxy.c

@ -24,6 +24,8 @@
#include <prsht.h>
#include <tchar.h>
#include <WinInet.h>
#include "config.h"
#include "main.h"
#include "options.h"
#include "registry.h"
@ -152,7 +154,7 @@ int CheckProxySettings(HWND hwndDlg)
if (_tcslen(text) == 0)
{
/* proxy address not specified */
ShowLocalizedMsg(GUI_NAME, (http ? IDS_ERR_HTTP_PROXY_ADDRESS : IDS_ERR_SOCKS_PROXY_ADDRESS));
ShowLocalizedMsg(PACKAGE_NAME, (http ? IDS_ERR_HTTP_PROXY_ADDRESS : IDS_ERR_SOCKS_PROXY_ADDRESS));
return(0);
}
@ -160,7 +162,7 @@ int CheckProxySettings(HWND hwndDlg)
if (_tcslen(text) == 0)
{
/* proxy port not specified */
ShowLocalizedMsg(GUI_NAME, (http ? IDS_ERR_HTTP_PROXY_PORT : IDS_ERR_SOCKS_PROXY_PORT));
ShowLocalizedMsg(PACKAGE_NAME, (http ? IDS_ERR_HTTP_PROXY_PORT : IDS_ERR_SOCKS_PROXY_PORT));
return(0);
}
@ -168,7 +170,7 @@ int CheckProxySettings(HWND hwndDlg)
if ((port < 1) || (port > 65535))
{
/* proxy port range error */
ShowLocalizedMsg(GUI_NAME, (http ? IDS_ERR_HTTP_PROXY_PORT_RANGE : IDS_ERR_SOCKS_PROXY_PORT_RANGE));
ShowLocalizedMsg(PACKAGE_NAME, (http ? IDS_ERR_HTTP_PROXY_PORT_RANGE : IDS_ERR_SOCKS_PROXY_PORT_RANGE));
return(0);
}
}
@ -266,7 +268,7 @@ void SaveProxySettings(HWND hwndDlg)
&dwDispos) != ERROR_SUCCESS)
{
/* error creating Registry-Key */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CREATE_REG_HKCU_KEY, GUI_REGKEY_HKCU);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CREATE_REG_HKCU_KEY, GUI_REGKEY_HKCU);
return;
}
@ -295,7 +297,7 @@ void GetProxyRegistrySettings()
if (!GetTempPath(_tsizeof(temp_path) - 1, temp_path))
{
/* Error getting TempPath - using C:\ */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_GET_TEMP_PATH);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_GET_TEMP_PATH);
_tcscpy(temp_path, _T("C:\\"));
}
_tcsncat(temp_path, _T("openvpn_authfile.txt"),
@ -366,7 +368,7 @@ BOOL CALLBACK ProxyAuthDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, UNUSED
if (!(fp = _tfopen(o.proxy_authfile, _T("w"))))
{
/* error creating AUTH file */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CREATE_AUTH_FILE, o.proxy_authfile);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CREATE_AUTH_FILE, o.proxy_authfile);
EndDialog(hwndDlg, LOWORD(wParam));
}
_fputts(username, fp);
@ -408,7 +410,7 @@ GetIeHttpProxy(TCHAR *host, size_t *hostlen, TCHAR *port, size_t *portlen)
if (!InternetQueryOption(NULL, INTERNET_OPTION_PROXY, (LPVOID) &pinfo, &psize))
{
ShowLocalizedMsg(GUI_NAME, IDS_ERR_GET_MSIE_PROXY);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_GET_MSIE_PROXY);
return FALSE;
}

26
registry.c

@ -24,6 +24,8 @@
#include <windows.h>
#include <tchar.h>
#include <shlobj.h>
#include "config.h"
#include "main.h"
#include "options.h"
#include "openvpn-gui-res.h"
@ -42,7 +44,7 @@ GetRegistryKeys()
if (!GetWindowsDirectory(windows_dir, _tsizeof(windows_dir))) {
/* can't get windows dir */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_GET_WINDOWS_DIR);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_GET_WINDOWS_DIR);
return(false);
}
@ -51,13 +53,13 @@ GetRegistryKeys()
!= ERROR_SUCCESS)
{
/* registry key not found */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OPEN_REGISTRY);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OPEN_REGISTRY);
return(false);
}
if (!GetRegistryValue(regkey, _T(""), openvpn_path, _tsizeof(openvpn_path)))
{
/* error reading registry value */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_READING_REGISTRY);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_READING_REGISTRY);
return(false);
}
if (openvpn_path[_tcslen(openvpn_path) - 1] != _T('\\'))
@ -116,7 +118,7 @@ GetRegistryKeys()
if ((o.psw_attempts < 1) || (o.psw_attempts > 9))
{
/* 0 <= passphrase_attempts <= 9 */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_PASSPHRASE_ATTEMPTS);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_PASSPHRASE_ATTEMPTS);
return(false);
}
@ -126,7 +128,7 @@ GetRegistryKeys()
if ((o.connectscript_timeout < 0) || (o.connectscript_timeout > 99))
{
/* 0 <= connectscript_timeout <= 99 */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CONN_SCRIPT_TIMEOUT);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CONN_SCRIPT_TIMEOUT);
return(false);
}
@ -136,7 +138,7 @@ GetRegistryKeys()
if ((o.disconnectscript_timeout <= 0) || (o.disconnectscript_timeout > 99))
{
/* 0 < disconnectscript_timeout <= 99 */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_DISCONN_SCRIPT_TIMEOUT);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_DISCONN_SCRIPT_TIMEOUT);
return(false);
}
@ -146,7 +148,7 @@ GetRegistryKeys()
if ((o.preconnectscript_timeout <= 0) || (o.preconnectscript_timeout > 99))
{
/* 0 < disconnectscript_timeout <= 99 */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_PRECONN_SCRIPT_TIMEOUT);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_PRECONN_SCRIPT_TIMEOUT);
return(false);
}
@ -195,7 +197,7 @@ int GetRegKey(const TCHAR name[], TCHAR *data, const TCHAR default_data[], DWORD
&dwDispos) != ERROR_SUCCESS)
{
/* error creating registry key */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CREATE_REG_KEY);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CREATE_REG_KEY);
return(false);
}
}
@ -214,7 +216,7 @@ int GetRegKey(const TCHAR name[], TCHAR *data, const TCHAR default_data[], DWORD
if (status != ERROR_SUCCESS) {
/* can't open registry for writing */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OPEN_WRITE_REG);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OPEN_WRITE_REG);
return(false);
}
if(RegSetValueEx(openvpn_key_write,
@ -225,7 +227,7 @@ int GetRegKey(const TCHAR name[], TCHAR *data, const TCHAR default_data[], DWORD
_tcslen(default_data)+1))
{
/* cant read / set reg-key */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_READ_SET_KEY, name);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_READ_SET_KEY, name);
return(false);
}
_tcsncpy(data, default_data, max_len);
@ -274,7 +276,7 @@ int SetRegistryValue(HKEY regkey, const TCHAR *name, TCHAR *data)
if(RegSetValueEx(regkey, name, 0, REG_SZ, (PBYTE) data, _tcslen(data) + 1) != ERROR_SUCCESS)
{
/* Error writing registry value */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_WRITE_REGVALUE, GUI_REGKEY_HKCU, name);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_WRITE_REGVALUE, GUI_REGKEY_HKCU, name);
return(0);
}
@ -289,6 +291,6 @@ SetRegistryValueNumeric(HKEY regkey, const TCHAR *name, DWORD data)
if (status == ERROR_SUCCESS)
return 1;
ShowLocalizedMsg(GUI_NAME, IDS_ERR_WRITE_REGVALUE, GUI_REGKEY_HKCU, name);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_WRITE_REGVALUE, GUI_REGKEY_HKCU, name);
return 0;
}

12
scripts.c

@ -20,9 +20,9 @@
*/
#include <windows.h>
//#include <stdlib.h>
//#include <stdio.h>
#include <process.h>
#include "config.h"
#include "main.h"
#include "openvpn-gui-res.h"
#include "options.h"
@ -91,7 +91,7 @@ void RunConnectScript(int config, int run_as_service)
&proc_info))
{
/* Running Script failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_RUN_CONN_SCRIPT, command_line);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_RUN_CONN_SCRIPT, command_line);
return;
}
@ -108,7 +108,7 @@ void RunConnectScript(int config, int run_as_service)
if (!GetExitCodeProcess(proc_info.hProcess, &ExitCode))
{
/* failed to get ExitCode */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_GET_EXIT_CODE, command_line);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_GET_EXIT_CODE, command_line);
return;
}
@ -117,7 +117,7 @@ void RunConnectScript(int config, int run_as_service)
if (ExitCode != 0)
{
/* ConnectScript failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_CONN_SCRIPT_FAILED, ExitCode);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_CONN_SCRIPT_FAILED, ExitCode);
return;
}
return;
@ -127,7 +127,7 @@ void RunConnectScript(int config, int run_as_service)
}
/* UserInfo: Timeout */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_RUN_CONN_SCRIPT_TIMEOUT, TimeOut);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_RUN_CONN_SCRIPT_TIMEOUT, TimeOut);
}

22
service.c

@ -20,13 +20,15 @@
*/
#include <windows.h>
#include <stdio.h>
#include "config.h"
#include "tray.h"
#include "service.h"
#include "openvpn.h"
#include "options.h"
#include "scripts.h"
#include "main.h"
#include <stdio.h>
#include "openvpn-gui-res.h"
#include "localization.h"
@ -56,7 +58,7 @@ int MyStartService()
if (NULL == schSCManager) {
/* open SC manager failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OPEN_SCMGR);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OPEN_SCMGR);
goto failed;
}
@ -67,7 +69,7 @@ int MyStartService()
if (schService == NULL) {
/* can't open VPN service */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OPEN_VPN_SERVICE);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OPEN_VPN_SERVICE);
goto failed;
}
@ -95,7 +97,7 @@ int MyStartService()
&ssStatus) ) // address of status information structure
{
/* query failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_QUERY_SERVICE);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_QUERY_SERVICE);
goto failed;
}
@ -146,7 +148,7 @@ int MyStartService()
if (ssStatus.dwCurrentState != SERVICE_RUNNING)
{
/* service hasn't started */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_SERVICE_START_FAILED);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_SERVICE_START_FAILED);
goto failed;
}
@ -189,7 +191,7 @@ int MyStopService()
if (NULL == schSCManager) {
/* can't open SCManager */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OPEN_SCMGR, (int) GetLastError());
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OPEN_SCMGR, (int) GetLastError());
return(false);
}
@ -200,7 +202,7 @@ int MyStopService()
if (schService == NULL) {
/* can't open vpn service */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OPEN_VPN_SERVICE);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OPEN_VPN_SERVICE);
return(false);
}
@ -214,7 +216,7 @@ int MyStopService()
&ssStatus) ) // address of status info
{
/* stop failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_STOP_SERVICE);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_STOP_SERVICE);
return(false);
}
@ -263,7 +265,7 @@ int CheckServiceStatus()
if (schService == NULL) {
/* open vpn service failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_OPEN_VPN_SERVICE);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_OPEN_VPN_SERVICE);
o.service_running = SERVICE_NOACCESS;
SetServiceMenuStatus();
return(false);
@ -274,7 +276,7 @@ int CheckServiceStatus()
&ssStatus) ) // address of status information structure
{
/* query failed */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_QUERY_SERVICE);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_QUERY_SERVICE);
return(false);
}

4
tray.c

@ -32,6 +32,8 @@
#include <windows.h>
#include <tchar.h>
#include <time.h>
#include "config.h"
#include "tray.h"
#include "service.h"
#include "shellapi.h"
@ -87,7 +89,7 @@ void OnNotifyTray(LPARAM lParam)
else if (o.service_running == SERVICE_CONNECTED)
{
/* Stop OpenVPN service */
if (MessageBox(NULL, LoadLocalizedString(IDS_MENU_ASK_STOP_SERVICE), GUI_NAME, MB_YESNO | MB_SETFOREGROUND) == IDYES)
if (MessageBox(NULL, LoadLocalizedString(IDS_MENU_ASK_STOP_SERVICE), PACKAGE_NAME, MB_YESNO | MB_SETFOREGROUND) == IDYES)
{
MyStopService();
}

8
viewlog.c

@ -20,9 +20,11 @@
*/
#include <windows.h>
#include <stdio.h>
#include "config.h"
#include "tray.h"
#include "openvpn.h"
#include <stdio.h>
#include "main.h"
#include "options.h"
#include "openvpn-gui-res.h"
@ -66,7 +68,7 @@ void ViewLog(int config)
&proc_info))
{
/* could not start log viewer */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_START_LOG_VIEWER, o.log_viewer);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_START_LOG_VIEWER, o.log_viewer);
}
}
@ -108,7 +110,7 @@ void EditConfig(int config)
&proc_info))
{
/* could not start editor */
ShowLocalizedMsg(GUI_NAME, IDS_ERR_START_CONF_EDITOR, o.editor);
ShowLocalizedMsg(PACKAGE_NAME, IDS_ERR_START_CONF_EDITOR, o.editor);
}
}

Loading…
Cancel
Save