[Winpt-commits] r295 - in trunk: Include Src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Mar 13 19:53:41 CET 2007
Author: twoaday
Date: 2007-03-13 19:53:40 +0100 (Tue, 13 Mar 2007)
New Revision: 295
Removed:
trunk/Include/myhtmlphelp.h
Modified:
trunk/Include/wptGPG.h
trunk/Src/ChangeLog
trunk/Src/WinPT.cpp
trunk/Src/wptFileManager.cpp
trunk/Src/wptGPG.cpp
Log:
Deleted: trunk/Include/myhtmlphelp.h
===================================================================
--- trunk/Include/myhtmlphelp.h 2007-03-13 18:06:50 UTC (rev 294)
+++ trunk/Include/myhtmlphelp.h 2007-03-13 18:53:40 UTC (rev 295)
@@ -1,26 +0,0 @@
-#ifndef MY_HTMLHELP_H
-#define MY_HTMLHELP_H
-
-enum hhelp_id_t {
- HELP_INFO_WINDOW = 1,
- HH_UNINITIALIZE = 0x001D, // Uninitializes the help system.
- HH_INITIALIZE = 0x001C, // Initializes the help system.
-
- HH_TP_HELP_WM_HELP = 0x0011, // text popup help, same as WinHelp HELP_WM_HELP
-
-};
-
-typedef struct tagHELPINFO {
- UINT cbSize;
- int iContextType;
- int iCtrlId;
- HANDLE hItemHandle;
- DWORD dwContextId;
- POINT MousePos;
-} HELPINFO, *LPHELPINFO;
-
-HWND HtmlHelp(HWND hwndCaller,
- LPCSTR pszFile,
- UINT uCommand,
- DWORD dwData);
-#endif /*MY_HTMLHELP_H*/
Modified: trunk/Include/wptGPG.h
===================================================================
--- trunk/Include/wptGPG.h 2007-03-13 18:06:50 UTC (rev 294)
+++ trunk/Include/wptGPG.h 2007-03-13 18:53:40 UTC (rev 295)
@@ -1,5 +1,5 @@
/* wptGPG.h - GnuPG interface
- * Copyright (C) 2000-2006 Timo Schulz
+ * Copyright (C) 2000-2007 Timo Schulz
*
* This file is part of WinPT.
*
@@ -12,12 +12,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with WinPT; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#ifndef WPT_GPG_H
#define WPT_GPG_H
@@ -107,6 +102,7 @@
int keyring_check_last_access (void);
const char* gnupg_check_file_ext (const char *fname, int *r_type);
int gpg_check_permissions (int showmsg);
+int gpg_check_file_permissions (const char *fname);
int gnupg_check_homedir (void);
int gnupg_access_keyring (int _pub);
void gnupg_backup_options ();
Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog 2007-03-13 18:06:50 UTC (rev 294)
+++ trunk/Src/ChangeLog 2007-03-13 18:53:40 UTC (rev 295)
@@ -1,3 +1,9 @@
+2007-03-13 Timo Schulz <twoaday at gmx.net>
+
+ * wptGPG.cpp (gpg_check_file_permissions): New.
+ (my_access): Renamed to..
+ (check_file_access): ..this.
+
2007-03-12 Timo Schulz <twoaday at gmx.net>
* wptVerifyList.cpp (extract_filename): Simplified.
Modified: trunk/Src/WinPT.cpp
===================================================================
--- trunk/Src/WinPT.cpp 2007-03-13 18:06:50 UTC (rev 294)
+++ trunk/Src/WinPT.cpp 2007-03-13 18:53:40 UTC (rev 295)
@@ -1,5 +1,5 @@
/* WinPT.cpp - Windows Privacy Tray (WinPT)
- * Copyright (C) 2000-2006 Timo Schulz
+ * Copyright (C) 2000-2007 Timo Schulz
*
* This file is part of WinPT.
*
@@ -253,7 +253,7 @@
{
static char program[2*MAX_PATH+1];
char currdir[MAX_PATH+1];
- char *cmd = NULL;
+ char *cmd;
int j;
memset (currdir, 0, DIM (currdir));
Modified: trunk/Src/wptFileManager.cpp
===================================================================
--- trunk/Src/wptFileManager.cpp 2007-03-13 18:06:50 UTC (rev 294)
+++ trunk/Src/wptFileManager.cpp 2007-03-13 18:53:40 UTC (rev 295)
@@ -1,5 +1,5 @@
/* wptFileManager.cpp - File Manager routines
- * Copyright (C) 2001-2006 Timo Schulz
+ * Copyright (C) 2001-2007 Timo Schulz
* Copyright (C) 2005 g10 Code GmbH
*
* This file is part of WinPT.
@@ -13,12 +13,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with WinPT; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -192,11 +187,12 @@
i = get_reg_winpt_single (CFG_NOZIP_MMEDIA);
if (i == -1) {
- ans = msg_box (NULL, _("Multi-Media files are already compressed, GPG would compress\n"
- "them anyway and this takes a lot of time.\n"
- "It is possible to disable compression for these files.\n"
- "Do you want to disable it?"),
- _("File Manager"), MB_YESNO|MB_INFO);
+ ans = msg_box (NULL,
+ _("Multi-Media files are already compressed, GPG would compress\n"
+ "them anyway and this takes a lot of time.\n"
+ "It is possible to disable compression for these files.\n"
+ "Do you want to disable it?"),
+ _("File Manager"), MB_YESNO|MB_INFO);
set_reg_winpt_single (CFG_NOZIP_MMEDIA, ans == IDYES? 1 : 0);
if (ans == IDNO)
return 0;
@@ -234,7 +230,7 @@
char*
fm_quote_file (const char * name)
{
- char * p;
+ char *p;
size_t len = strlen (name) + 8;
if (*name == '"')
@@ -408,8 +404,7 @@
/* Build the File Manager dialog context. */
void
fm_build (fm_info_t *r_fm, HWND ctrl)
-{
-
+{
fm_info_t fm;
struct listview_column_s col[] = {
{0, 80, (char *)_("Status") },
@@ -936,6 +931,7 @@
return rc;
}
+
int
fm_parse_files (listview_ctrl_t lv, HWND dlg, int cmd)
{
Modified: trunk/Src/wptGPG.cpp
===================================================================
--- trunk/Src/wptGPG.cpp 2007-03-13 18:06:50 UTC (rev 294)
+++ trunk/Src/wptGPG.cpp 2007-03-13 18:53:40 UTC (rev 295)
@@ -808,14 +808,15 @@
}
-
-/* Check if the device file @fname is stored on, is write-protected. */
+/* Check if the device where file @fname is stored on, is write-protected. */
static int
-my_access (const char *fname)
+check_file_access (const char *fname, int mode)
{
HANDLE hd;
- hd = CreateFile (fname, GENERIC_WRITE, FILE_SHARE_WRITE,
+ if (!mode)
+ mode = FILE_SHARE_WRITE;
+ hd = CreateFile (fname, GENERIC_WRITE, mode,
NULL, OPEN_EXISTING, 0, NULL);
if (hd == INVALID_HANDLE_VALUE)
return -1;
@@ -823,7 +824,25 @@
return 0;
}
+
+/* Check the device where the file @fname is stored on, is either
+ write-protected or if the file is already opened by another process
+ exclusively. And as a result, we cannot use the file for output. */
+int
+gpg_check_file_permissions (const char *fname, int mode)
+{
+ int api_mode;
+
+ switch (mode) {
+ case 0: api_mode = FILE_SHARE_READ; break;
+ case 1: api_mode = FILE_SHARE_WRITE; break;
+ case 2: api_mode = FILE_SHARE_WRITE|FILE_SHARE_READ; break;
+ }
+ return check_file_access (fname, api_mode);
+}
+
+
/* Check the file permissions of the public keyring.
If @showmsg is 1 output a message in case of errors.
Return value: 1 if read-only attribute
@@ -857,7 +876,7 @@
failed = 1;
}
}
- if (my_access (name)) {
+ if (gpg_check_file_permissions (name, 1)) {
if (showmsg)
msg_box (NULL,
_("You do not have file access to modify the contents of\n"
More information about the Winpt-commits
mailing list