40 |
#include "wptCardEdit.h" |
#include "wptCardEdit.h" |
41 |
#include "wptCrypto.h" |
#include "wptCrypto.h" |
42 |
|
|
|
#define MIN_GPG_VER "1.4.2" /* Minimal GPG version. */ |
|
|
#define MIN_GPGME_VER NEED_GPGME_VERSION /* Minimal GPGME version. */ |
|
|
|
|
|
|
|
43 |
HINSTANCE glob_hinst; /* global instance for the dialogs */ |
HINSTANCE glob_hinst; /* global instance for the dialogs */ |
44 |
HWND glob_hwnd; /* global window handle for the dialogs */ |
HWND glob_hwnd; /* global window handle for the dialogs */ |
45 |
HWND activ_hwnd; |
HWND activ_hwnd; |
|
LOCK mo_file; |
|
46 |
int scard_support = 0; |
int scard_support = 0; |
47 |
int debug = 0; |
int debug = 0; |
48 |
int mobile = 0; |
int mobile = 0; |
91 |
load_gettext (int prev_inst) |
load_gettext (int prev_inst) |
92 |
{ |
{ |
93 |
char *nls = NULL; |
char *nls = NULL; |
|
char *file = NULL; |
|
94 |
|
|
95 |
nls = get_gettext_lang (); |
nls = get_gettext_lang (); |
96 |
if (nls) { |
if (nls != NULL) { |
97 |
set_gettext_file ("winpt", nls); |
set_gettext_file ("winpt", nls); |
|
file = make_filename (nls, "winpt", "mo"); |
|
|
if (!file_exist_check (nls) && init_file_lock (&mo_file, file)) { |
|
|
if (!prev_inst) |
|
|
msg_box (NULL, _("Could not initizalize file lock.\n" |
|
|
"Native Language Support"), |
|
|
_("WinPT Error"), MB_ERR); |
|
|
} |
|
98 |
free_if_alloc (nls); |
free_if_alloc (nls); |
|
free_if_alloc (file); |
|
99 |
} |
} |
100 |
} |
} |
101 |
|
|
201 |
static bool |
static bool |
202 |
check_crypto_engine (void) |
check_crypto_engine (void) |
203 |
{ |
{ |
204 |
int ma=1, mi=4, pa=2; /* GPG 1.4.2 */ |
int ma=0, mi=0, pa=0; |
205 |
int rc; |
int rc; |
206 |
|
|
207 |
rc = check_gnupg_engine (&ma, &mi, &pa); |
rc = check_gnupg_engine (NEED_GPG_VERSION, &ma, &mi, &pa); |
208 |
if (rc == -1) { |
if (rc == -1) { |
209 |
msg_box (NULL, _("Could not read GnuPG version."), |
msg_box (NULL, _("Could not read GnuPG version."), |
210 |
_("WinPT Error"), MB_ERR); |
_("WinPT Error"), MB_ERR); |
213 |
else if (rc) { |
else if (rc) { |
214 |
log_box (_("WinPT Error"), MB_ERR, |
log_box (_("WinPT Error"), MB_ERR, |
215 |
_("Sorry, you need a newer GPG version.\n" |
_("Sorry, you need a newer GPG version.\n" |
216 |
"GPG version %d.%d.%d required GPG version "MIN_GPG_VER), |
"GPG version %d.%d.%d required GPG version "NEED_GPG_VERSION), |
217 |
ma, mi, pa); |
ma, mi, pa); |
218 |
return false; |
return false; |
219 |
} |
} |
220 |
/* We enable smartcard support for GPG: >= 2 or >= 1.4.3 */ |
/* We enable smartcard support for GPG: >= 2 or >= 1.4.3 */ |
221 |
if (ma > 1 || pa >= 3) |
if (ma > 1 || pa >= 3) |
222 |
scard_support = 1; |
scard_support = 1; |
223 |
|
|
224 |
gpgver[0] = ma; |
gpgver[0] = ma; |
347 |
return 0; |
return 0; |
348 |
} |
} |
349 |
|
|
350 |
s = gpgme_check_version (MIN_GPGME_VER); |
s = gpgme_check_version (NEED_GPGME_VERSION); |
351 |
if (!s || !*s) { |
if (!s || !*s) { |
352 |
msg_box (NULL, _("A newer GPGME version is needed; at least "MIN_GPGME_VER), |
msg_box (NULL, _("A newer GPGME version is needed; at least "NEED_GPGME_VERSION), |
353 |
_("WinPT Error"), MB_ERR); |
_("WinPT Error"), MB_ERR); |
354 |
return 0; |
return 0; |
355 |
} |
} |