|
@@ -103,7 +103,6 @@
|
|
#if !defined(__MINGW32__)
|
|
#if !defined(__MINGW32__)
|
|
extern char *_getcwd(char *buf, size_t size);
|
|
extern char *_getcwd(char *buf, size_t size);
|
|
#endif
|
|
#endif
|
|
-static int sGuard = 0; /* test if any dialog is already open */
|
|
|
|
|
|
|
|
#ifndef PATH_MAX
|
|
#ifndef PATH_MAX
|
|
#define PATH_MAX MAX_PATH
|
|
#define PATH_MAX MAX_PATH
|
|
@@ -1103,6 +1102,7 @@ save_config(HWND hDlg, FILE *fp)
|
|
|
|
|
|
/* LPARAM pointer passed to WM_INITDIALOG */
|
|
/* LPARAM pointer passed to WM_INITDIALOG */
|
|
struct dlg_proc_param {
|
|
struct dlg_proc_param {
|
|
|
|
+ int guard;
|
|
HWND hWnd;
|
|
HWND hWnd;
|
|
const char *name;
|
|
const char *name;
|
|
char *buffer;
|
|
char *buffer;
|
|
@@ -1400,9 +1400,9 @@ get_password(const char *user,
|
|
|
|
|
|
assert((user != NULL) && (realm != NULL) && (passwd != NULL));
|
|
assert((user != NULL) && (realm != NULL) && (passwd != NULL));
|
|
|
|
|
|
- if (sGuard < 100) {
|
|
|
|
|
|
+ if (s_dlg_proc_param.guard == 0) {
|
|
memset(&s_dlg_proc_param, 0, sizeof(s_dlg_proc_param));
|
|
memset(&s_dlg_proc_param, 0, sizeof(s_dlg_proc_param));
|
|
- sGuard += 100;
|
|
|
|
|
|
+ s_dlg_proc_param.guard = 1;
|
|
} else {
|
|
} else {
|
|
SetForegroundWindow(s_dlg_proc_param.hWnd);
|
|
SetForegroundWindow(s_dlg_proc_param.hWnd);
|
|
return 0;
|
|
return 0;
|
|
@@ -1516,7 +1516,7 @@ get_password(const char *user,
|
|
NULL, dia, NULL, InputDlgProc, (LPARAM)&s_dlg_proc_param));
|
|
NULL, dia, NULL, InputDlgProc, (LPARAM)&s_dlg_proc_param));
|
|
|
|
|
|
s_dlg_proc_param.hWnd = NULL;
|
|
s_dlg_proc_param.hWnd = NULL;
|
|
- sGuard -= 100;
|
|
|
|
|
|
+ s_dlg_proc_param.guard = 0;
|
|
|
|
|
|
return ok;
|
|
return ok;
|
|
|
|
|
|
@@ -1678,9 +1678,9 @@ show_settings_dialog()
|
|
8,
|
|
8,
|
|
L"Tahoma"};
|
|
L"Tahoma"};
|
|
|
|
|
|
- if (sGuard == 0) {
|
|
|
|
|
|
+ if (s_dlg_proc_param.guard == 0) {
|
|
memset(&s_dlg_proc_param, 0, sizeof(s_dlg_proc_param));
|
|
memset(&s_dlg_proc_param, 0, sizeof(s_dlg_proc_param));
|
|
- sGuard++;
|
|
|
|
|
|
+ s_dlg_proc_param.guard = 1;
|
|
} else {
|
|
} else {
|
|
SetForegroundWindow(s_dlg_proc_param.hWnd);
|
|
SetForegroundWindow(s_dlg_proc_param.hWnd);
|
|
return;
|
|
return;
|
|
@@ -1818,7 +1818,7 @@ show_settings_dialog()
|
|
NULL, dia, NULL, SettingsDlgProc, (LPARAM)&s_dlg_proc_param);
|
|
NULL, dia, NULL, SettingsDlgProc, (LPARAM)&s_dlg_proc_param);
|
|
|
|
|
|
s_dlg_proc_param.hWnd = NULL;
|
|
s_dlg_proc_param.hWnd = NULL;
|
|
- sGuard--;
|
|
|
|
|
|
+ s_dlg_proc_param.guard = 0;
|
|
|
|
|
|
#undef HEIGHT
|
|
#undef HEIGHT
|
|
#undef WIDTH
|
|
#undef WIDTH
|
|
@@ -1864,9 +1864,9 @@ change_password_file()
|
|
8,
|
|
8,
|
|
L"Tahoma"};
|
|
L"Tahoma"};
|
|
|
|
|
|
- if (sGuard == 0) {
|
|
|
|
|
|
+ if (s_dlg_proc_param.guard == 0) {
|
|
memset(&s_dlg_proc_param, 0, sizeof(s_dlg_proc_param));
|
|
memset(&s_dlg_proc_param, 0, sizeof(s_dlg_proc_param));
|
|
- sGuard++;
|
|
|
|
|
|
+ s_dlg_proc_param.guard = 1;
|
|
} else {
|
|
} else {
|
|
SetForegroundWindow(s_dlg_proc_param.hWnd);
|
|
SetForegroundWindow(s_dlg_proc_param.hWnd);
|
|
return;
|
|
return;
|
|
@@ -1881,7 +1881,7 @@ change_password_file()
|
|
of.Flags = OFN_CREATEPROMPT | OFN_NOCHANGEDIR | OFN_HIDEREADONLY;
|
|
of.Flags = OFN_CREATEPROMPT | OFN_NOCHANGEDIR | OFN_HIDEREADONLY;
|
|
|
|
|
|
if (IDOK != GetSaveFileName(&of)) {
|
|
if (IDOK != GetSaveFileName(&of)) {
|
|
- sGuard--;
|
|
|
|
|
|
+ s_dlg_proc_param.guard = 0;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1890,11 +1890,12 @@ change_password_file()
|
|
fclose(f);
|
|
fclose(f);
|
|
} else {
|
|
} else {
|
|
MessageBox(NULL, path, "Can not open file", MB_ICONERROR);
|
|
MessageBox(NULL, path, "Can not open file", MB_ICONERROR);
|
|
- sGuard--;
|
|
|
|
|
|
+ s_dlg_proc_param.guard = 0;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
do {
|
|
do {
|
|
|
|
+ s_dlg_proc_param.hWnd = NULL;
|
|
(void)memset(mem, 0, sizeof(mem));
|
|
(void)memset(mem, 0, sizeof(mem));
|
|
(void)memcpy(mem, &dialog_header, sizeof(dialog_header));
|
|
(void)memcpy(mem, &dialog_header, sizeof(dialog_header));
|
|
p = mem + sizeof(dialog_header);
|
|
p = mem + sizeof(dialog_header);
|
|
@@ -1902,7 +1903,7 @@ change_password_file()
|
|
f = fopen(path, "r+");
|
|
f = fopen(path, "r+");
|
|
if (!f) {
|
|
if (!f) {
|
|
MessageBox(NULL, path, "Can not open file", MB_ICONERROR);
|
|
MessageBox(NULL, path, "Can not open file", MB_ICONERROR);
|
|
- sGuard--;
|
|
|
|
|
|
+ s_dlg_proc_param.guard = 0;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2034,7 +2035,7 @@ change_password_file()
|
|
&& (!g_exit_flag));
|
|
&& (!g_exit_flag));
|
|
|
|
|
|
s_dlg_proc_param.hWnd = NULL;
|
|
s_dlg_proc_param.hWnd = NULL;
|
|
- sGuard--;
|
|
|
|
|
|
+ s_dlg_proc_param.guard = 0;
|
|
|
|
|
|
#undef HEIGHT
|
|
#undef HEIGHT
|
|
#undef WIDTH
|
|
#undef WIDTH
|
|
@@ -2045,6 +2046,7 @@ change_password_file()
|
|
static void
|
|
static void
|
|
show_system_info()
|
|
show_system_info()
|
|
{
|
|
{
|
|
|
|
+ static int sGuard = 0;
|
|
if (sGuard == 0) {
|
|
if (sGuard == 0) {
|
|
sGuard++;
|
|
sGuard++;
|
|
} else {
|
|
} else {
|