[Winpt-commits] r337 - trunk/Src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Sun Nov 27 13:38:43 CET 2011
Author: twoaday
Date: 2011-11-27 13:38:43 +0100 (Sun, 27 Nov 2011)
New Revision: 337
Modified:
trunk/Src/WinPT.cpp
Log:
2011-11-25 Timo Schulz <twoaday at gmx.net>
* WinPT.cpp (check_os_version): New. Separated
function to check the OS verson.
Removed emulate utf8 bug legacy code.
Modified: trunk/Src/WinPT.cpp
===================================================================
--- trunk/Src/WinPT.cpp 2011-11-27 12:28:18 UTC (rev 336)
+++ trunk/Src/WinPT.cpp 2011-11-27 12:38:43 UTC (rev 337)
@@ -46,7 +46,6 @@
int scard_support = 0;
int debug = 0;
int gpg_read_only = 0;
-int emulate_utf8_bug = 0;
char gpgver[3];
/* End */
@@ -324,6 +323,28 @@
}
+/* Return 1 if the current OS version is at least Windows XP */
+static int
+check_os_version (void)
+{
+ OSVERSIONINFOA osver;
+ memset (&osver, 0, sizeof (osver));
+ osver.dwOSVersionInfoSize = sizeof (osver);
+
+ if (!GetVersionEx (&osver)) {
+ MessageBox (NULL, _("Could not read the OS version."), _("WinPT Error"), MB_ERR);
+ return 0;
+ }
+
+ if (osver.dwMajorVersion < 5 ||
+ (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 0)) {
+ MessageBox (NULL, _("WinPT requires Windows XP or higher."), _("WinPT Error"), MB_ERR);
+ return 0;
+ }
+
+ return 1;
+}
+
/* Main entry point. */
int WINAPI
WinMain (HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int showcmd)
@@ -333,28 +354,19 @@
MSG msg;
HWND hwnd = NULL;
WORD ver[3], ptdver[4];
- OSVERSIONINFOA osver;
+
const char *s;
int rc, ec, created = 0;
int first_start = 0, start_gpgprefs = 0;
int winpt_inst_found = 0;
int start_manager = 0;
- memset (&osver, 0, sizeof (osver));
- osver.dwOSVersionInfoSize = sizeof (osver);
- if (!GetVersionEx (&osver)) {
- MessageBox (NULL, _("Could not read the OS version."),
- _("WinPT Error"), MB_ERR);
+ if (!check_os_version ())
return 0;
- }
- /*
- if (osver.dwMajorVersion < 5) {
- MessageBox (NULL, _("WinPT requires Windows XP or higher."),
- _("WinPT Warning"), MB_INFO);
- return 0;
- }*/
-
+
glob_hinst = hinst;
+
+ /* Allow to shutdown the process, for instance by an installer */
if (cmdline && stristr (cmdline, "--stop")) {
hwnd = FindWindow ("WinPT", "WinPT");
if (hwnd != NULL)
@@ -363,12 +375,8 @@
}
get_file_version ("winpt.exe", &ver[0], &ver[1], &ver[2], &ver[3]);
- ec = get_file_version ("PTD.dll", &ptdver[0], &ptdver[1],
- &ptdver[2], &ptdver[3]);
-
- if (!ec && (ptdver[0] != ver[0] ||
- ptdver[1] != ver[1] ||
- ptdver[2] != ver[2])) {
+ ec = get_file_version ("PTD.dll", &ptdver[0], &ptdver[1], &ptdver[2], &ptdver[3]);
+ if (!ec && (ptdver[0] != ver[0] || ptdver[1] != ver[1] || ptdver[2] != ver[2])) {
log_box (_("WinPT Error"), MB_ERR,
_("The PTD.dll file has a different version than WinPT.exe\n"
"Please update the PTD.dll to version %d.%d.%d"),
@@ -376,15 +384,9 @@
return 0;
}
- if (gpg_md_selftest ()) {
- msg_box (GetDesktopWindow (), _("Cryptographic selftest failed."),
- _("WinPT Error"), MB_ERR);
- return 0;
- }
-
s = gpgme_check_version (NEED_GPGME_VERSION);
if (!s || !*s) {
- msg_box (GetDesktopWindow (),
+ msg_box (GetDesktopWindow (),
_("A newer GPGME version is needed; at least "NEED_GPGME_VERSION),
_("WinPT Error"), MB_ERR);
return 0;
@@ -528,8 +530,7 @@
wc.hIcon = LoadIcon (glob_hinst, MAKEINTRESOURCE (IDI_WINPT));
rc = RegisterClass (&wc);
if (rc == FALSE) {
- msg_box (GetDesktopWindow (),
- _("Could not register window class"),
+ msg_box (GetDesktopWindow (), _("Could not register window class"),
_("WinPT Error"), MB_ERR);
free_gnupg_table ();
return 0;
@@ -543,7 +544,7 @@
hinst,
NULL);
if (hwnd == NULL) {
- msg_box (GetDesktopWindow (),
+ msg_box (GetDesktopWindow (),
_("Could not create window"),
_("WinPT Error"), MB_ERR);
free_gnupg_table ();
@@ -670,11 +671,6 @@
elgamal_warn_dlg_proc, 0);
}
- if (strstr (cmdline, "--emulate-utf8-bug")) {
- MessageBox (NULL, "Please use this mode only for resetting your passphrase to a non-utf8 form.",
- "WinPT Warning", MB_WARN);
- emulate_utf8_bug = 1;
- }
if (start_manager)
PostMessage (hwnd, WM_COMMAND, start_manager, 0);
More information about the Winpt-commits
mailing list