mirror of https://github.com/OpenVPN/openvpn-gui
fixed compiler warnings
parent
c554992de1
commit
d646c7fc8c
3
main.c
3
main.c
|
@ -60,7 +60,6 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
HWND hwnd; /* This is the handle for our window */
|
HWND hwnd; /* This is the handle for our window */
|
||||||
MSG messages; /* Here messages to the application are saved */
|
MSG messages; /* Here messages to the application are saved */
|
||||||
WNDCLASSEX wincl; /* Data structure for the windowclass */
|
WNDCLASSEX wincl; /* Data structure for the windowclass */
|
||||||
HWND hwndAbout;
|
|
||||||
DWORD shell32_version;
|
DWORD shell32_version;
|
||||||
|
|
||||||
|
|
||||||
|
@ -323,7 +322,6 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
BOOL CALLBACK AboutDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, UNUSED LPARAM lParam)
|
BOOL CALLBACK AboutDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, UNUSED LPARAM lParam)
|
||||||
{
|
{
|
||||||
HICON hIcon;
|
HICON hIcon;
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
|
|
||||||
|
@ -358,7 +356,6 @@ BOOL CALLBACK AboutDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, UNUSED LPA
|
||||||
void CloseApplication(HWND hwnd)
|
void CloseApplication(HWND hwnd)
|
||||||
{
|
{
|
||||||
int i, ask_exit=0;
|
int i, ask_exit=0;
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
if (o.service_running == SERVICE_CONNECTED)
|
if (o.service_running == SERVICE_CONNECTED)
|
||||||
{
|
{
|
||||||
|
|
4
main.h
4
main.h
|
@ -63,9 +63,9 @@ struct security_attributes
|
||||||
#define CLEAR(x) memset(&(x), 0, sizeof(x))
|
#define CLEAR(x) memset(&(x), 0, sizeof(x))
|
||||||
|
|
||||||
/* snprintf with guaranteed null termination */
|
/* snprintf with guaranteed null termination */
|
||||||
#define mysnprintf(out, args...) \
|
#define mysnprintf(out, ...) \
|
||||||
{ \
|
{ \
|
||||||
snprintf (out, sizeof(out), args); \
|
snprintf (out, sizeof(out), __VA_ARGS__); \
|
||||||
out [sizeof (out) - 1] = '\0'; \
|
out [sizeof (out) - 1] = '\0'; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
openvpn.c
16
openvpn.c
|
@ -143,11 +143,8 @@ int StartOpenVPN(int config)
|
||||||
SECURITY_DESCRIPTOR sd;
|
SECURITY_DESCRIPTOR sd;
|
||||||
char command_line[256];
|
char command_line[256];
|
||||||
char proxy_string[100];
|
char proxy_string[100];
|
||||||
char msg[200];
|
|
||||||
int i, is_connected=0;
|
int i, is_connected=0;
|
||||||
|
|
||||||
extern HINSTANCE hInstance;
|
|
||||||
|
|
||||||
CLEAR (start_info);
|
CLEAR (start_info);
|
||||||
CLEAR (proc_info);
|
CLEAR (proc_info);
|
||||||
CLEAR (sa);
|
CLEAR (sa);
|
||||||
|
@ -178,7 +175,6 @@ int StartOpenVPN(int config)
|
||||||
if ((ConfigFileOptionExist(config, "log ")) ||
|
if ((ConfigFileOptionExist(config, "log ")) ||
|
||||||
(ConfigFileOptionExist(config, "log-append ")))
|
(ConfigFileOptionExist(config, "log-append ")))
|
||||||
{
|
{
|
||||||
TCHAR buf[1000];
|
|
||||||
if (MessageBox(NULL, LoadLocalizedString(ERR_OPTION_LOG_IN_CONFIG), GUI_NAME, MB_YESNO | MB_DEFBUTTON2 | MB_ICONWARNING) != IDYES)
|
if (MessageBox(NULL, LoadLocalizedString(ERR_OPTION_LOG_IN_CONFIG), GUI_NAME, MB_YESNO | MB_DEFBUTTON2 | MB_ICONWARNING) != IDYES)
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
@ -392,9 +388,6 @@ failed:
|
||||||
|
|
||||||
void StopOpenVPN(int config)
|
void StopOpenVPN(int config)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
o.cnn[config].connect_status = DISCONNECTING;
|
o.cnn[config].connect_status = DISCONNECTING;
|
||||||
|
|
||||||
if (o.cnn[config].exit_event) {
|
if (o.cnn[config].exit_event) {
|
||||||
|
@ -412,9 +405,6 @@ void StopOpenVPN(int config)
|
||||||
|
|
||||||
void SuspendOpenVPN(int config)
|
void SuspendOpenVPN(int config)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
o.cnn[config].connect_status = SUSPENDING;
|
o.cnn[config].connect_status = SUSPENDING;
|
||||||
o.cnn[config].restart = true;
|
o.cnn[config].restart = true;
|
||||||
|
|
||||||
|
@ -450,7 +440,6 @@ BOOL CALLBACK StatusDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
HWND hwndLogWindow;
|
HWND hwndLogWindow;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
CHARFORMAT charformat;
|
CHARFORMAT charformat;
|
||||||
HICON hIcon;
|
|
||||||
int config;
|
int config;
|
||||||
|
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
|
@ -630,7 +619,6 @@ int CheckVersion()
|
||||||
HANDLE hInputRead = NULL;
|
HANDLE hInputRead = NULL;
|
||||||
HANDLE hInputWrite = NULL;
|
HANDLE hInputWrite = NULL;
|
||||||
HANDLE exit_event;
|
HANDLE exit_event;
|
||||||
HANDLE debug_event;
|
|
||||||
|
|
||||||
STARTUPINFO start_info;
|
STARTUPINFO start_info;
|
||||||
PROCESS_INFORMATION proc_info;
|
PROCESS_INFORMATION proc_info;
|
||||||
|
@ -902,7 +890,6 @@ void ThreadOpenVPNStatus(int config)
|
||||||
char conn_name[200];
|
char conn_name[200];
|
||||||
HANDLE hThread;
|
HANDLE hThread;
|
||||||
DWORD IDThread;
|
DWORD IDThread;
|
||||||
char msg[200];
|
|
||||||
MSG messages;
|
MSG messages;
|
||||||
|
|
||||||
/* Cut of extention from config filename. */
|
/* Cut of extention from config filename. */
|
||||||
|
@ -912,7 +899,6 @@ void ThreadOpenVPNStatus(int config)
|
||||||
if (o.cnn[config].restart)
|
if (o.cnn[config].restart)
|
||||||
{
|
{
|
||||||
/* UserInfo: Connecting */
|
/* UserInfo: Connecting */
|
||||||
TCHAR buf[1000];
|
|
||||||
SetDlgItemText(o.cnn[config].hwndStatus, TEXT_STATUS, LoadLocalizedString(INFO_STATE_CONNECTING));
|
SetDlgItemText(o.cnn[config].hwndStatus, TEXT_STATUS, LoadLocalizedString(INFO_STATE_CONNECTING));
|
||||||
SetStatusWinIcon(o.cnn[config].hwndStatus, APP_ICON_CONNECTING);
|
SetStatusWinIcon(o.cnn[config].hwndStatus, APP_ICON_CONNECTING);
|
||||||
EnableWindow(GetDlgItem(o.cnn[config].hwndStatus, ID_DISCONNECT), TRUE);
|
EnableWindow(GetDlgItem(o.cnn[config].hwndStatus, ID_DISCONNECT), TRUE);
|
||||||
|
@ -923,8 +909,6 @@ void ThreadOpenVPNStatus(int config)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Create and Show Status Dialog */
|
/* Create and Show Status Dialog */
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
o.cnn[config].hwndStatus = CreateLocalizedDialog(IDD_STATUS, StatusDialogFunc);
|
o.cnn[config].hwndStatus = CreateLocalizedDialog(IDD_STATUS, StatusDialogFunc);
|
||||||
if (!o.cnn[config].hwndStatus)
|
if (!o.cnn[config].hwndStatus)
|
||||||
ExitThread(1);
|
ExitThread(1);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "openvpn-gui-res.h"
|
#include "openvpn-gui-res.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
#include "localization.h"
|
||||||
|
|
||||||
#define MATCH_FALSE 0
|
#define MATCH_FALSE 0
|
||||||
#define MATCH_FILE 1
|
#define MATCH_FILE 1
|
||||||
|
@ -146,7 +147,6 @@ BuildFileList()
|
||||||
HANDLE find_handle;
|
HANDLE find_handle;
|
||||||
BOOL more_files;
|
BOOL more_files;
|
||||||
char find_string[MAX_PATH];
|
char find_string[MAX_PATH];
|
||||||
int i;
|
|
||||||
char subdir_table[MAX_CONFIG_SUBDIRS][MAX_PATH];
|
char subdir_table[MAX_CONFIG_SUBDIRS][MAX_PATH];
|
||||||
int subdir=0;
|
int subdir=0;
|
||||||
int subdir_counter=0;
|
int subdir_counter=0;
|
||||||
|
|
|
@ -57,11 +57,9 @@ int ReadLineFromStdOut(HANDLE hStdOut, int config, char *line)
|
||||||
static int charsleft[MAX_CONFIGS];
|
static int charsleft[MAX_CONFIGS];
|
||||||
char tmpline[MAX_LINELEN];
|
char tmpline[MAX_LINELEN];
|
||||||
DWORD nBytesRead;
|
DWORD nBytesRead;
|
||||||
DWORD nCharsWritten;
|
|
||||||
char *p;
|
char *p;
|
||||||
unsigned int len, i;
|
unsigned int len, i;
|
||||||
static int first_call = 1;
|
static int first_call = 1;
|
||||||
extern HINSTANCE hInstance;
|
|
||||||
|
|
||||||
if (first_call)
|
if (first_call)
|
||||||
{
|
{
|
||||||
|
@ -192,9 +190,7 @@ int ReadLineFromStdOut(HANDLE hStdOut, int config, char *line)
|
||||||
*/
|
*/
|
||||||
void monitor_openvpnlog_while_connecting(int config, char *line)
|
void monitor_openvpnlog_while_connecting(int config, char *line)
|
||||||
{
|
{
|
||||||
TCHAR buf[1000];
|
|
||||||
char msg[200];
|
char msg[200];
|
||||||
char msg2[200];
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char *linepos;
|
char *linepos;
|
||||||
|
|
||||||
|
@ -283,8 +279,6 @@ void monitor_openvpnlog_while_connecting(int config, char *line)
|
||||||
*/
|
*/
|
||||||
void monitor_openvpnlog_while_connected(int config, char *line)
|
void monitor_openvpnlog_while_connected(int config, char *line)
|
||||||
{
|
{
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
/* Check for Ping-Restart message */
|
/* Check for Ping-Restart message */
|
||||||
if (strstr(line, "process restarting") != NULL)
|
if (strstr(line, "process restarting") != NULL)
|
||||||
{
|
{
|
||||||
|
@ -303,11 +297,9 @@ void monitor_openvpnlog_while_connected(int config, char *line)
|
||||||
*/
|
*/
|
||||||
void monitor_openvpnlog_while_reconnecting(int config, char *line)
|
void monitor_openvpnlog_while_reconnecting(int config, char *line)
|
||||||
{
|
{
|
||||||
TCHAR buf[1000];
|
|
||||||
char msg[200];
|
char msg[200];
|
||||||
char msg2[200];
|
|
||||||
unsigned int i;
|
|
||||||
char *linepos;
|
char *linepos;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
/* Check for Connected message */
|
/* Check for Connected message */
|
||||||
if (strstr(line, o.connect_string) != NULL)
|
if (strstr(line, o.connect_string) != NULL)
|
||||||
|
@ -387,15 +379,9 @@ void WatchOpenVPNProcess(int config)
|
||||||
int ret;
|
int ret;
|
||||||
char filemode[2] = "w\0";
|
char filemode[2] = "w\0";
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
char msg[200];
|
|
||||||
char msg2[200];
|
|
||||||
int i;
|
|
||||||
int iLineCount;
|
|
||||||
int LogLines = 0;
|
int LogLines = 0;
|
||||||
int logpos;
|
int logpos;
|
||||||
char *linepos;
|
|
||||||
HWND LogWindow;
|
HWND LogWindow;
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
/* set log file append/truncate filemode */
|
/* set log file append/truncate filemode */
|
||||||
if (o.append_string[0] == '1')
|
if (o.append_string[0] == '1')
|
||||||
|
|
79
options.c
79
options.c
|
@ -45,9 +45,7 @@ int Createargcargv(struct options* options, char* command_line)
|
||||||
|
|
||||||
char* arg;
|
char* arg;
|
||||||
int myindex;
|
int myindex;
|
||||||
int result;
|
|
||||||
|
|
||||||
int i;
|
|
||||||
// count the arguments
|
// count the arguments
|
||||||
|
|
||||||
argc = 1;
|
argc = 1;
|
||||||
|
@ -136,43 +134,6 @@ int Createargcargv(struct options* options, char* command_line)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
parse_argv (struct options* options,
|
|
||||||
int argc,
|
|
||||||
char *argv[])
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
/* parse command line */
|
|
||||||
for (i = 1; i < argc; ++i)
|
|
||||||
{
|
|
||||||
char *p[MAX_PARMS];
|
|
||||||
CLEAR (p);
|
|
||||||
p[0] = argv[i];
|
|
||||||
if (strncmp(p[0], "--", 2))
|
|
||||||
{
|
|
||||||
/* Missing -- before option. */
|
|
||||||
ShowLocalizedMsg(GUI_NAME, ERR_BAD_PARAMETER, p[0]);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
p[0] += 2;
|
|
||||||
|
|
||||||
for (j = 1; j < MAX_PARMS; ++j)
|
|
||||||
{
|
|
||||||
if (i + j < argc)
|
|
||||||
{
|
|
||||||
char *arg = argv[i + j];
|
|
||||||
if (strncmp (arg, "--", 2))
|
|
||||||
p[j] = arg;
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i = add_option (options, i, p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
add_option (struct options *options,
|
add_option (struct options *options,
|
||||||
int i,
|
int i,
|
||||||
|
@ -181,7 +142,6 @@ add_option (struct options *options,
|
||||||
|
|
||||||
if (streq (p[0], "help"))
|
if (streq (p[0], "help"))
|
||||||
{
|
{
|
||||||
TCHAR usagetext[5000];
|
|
||||||
TCHAR usagecaption[200];
|
TCHAR usagecaption[200];
|
||||||
|
|
||||||
LoadLocalizedStringBuf(usagecaption, sizeof(usagecaption)/sizeof(*usagecaption), INFO_USAGECAPTION);
|
LoadLocalizedStringBuf(usagecaption, sizeof(usagecaption)/sizeof(*usagecaption), INFO_USAGECAPTION);
|
||||||
|
@ -313,6 +273,43 @@ add_option (struct options *options,
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
parse_argv (struct options* options,
|
||||||
|
int argc,
|
||||||
|
char *argv[])
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
/* parse command line */
|
||||||
|
for (i = 1; i < argc; ++i)
|
||||||
|
{
|
||||||
|
char *p[MAX_PARMS];
|
||||||
|
CLEAR (p);
|
||||||
|
p[0] = argv[i];
|
||||||
|
if (strncmp(p[0], "--", 2))
|
||||||
|
{
|
||||||
|
/* Missing -- before option. */
|
||||||
|
ShowLocalizedMsg(GUI_NAME, ERR_BAD_PARAMETER, p[0]);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
p[0] += 2;
|
||||||
|
|
||||||
|
for (j = 1; j < MAX_PARMS; ++j)
|
||||||
|
{
|
||||||
|
if (i + j < argc)
|
||||||
|
{
|
||||||
|
char *arg = argv[i + j];
|
||||||
|
if (strncmp (arg, "--", 2))
|
||||||
|
p[j] = arg;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i = add_option (options, i, p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns TRUE if option exist in config file.
|
* Returns TRUE if option exist in config file.
|
||||||
*/
|
*/
|
||||||
|
@ -320,8 +317,6 @@ int ConfigFileOptionExist(int config, const char *option)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char line[256];
|
char line[256];
|
||||||
int found_key=0;
|
|
||||||
int found_pkcs12=0;
|
|
||||||
char configfile_path[MAX_PATH];
|
char configfile_path[MAX_PATH];
|
||||||
|
|
||||||
strncpy(configfile_path, o.cnn[config].config_dir, sizeof(configfile_path));
|
strncpy(configfile_path, o.cnn[config].config_dir, sizeof(configfile_path));
|
||||||
|
|
|
@ -133,5 +133,4 @@ struct options
|
||||||
void init_options (struct options *o);
|
void init_options (struct options *o);
|
||||||
int Createargcargv(struct options* options, char* command_line);
|
int Createargcargv(struct options* options, char* command_line);
|
||||||
void parse_argv (struct options* options, int argc, char *argv[]);
|
void parse_argv (struct options* options, int argc, char *argv[]);
|
||||||
static int add_option (struct options *options, int i, char *p[]);
|
|
||||||
int ConfigFileOptionExist(int config, const char *option);
|
int ConfigFileOptionExist(int config, const char *option);
|
||||||
|
|
|
@ -42,7 +42,6 @@ int ConvertUnicode2Ascii(WCHAR str_unicode[], char str_ascii[], unsigned int str
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
int illegal_chars = false;
|
int illegal_chars = false;
|
||||||
char *str_unicode_ptr = (char *) str_unicode;
|
|
||||||
for (i=0; (i < wcslen(str_unicode)) && (i < (str_ascii_size - 1)); i++)
|
for (i=0; (i < wcslen(str_unicode)) && (i < (str_ascii_size - 1)); i++)
|
||||||
{
|
{
|
||||||
for (j=0; j <= 256; j++)
|
for (j=0; j <= 256; j++)
|
||||||
|
@ -326,10 +325,8 @@ void ChangePassphraseThread(int config)
|
||||||
HWND hwndChangePSW;
|
HWND hwndChangePSW;
|
||||||
MSG messages;
|
MSG messages;
|
||||||
char conn_name[100];
|
char conn_name[100];
|
||||||
char msg[100];
|
|
||||||
char keyfilename[MAX_PATH];
|
char keyfilename[MAX_PATH];
|
||||||
int keyfile_format=0;
|
int keyfile_format=0;
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
/* Cut of extention from config filename. */
|
/* Cut of extention from config filename. */
|
||||||
strncpy(conn_name, o.cnn[config].config_file, sizeof(conn_name));
|
strncpy(conn_name, o.cnn[config].config_file, sizeof(conn_name));
|
||||||
|
@ -372,7 +369,6 @@ BOOL CALLBACK ChangePassphraseDialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam,
|
||||||
char keyfile[MAX_PATH];
|
char keyfile[MAX_PATH];
|
||||||
int keyfile_format;
|
int keyfile_format;
|
||||||
BOOL Translated;
|
BOOL Translated;
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
|
|
||||||
|
@ -687,7 +683,7 @@ int ChangePasswordPEM(HWND hwndDlg)
|
||||||
/* Use passphrase */
|
/* Use passphrase */
|
||||||
if ( !(PEM_write_PrivateKey(fp, privkey, \
|
if ( !(PEM_write_PrivateKey(fp, privkey, \
|
||||||
EVP_des_ede3_cbc(), /* Use 3DES encryption */
|
EVP_des_ede3_cbc(), /* Use 3DES encryption */
|
||||||
newpsw, (int) strlen(newpsw), 0, NULL)))
|
(UCHAR*) newpsw, (int) strlen(newpsw), 0, NULL)))
|
||||||
{
|
{
|
||||||
/* can't write new key */
|
/* can't write new key */
|
||||||
ShowLocalizedMsg(GUI_NAME, ERR_WRITE_NEW_KEY, keyfile);
|
ShowLocalizedMsg(GUI_NAME, ERR_WRITE_NEW_KEY, keyfile);
|
||||||
|
@ -724,7 +720,6 @@ int ChangePasswordPKCS12(HWND hwndDlg)
|
||||||
X509 *cert;
|
X509 *cert;
|
||||||
STACK_OF(X509) *ca = NULL;
|
STACK_OF(X509) *ca = NULL;
|
||||||
PKCS12 *p12;
|
PKCS12 *p12;
|
||||||
PKCS12 *new_p12;
|
|
||||||
char *alias;
|
char *alias;
|
||||||
|
|
||||||
/* Get filename, old_psw and new_psw from Dialog */
|
/* Get filename, old_psw and new_psw from Dialog */
|
||||||
|
@ -769,7 +764,7 @@ int ChangePasswordPKCS12(HWND hwndDlg)
|
||||||
PKCS12_free(p12);
|
PKCS12_free(p12);
|
||||||
|
|
||||||
/* Get FriendlyName of old cert */
|
/* Get FriendlyName of old cert */
|
||||||
alias = X509_alias_get0(cert, NULL);
|
alias = (char*) X509_alias_get0(cert, NULL);
|
||||||
|
|
||||||
/* Create new PKCS12 object */
|
/* Create new PKCS12 object */
|
||||||
p12 = PKCS12_create(newpsw, alias, privkey, cert, ca, 0,0,0,0,0);
|
p12 = PKCS12_create(newpsw, alias, privkey, cert, ca, 0,0,0,0,0);
|
||||||
|
|
1
proxy.c
1
proxy.c
|
@ -285,7 +285,6 @@ void LoadProxySettings(HWND hwndDlg)
|
||||||
void SaveProxySettings(HWND hwndDlg)
|
void SaveProxySettings(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
|
|
||||||
LONG status;
|
|
||||||
HKEY regkey;
|
HKEY regkey;
|
||||||
DWORD dwDispos;
|
DWORD dwDispos;
|
||||||
char proxy_source_string[2]="0";
|
char proxy_source_string[2]="0";
|
||||||
|
|
|
@ -220,7 +220,7 @@ int GetRegKey(const char name[], char *data, const char default_data[], DWORD le
|
||||||
name,
|
name,
|
||||||
0,
|
0,
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
default_data,
|
(const PBYTE) default_data,
|
||||||
strlen(default_data)+1))
|
strlen(default_data)+1))
|
||||||
{
|
{
|
||||||
/* cant read / set reg-key */
|
/* cant read / set reg-key */
|
||||||
|
@ -261,7 +261,7 @@ LONG GetRegistryValue(HKEY regkey, const char *name, char *data, DWORD len)
|
||||||
int SetRegistryValue(HKEY regkey, const char *name, char *data)
|
int SetRegistryValue(HKEY regkey, const char *name, char *data)
|
||||||
{
|
{
|
||||||
/* set a registry string */
|
/* set a registry string */
|
||||||
if(RegSetValueEx(regkey, name, 0, REG_SZ, data, strlen(data)+1) != ERROR_SUCCESS)
|
if(RegSetValueEx(regkey, name, 0, REG_SZ, (PBYTE) data, strlen(data)+1) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Error writing registry value */
|
/* Error writing registry value */
|
||||||
ShowLocalizedMsg(GUI_NAME, ERR_WRITE_REGVALUE, GUI_REGKEY_HKCU, name);
|
ShowLocalizedMsg(GUI_NAME, ERR_WRITE_REGVALUE, GUI_REGKEY_HKCU, name);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* OpenVPN-GUI -- A Windows GUI for OpenVPN.
|
* OpenVPN-GUI -- A Windows GUI for OpenVPN.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004 Mathias Sundman <mathias@nilings.se>
|
* Copyright (C) 2004 Mathias Sundman <mathias@nilings.se>
|
||||||
|
@ -42,7 +42,6 @@ void RunConnectScript(int config, int run_as_service)
|
||||||
char batch_file[100];
|
char batch_file[100];
|
||||||
DWORD ExitCode;
|
DWORD ExitCode;
|
||||||
int i, TimeOut;
|
int i, TimeOut;
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
/* Cut of extention from config filename and add "_up.bat". */
|
/* Cut of extention from config filename and add "_up.bat". */
|
||||||
strncpy(batch_file, o.cnn[config].config_file, sizeof(batch_file));
|
strncpy(batch_file, o.cnn[config].config_file, sizeof(batch_file));
|
||||||
|
@ -144,7 +143,6 @@ void RunDisconnectScript(int config, int run_as_service)
|
||||||
char batch_file[100];
|
char batch_file[100];
|
||||||
DWORD ExitCode;
|
DWORD ExitCode;
|
||||||
int i, TimeOut;
|
int i, TimeOut;
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
/* Append "_down.bat" to config name. */
|
/* Append "_down.bat" to config name. */
|
||||||
strncpy(batch_file, o.cnn[config].config_name, sizeof(batch_file));
|
strncpy(batch_file, o.cnn[config].config_name, sizeof(batch_file));
|
||||||
|
@ -225,7 +223,6 @@ void RunPreconnectScript(int config)
|
||||||
char batch_file[100];
|
char batch_file[100];
|
||||||
DWORD ExitCode;
|
DWORD ExitCode;
|
||||||
int i, TimeOut;
|
int i, TimeOut;
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
/* Append "_pre.bat" to config name. */
|
/* Append "_pre.bat" to config name. */
|
||||||
strncpy(batch_file, o.cnn[config].config_name, sizeof(batch_file));
|
strncpy(batch_file, o.cnn[config].config_name, sizeof(batch_file));
|
||||||
|
|
|
@ -41,8 +41,6 @@ int MyStartService()
|
||||||
DWORD dwOldCheckPoint;
|
DWORD dwOldCheckPoint;
|
||||||
DWORD dwStartTickCount;
|
DWORD dwStartTickCount;
|
||||||
DWORD dwWaitTime;
|
DWORD dwWaitTime;
|
||||||
char msg[200];
|
|
||||||
TCHAR buf[1000];
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Set Service Status = Connecting */
|
/* Set Service Status = Connecting */
|
||||||
|
@ -181,9 +179,6 @@ int MyStopService()
|
||||||
SC_HANDLE schSCManager;
|
SC_HANDLE schSCManager;
|
||||||
SC_HANDLE schService;
|
SC_HANDLE schService;
|
||||||
SERVICE_STATUS ssStatus;
|
SERVICE_STATUS ssStatus;
|
||||||
DWORD dwOldCheckPoint;
|
|
||||||
DWORD dwStartTickCount;
|
|
||||||
DWORD dwWaitTime;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Open a handle to the SC Manager database.
|
// Open a handle to the SC Manager database.
|
||||||
|
@ -248,9 +243,6 @@ int CheckServiceStatus()
|
||||||
SC_HANDLE schSCManager;
|
SC_HANDLE schSCManager;
|
||||||
SC_HANDLE schService;
|
SC_HANDLE schService;
|
||||||
SERVICE_STATUS ssStatus;
|
SERVICE_STATUS ssStatus;
|
||||||
DWORD dwOldCheckPoint;
|
|
||||||
DWORD dwStartTickCount;
|
|
||||||
DWORD dwWaitTime;
|
|
||||||
|
|
||||||
// Open a handle to the SC Manager database.
|
// Open a handle to the SC Manager database.
|
||||||
schSCManager = OpenSCManager(
|
schSCManager = OpenSCManager(
|
||||||
|
|
9
tray.c
9
tray.c
|
@ -55,7 +55,6 @@ void OnNotifyTray(LPARAM lParam)
|
||||||
POINT pt; // point structure
|
POINT pt; // point structure
|
||||||
int connected_config;
|
int connected_config;
|
||||||
int i;
|
int i;
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
// Right click, show the menu
|
// Right click, show the menu
|
||||||
switch(lParam) {
|
switch(lParam) {
|
||||||
|
@ -185,11 +184,7 @@ void DestroyPopupMenus()
|
||||||
|
|
||||||
void CreateItemList()
|
void CreateItemList()
|
||||||
{
|
{
|
||||||
extern char ext_string[];
|
|
||||||
extern char allow_edit[2];
|
|
||||||
extern char allow_service[2];
|
|
||||||
int i;
|
int i;
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
if (o.num_configs == 1)
|
if (o.num_configs == 1)
|
||||||
{
|
{
|
||||||
|
@ -319,8 +314,6 @@ BOOL LoadAppIcon()
|
||||||
|
|
||||||
void ShowTrayIcon()
|
void ShowTrayIcon()
|
||||||
{
|
{
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
ni.cbSize = sizeof(ni);
|
ni.cbSize = sizeof(ni);
|
||||||
ni.uID = 0;
|
ni.uID = 0;
|
||||||
lstrcpyn(ni.szTip, LoadLocalizedString(MSG_TIP), sizeof(ni.szTip)/sizeof(*(ni.szTip)));
|
lstrcpyn(ni.szTip, LoadLocalizedString(MSG_TIP), sizeof(ni.szTip)/sizeof(*(ni.szTip)));
|
||||||
|
@ -346,11 +339,9 @@ void SetTrayIcon(int connected)
|
||||||
char msg[500];
|
char msg[500];
|
||||||
char msg_connected[100];
|
char msg_connected[100];
|
||||||
char msg_connecting[100];
|
char msg_connecting[100];
|
||||||
char conn_name[200];
|
|
||||||
char connected_since[50];
|
char connected_since[50];
|
||||||
int i, first_conn;
|
int i, first_conn;
|
||||||
int config=0;
|
int config=0;
|
||||||
TCHAR buf[1000];
|
|
||||||
|
|
||||||
ni.cbSize = sizeof(ni);
|
ni.cbSize = sizeof(ni);
|
||||||
ni.uID = 0;
|
ni.uID = 0;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "openvpn-gui-res.h"
|
#include "openvpn-gui-res.h"
|
||||||
|
#include "localization.h"
|
||||||
|
|
||||||
extern struct options o;
|
extern struct options o;
|
||||||
|
|
||||||
|
@ -33,14 +34,10 @@ void ViewLog(int config)
|
||||||
{
|
{
|
||||||
char filename[200];
|
char filename[200];
|
||||||
|
|
||||||
extern char log_viewer[MAX_PATH];
|
|
||||||
extern char log_dir[MAX_PATH];
|
|
||||||
|
|
||||||
STARTUPINFO start_info;
|
STARTUPINFO start_info;
|
||||||
PROCESS_INFORMATION proc_info;
|
PROCESS_INFORMATION proc_info;
|
||||||
SECURITY_ATTRIBUTES sa;
|
SECURITY_ATTRIBUTES sa;
|
||||||
SECURITY_DESCRIPTOR sd;
|
SECURITY_DESCRIPTOR sd;
|
||||||
char command_line[256];
|
|
||||||
|
|
||||||
CLEAR (start_info);
|
CLEAR (start_info);
|
||||||
CLEAR (proc_info);
|
CLEAR (proc_info);
|
||||||
|
@ -79,14 +76,10 @@ void EditConfig(int config)
|
||||||
{
|
{
|
||||||
char filename[200];
|
char filename[200];
|
||||||
|
|
||||||
extern char config_dir[MAX_PATH];
|
|
||||||
extern char editor[MAX_PATH];
|
|
||||||
|
|
||||||
STARTUPINFO start_info;
|
STARTUPINFO start_info;
|
||||||
PROCESS_INFORMATION proc_info;
|
PROCESS_INFORMATION proc_info;
|
||||||
SECURITY_ATTRIBUTES sa;
|
SECURITY_ATTRIBUTES sa;
|
||||||
SECURITY_DESCRIPTOR sd;
|
SECURITY_DESCRIPTOR sd;
|
||||||
char command_line[256];
|
|
||||||
|
|
||||||
CLEAR (start_info);
|
CLEAR (start_info);
|
||||||
CLEAR (proc_info);
|
CLEAR (proc_info);
|
||||||
|
|
Loading…
Reference in New Issue