[Winpt-commits] r418 - trunk/Src

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Sun Feb 26 18:57:33 CET 2012


Author: twoaday
Date: 2012-02-26 18:57:33 +0100 (Sun, 26 Feb 2012)
New Revision: 418

Modified:
   trunk/Src/ChangeLog
   trunk/Src/WinPT.cpp
   trunk/Src/wptMainProc.cpp
Log:
2012-02-26  Timo Schulz  <twoaday at gmx.net>

        * WinPT.cpp (WinMain): Check for possible errors
	during the file verification process.
		


Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog	2012-02-16 19:50:32 UTC (rev 417)
+++ trunk/Src/ChangeLog	2012-02-26 17:57:33 UTC (rev 418)
@@ -1,3 +1,8 @@
+2012-02-26  Timo Schulz  <twoaday at gmx.net>
+
+        * WinPT.cpp (WinMain): Check for possible errors
+	during the file verification process.
+	
 2012-02-16  Timo Schulz  <twoaday at gmx.net>
 
         * wptErrors.cpp (setup_logfile): New. Factored out the

Modified: trunk/Src/WinPT.cpp
===================================================================
--- trunk/Src/WinPT.cpp	2012-02-16 19:50:32 UTC (rev 417)
+++ trunk/Src/WinPT.cpp	2012-02-26 17:57:33 UTC (rev 418)
@@ -44,7 +44,6 @@
 HINSTANCE glob_hinst;	/* global instance for the dialogs */
 HWND glob_hwnd;		/* global window handle for the dialogs */
 int scard_support = 0;
-int disable_hook = 0;
 int debug = 0;
 int gpg_read_only = 0;
 char gpgver[3];
@@ -60,24 +59,23 @@
     VS_FIXEDFILEINFO *inf;
     char file[MAX_PATH+1] = {0};
     LPVOID buf, data;
-    DWORD size;
-    UINT qlen;
-    int err = 0;
+    UINT qlen = 0;
 
     strncpy (file, fname, MAX_PATH);
-    size = GetFileVersionInfoSize (file, NULL);
+    DWORD size = GetFileVersionInfoSize (file, NULL);
     if (!size)
 	return -1;
     
     buf = (LPVOID)new char[size];
     if (!buf)
 	BUG (NULL);
+    
+    int err = 0;
     if (!GetFileVersionInfo (file, 0, size, buf)) {
 	err = -1;
 	goto fail;
     }
-
-    qlen = 0;
+    
     VerQueryValue (buf, (char*)"\\", &data, &qlen);
     if (!qlen) {
 	err = -1;
@@ -394,7 +392,7 @@
     HACCEL accel_tab;
     MSG msg;
     HWND hwnd = NULL;
-    WORD ver[3], ptdver[4];
+    WORD ver[4], ptdver[4];
     
     const char *s;
     int rc, ec, created = 0;
@@ -427,15 +425,11 @@
 	return 0;
     }
     
-    /* KLUDGE: test if the hooking is causing problems with some AV programs */
-    if (cmdline && stristr (cmdline, "--disable-hook")) {
-	log_debug ("disable current window hooks");
-	disable_hook = 1;
-    }
-    
-
     log_debug("check PTD and GPGME version");
-    get_file_version ("winpt.exe", &ver[0], &ver[1], &ver[2], &ver[3]);
+    if (get_file_version ("winpt.exe", &ver[0], &ver[1], &ver[2], &ver[3])) {
+	log_box(_("WinPT Error"), MB_ERR, _("Could not read file version of WinPT"));
+	return 0;
+    }
     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, 
@@ -492,10 +486,9 @@
 			      "GPG Keyrings (*.gpg)\0*.gpg\0\0",
 			      NULL);
 	
-	char * p;
+	char *p;
 	if (s != NULL && (p = strrchr (s, '\\'))) {
 	    char *path = substr (s, 0, (p-s));
-
 	    set_reg_entry_gpg ("HomeDir", path);
 	    free_if_alloc (path);
 	}

Modified: trunk/Src/wptMainProc.cpp
===================================================================
--- trunk/Src/wptMainProc.cpp	2012-02-16 19:50:32 UTC (rev 417)
+++ trunk/Src/wptMainProc.cpp	2012-02-26 17:57:33 UTC (rev 418)
@@ -48,10 +48,6 @@
 #include "wptCardEdit.h"
 
 
-/* KLUDGE: for no-hooking */
-extern int disable_hook;
-
-
 int update_keycache (HWND hwnd);
 
 /* Command for the Key Manager dialog. (0=no command) */
@@ -337,11 +333,9 @@
             if (rc)
                 msg_box (hwnd, hotkeys_strerror (), winpt_strerror (rc), MB_ERR);
         }
-	if (!disable_hook) {
-	    rc = PTD_initialize ();
-	    if (!rc)
-		msg_box (hwnd, _("Could not set current window mode hooks."), _("WinPT Error"), MB_OK);
-	}
+	rc = PTD_initialize ();
+	if (!rc)
+	    msg_box (hwnd, _("Could not set current window mode hooks."), _("WinPT Error"), MB_OK);
 	mapi_init ();
 	init_common_controls ();
 	LoadLibrary ("RichEd32.Dll");



More information about the Winpt-commits mailing list