[Winpt-commits] r77 - in trunk: . Include Src
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Mon Nov 14 16:01:33 CET 2005
Author: twoaday
Date: 2005-11-14 16:01:01 +0100 (Mon, 14 Nov 2005)
New Revision: 77
Modified:
trunk/Include/ChangeLog
trunk/Include/wptCommonCtl.h
trunk/Include/wptFileManager.h
trunk/Include/wptKeylist.h
trunk/Include/wptW32API.h
trunk/NEWS
trunk/Src/ChangeLog
trunk/Src/WinPT-en.rc
trunk/Src/resource.h
trunk/Src/wptAboutDlgs.cpp
trunk/Src/wptCardEdit.cpp
trunk/Src/wptClipSignDlg.cpp
trunk/Src/wptCryptdisk.cpp
trunk/Src/wptFileManager.cpp
trunk/Src/wptFileManagerDlg.cpp
trunk/Src/wptGPG.cpp
trunk/Src/wptGPGPrefsDlg.cpp
trunk/Src/wptImportList.cpp
trunk/Src/wptKeyEdit.cpp
trunk/Src/wptKeyEditDlgs.cpp
trunk/Src/wptKeyManager.cpp
trunk/Src/wptKeyManagerDlg.cpp
trunk/Src/wptKeyPropsDlg.cpp
trunk/Src/wptKeyRevokeDlg.cpp
trunk/Src/wptKeygenDlg.cpp
trunk/Src/wptKeyserver.cpp
trunk/Src/wptKeysignDlg.cpp
trunk/Src/wptListView.cpp
trunk/Src/wptMAPI.cpp
trunk/Src/wptMDSumDlg.cpp
trunk/Src/wptPassphraseCB.cpp
trunk/Src/wptPreferencesDlg.cpp
trunk/Src/wptTextInputDlg.cpp
trunk/Src/wptW32API.cpp
Log:
2005-11-12 Timo Schulz <ts at g10code.com>
Fix more GCC warnings.
2005-11-10 Timo Schulz <ts at g10code.com>
* wptClipSignDlg.cpp (one_key_proc): Use
release_gpg_passphrase_cb() to free the context.
* wptListView.cpp (listview_deselect_all): New.
* wptMAPI.cpp (mapi_send_pubkey): Works again.
* wptFileManagerDlg.cpp (file_manager_dlg_proc): Support encrypt &
zip.
* wptPassphraseCB.cpp (passphrase_callback_proc): Fix passphrase
caching for signing operations.
* wptKeyManager.cpp (km_send_to_mail_recipient): Works again.
* wptFileManager.cpp (fm_send_file): Likewise.
(fm_encrypt_into_zip): New.
Modified: trunk/Include/ChangeLog
===================================================================
--- trunk/Include/ChangeLog 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Include/ChangeLog 2005-11-14 15:01:01 UTC (rev 77)
@@ -1,3 +1,8 @@
+2005-11-12 Timo Schulz <ts at g10code.com>
+
+ * wptW32API.h: Remove FILE_SAVE, FILE_OPEN. These constants
+ are declared somewhere which leads to complications.
+
2005-11-07 Timo Schulz <ts at g10code.com>
* wptVersion.h: Removed MODERN_BUILD directive and removed
Modified: trunk/Include/wptCommonCtl.h
===================================================================
--- trunk/Include/wptCommonCtl.h 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Include/wptCommonCtl.h 2005-11-14 15:01:01 UTC (rev 77)
@@ -82,6 +82,7 @@
int listview_set_column_order (listview_ctrl_t ctx, int *array);
int listview_del_items (listview_ctrl_t ctx);
void listview_select_all (listview_ctrl_t ctx);
+void listview_deselect_all (listview_ctrl_t ctx);
void listview_select_one (listview_ctrl_t ctx, int pos);
int listview_find (listview_ctrl_t ctx, const char * str);
void listview_scroll (listview_ctrl_t ctx, int oldpos, int newpos);
Modified: trunk/Include/wptFileManager.h
===================================================================
--- trunk/Include/wptFileManager.h 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Include/wptFileManager.h 2005-11-14 15:01:01 UTC (rev 77)
@@ -34,6 +34,7 @@
FM_LIST = 8,
FM_WIPE = 9,
FM_ENCRYPT_DIR = 10,
+ FM_ENCRYPT_ZIP = 11
};
/* Sort by constants. */
@@ -104,6 +105,7 @@
int fm_send_file (listview_ctrl_t lv);
/*-- ccommands --*/
+int fm_encrypt_into_zip (fm_state_t ctx, listview_ctrl_t lv);
int fm_encrypt (fm_state_t c, const char * name, int sign);
int fm_sym_encrypt (fm_state_t c, const char * name);
int fm_decrypt (fm_state_t c, const char * name);
Modified: trunk/Include/wptKeylist.h
===================================================================
--- trunk/Include/wptKeylist.h 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Include/wptKeylist.h 2005-11-14 15:01:01 UTC (rev 77)
@@ -51,6 +51,19 @@
KEYFLAG_DISABLED = 4
};
+/* Symbolic column IDs. */
+enum km_col_t {
+ KM_COL_UID = 0,
+ KM_COL_KEYID = 1,
+ KM_COL_TYPE = 2,
+ KM_COL_SIZE = 3,
+ KM_COL_CIPHER = 4,
+ KM_COL_VALID = 5,
+ KM_COL_TRUST = 6,
+ KM_COL_CREAT = 7
+};
+
+
/* Signature verification context for a file. */
struct file_sig_ctx_s {
char *file; /* plaintext file name */
Modified: trunk/Include/wptW32API.h
===================================================================
--- trunk/Include/wptW32API.h 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Include/wptW32API.h 2005-11-14 15:01:01 UTC (rev 77)
@@ -24,13 +24,6 @@
/* #include "wptCrypto.h" */
#include "wptUtil.h"
-#ifndef FILE_OPEN
-#define FILE_OPEN 0
-#endif
-#ifndef FILE_SAVE
-#define FILE_SAVE 1
-#endif
-
struct reminder_ctx_s {
int msecs;
};
@@ -54,12 +47,12 @@
void mapi_deinit (void);
/*-- wptW32API.cpp --*/
-char* make_filename( const char *path, const char *file, const char *ext );
-int init_file_lock( LOCK *ctx, const char *file );
-void release_file_lock( LOCK *ctx );
-int file_exist_check( const char *fname );
-int dir_exist_check( const char *dir );
-size_t get_file_size( const char *fname );
+char* make_filename (const char *path, const char *file, const char *ext);
+int init_file_lock (LOCK *ctx, const char *file);
+void release_file_lock (LOCK *ctx);
+int file_exist_check (const char *fname);
+int dir_exist_check (const char *dir);
+DWORD get_file_size (const char *fname);
int get_window_contents( HWND old_hwnd, curr_wnd_ctx *ctx, int *r_hotkey );
int set_window_contents( HWND old_hwnd, curr_wnd_ctx *ctx );
@@ -81,8 +74,6 @@
LPARAM param, LPCTSTR title, int title_id );
int msg_box( HWND hwnd, const char *text, const char *title, int mode );
int check_date( SYSTEMTIME *st );
-const char * get_filename_dlg( HWND hwnd, int id, const char * title,
- const char * filter, const char * name );
const char* get_filesave_dlg (HWND hwnd, const char *title,
const char *filter, const char *name);
const char* get_fileopen_dlg (HWND hwnd, const char *title,
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/NEWS 2005-11-14 15:01:01 UTC (rev 77)
@@ -657,5 +657,7 @@
requested.
* Fix a couple of problems related to the signature verification
when the issuer is not valid.
+* Allow again to use the MAPI.
+* Fix problem with caching passphrases for signing operations.
Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/ChangeLog 2005-11-14 15:01:01 UTC (rev 77)
@@ -1,3 +1,21 @@
+2005-11-12 Timo Schulz <ts at g10code.com>
+
+ Fix more GCC warnings.
+
+2005-11-10 Timo Schulz <ts at g10code.com>
+
+ * wptClipSignDlg.cpp (one_key_proc): Use
+ release_gpg_passphrase_cb() to free the context.
+ * wptListView.cpp (listview_deselect_all): New.
+ * wptMAPI.cpp (mapi_send_pubkey): Works again.
+ * wptFileManagerDlg.cpp (file_manager_dlg_proc): Support encrypt &
+ zip.
+ * wptPassphraseCB.cpp (passphrase_callback_proc): Fix passphrase
+ caching for signing operations.
+ * wptKeyManager.cpp (km_send_to_mail_recipient): Works again.
+ * wptFileManager.cpp (fm_send_file): Likewise.
+ (fm_encrypt_into_zip): New.
+
2005-11-09 Timo Schulz <ts at g10code.com>
* wptNLS.c (get_gettext_langid): Map user language id to
Modified: trunk/Src/WinPT-en.rc
===================================================================
--- trunk/Src/WinPT-en.rc 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/WinPT-en.rc 2005-11-14 15:01:01 UTC (rev 77)
@@ -2042,6 +2042,7 @@
END
MENUITEM SEPARATOR
MENUITEM "&Encrypt", ID_FILEMISC_ENCRYPT
+ MENUITEM "Encrypt and ZIP", ID_FILEMISC_ENCRYPT_ZIP
MENUITEM "&Decrypt", ID_FILEMISC_DECRYPT
MENUITEM SEPARATOR
MENUITEM "S&ymmetric", ID_FILEMISC_SYMENC
@@ -2196,6 +2197,7 @@
POPUP "Context menu"
BEGIN
MENUITEM "Encrypt", ID_FILECTX_ENCRYPT
+ MENUITEM "Encrypt into ZIP", ID_FILECTX_ENCRYPT_ZIP
MENUITEM "Decrypt", ID_FILECTX_DECRYPT
MENUITEM SEPARATOR
MENUITEM "Sign && Encrypt", ID_FILECTX_SIGNENC
Modified: trunk/Src/resource.h
===================================================================
--- trunk/Src/resource.h 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/resource.h 2005-11-14 15:01:01 UTC (rev 77)
@@ -739,7 +739,9 @@
#define ID_CLIPEDIT_SEND 40170
#define ID_KEYMISC_FIND 40172
#define ID_FILEMISC_MD_SHA256 40173
-
+#define ID_FILECTX_ENCRYPT_ZIP 40174
+#define ID_FILEMISC_ENCRYPT_ZIP 40175
+
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
Modified: trunk/Src/wptAboutDlgs.cpp
===================================================================
--- trunk/Src/wptAboutDlgs.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptAboutDlgs.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -112,8 +112,8 @@
case WM_COMMAND:
switch (LOWORD (wparam)) {
case IDC_ABOUT_GPG:
- DialogBoxParam (glob_hinst, (LPCSTR)IDD_WINPT_ABOUTGPG, GetDesktopWindow(),
- about_gpg_dlg_proc, NULL);
+ DialogBoxParam (glob_hinst, (LPCSTR)IDD_WINPT_ABOUTGPG,
+ GetDesktopWindow(), about_gpg_dlg_proc, 0);
return TRUE;
case IDC_ABOUT_HELP:
Modified: trunk/Src/wptCardEdit.cpp
===================================================================
--- trunk/Src/wptCardEdit.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptCardEdit.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -408,11 +408,11 @@
/* Set the callback to @cb and the hook value to @cb_value. */
void
-GpgCardEdit::setCallback (const char* (*cb)(int code, void *opaque),
- void *cb_value)
+GpgCardEdit::setCallback (const char* (*_cb)(int code, void *opaque),
+ void *_cb_value)
{
- this->cb_value = cb_value;
- this->card_cb = cb;
+ this->cb_value = _cb_value;
+ this->card_cb = _cb;
}
@@ -501,7 +501,7 @@
free (this->keygen.expdate);
this->keygen.expdate = (char*)calloc (1, 16);
if (this->keygen.expdate)
- sprintf (this->keygen.expdate, "%d", valid);
+ sprintf (this->keygen.expdate, "%lu", valid);
if (!this->keygen.name || !this->keygen.email)
return gpg_error (GPG_ERR_ENOMEM);
Modified: trunk/Src/wptClipSignDlg.cpp
===================================================================
--- trunk/Src/wptClipSignDlg.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptClipSignDlg.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -89,12 +89,11 @@
/* This function is used when only one secret key is available.
- * it doesn't make sense to offer a dialog for this case.
- */
+ it doesn't make sense to offer a dialog for this case. */
void
one_key_proc (HWND dlg)
{
- char * signer;
+ char *signer;
gpgme_ctx_t ctx;
gpgme_error_t err;
passphrase_cb_s pwd;
@@ -111,8 +110,7 @@
BUG (dlg);
set_gpg_passphrase_cb (&pwd, ctx, GPG_CMD_SIGN, dlg, _("Signing"));
- err = gpg_clip_sign (ctx, signer, n );
- wipememory (pwd.pwd, sizeof (pwd.pwd));
+ err = gpg_clip_sign (ctx, signer, n);
if (gpgme_err_code (err) == GPG_ERR_BAD_PASSPHRASE)
agent_del_cache (pwd.keyid);
if (err)
@@ -121,6 +119,7 @@
show_msg (dlg, 1500, _("GnuPG Status: Finished"));
gpgme_release (ctx);
free_if_alloc (signer);
+ release_gpg_passphrase_cb (&pwd);
}
@@ -243,4 +242,3 @@
return FALSE;
}
-
Modified: trunk/Src/wptCryptdisk.cpp
===================================================================
--- trunk/Src/wptCryptdisk.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptCryptdisk.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -17,7 +17,6 @@
* 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
@@ -564,11 +563,11 @@
}
rc = cryptdisk_mount (devnum, imgfile, 0, drive);
if (!rc) {
- mount_list_t n = new_mount_list (drive, devnum);
+ mount_list_t t = new_mount_list (drive, devnum);
if (!mounted)
- mounted = n;
+ mounted = t;
else
- add_mount_list (mounted, n);
+ add_mount_list (mounted, t);
EndDialog (dlg, TRUE);
}
else
@@ -706,3 +705,4 @@
CloseServiceHandle (hd);
return rc;
}
+
Modified: trunk/Src/wptFileManager.cpp
===================================================================
--- trunk/Src/wptFileManager.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptFileManager.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -27,7 +27,6 @@
#endif
#include <sys/types.h>
-#include <sys/types.h>
#include <windows.h>
#include <commdlg.h>
#include <io.h>
@@ -51,7 +50,6 @@
#include "wptRegistry.h"
#include "wptImport.h"
#include "wptCrypto.h"
-
#include "openpgp.h"
#define op_begin() SetCursor (LoadCursor (NULL, IDC_WAIT))
@@ -282,7 +280,7 @@
armor_filter_context_t afx;
PACKET *pkt;
const char *s = NULL;
- int rc=0;
+ int rc = 0;
if (r_type)
*r_type = PGP_NONE;
@@ -296,8 +294,8 @@
inp = gpg_iobuf_open (fname);
if (!inp) {
- const char *s = winpt_strerror (WPTERR_FILE_OPEN);
- log_box (_("File Manager"), MB_ERR, "\"%s\": %s", fname, s);
+ const char *err = winpt_strerror (WPTERR_FILE_OPEN);
+ log_box (_("File Manager"), MB_ERR, "\"%s\": %s", fname, err);
return NULL;
}
gpg_iobuf_ioctl (inp, 3, 1, NULL); /* disable cache */
@@ -504,8 +502,9 @@
fm_add_dropped_files (listview_ctrl_t lv, HDROP dd_files)
{
char name[384+4];
- int nfiles, i;
- int rc=0;
+ int nfiles;
+ int rc = 0;
+ int i;
memset (name, 0, sizeof (name));
nfiles = DragQueryFile (dd_files, 0xFFFFFFFF, NULL, 0);
@@ -629,7 +628,7 @@
gpg_free_packet (pkt);
safe_free (pkt);
gpg_iobuf_close (fp);
- unlink ("gpgme.tmp");
+ remove ("gpgme.tmp");
}
/* XXX: implement it for real files */
return check;
@@ -812,6 +811,7 @@
switch (cmd) {
case ID_FILEMISC_ENCRYPT: fm_cmd = FM_ENCRYPT; break;
+ case ID_FILEMISC_ENCRYPT_ZIP:fm_cmd = FM_ENCRYPT_ZIP; break;
case ID_FILEMISC_DECRYPT: fm_cmd = FM_DECRYPT; break;
case ID_FILEMISC_SYMENC: fm_cmd = FM_SYMENC; break;
case ID_FILEMISC_SIGN: fm_cmd = FM_SIGN; break;
@@ -824,7 +824,7 @@
}
if (fm_get_current_pos (lv) == -1)
- return WPTERR_GENERAL;
+ return WPTERR_GENERAL;
rc = fm_state_new (&ctx);
if (rc)
BUG (0);
@@ -845,6 +845,7 @@
/* Commands we need before we can perform the main command */
switch (fm_cmd) {
+ case FM_ENCRYPT_ZIP:
case FM_ENCRYPT:
case FM_SIGNENCRYPT:
if (fm_cmd == FM_SIGNENCRYPT)
@@ -891,12 +892,15 @@
memset (&confirm, 0, sizeof confirm);
confirm.lv_files = lv;
DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_FILES_SECDEL, ctx->dlg,
- file_secdel_confirm_dlg_proc, (LPARAM)&confirm);
+ file_secdel_confirm_dlg_proc, (LPARAM)&confirm);
if (!confirm.yes)
goto leave;
}
- for( i = 0; i < listview_count_items( lv, 0 ); i++ ) {
+ if (fm_cmd == FM_ENCRYPT_ZIP)
+ fm_encrypt_into_zip (ctx, lv);
+
+ for (i = 0; i < listview_count_items (lv, 0); i++) {
if( !listview_get_item_state( lv, i ) )
continue;
listview_get_item_text( lv, i, 1, fname, sizeof (fname) - 1 );
@@ -909,7 +913,7 @@
if( !fm_check_file_type( lv, i, fm_cmd ) )
continue;
sig_detached = fm_check_detached_sig( lv, i );
- switch( fm_cmd ) {
+ switch (fm_cmd) {
case FM_LIST: rc = fm_list( fname, dlg ); break;
case FM_WIPE: rc = fm_wipe( fname ); break;
case FM_ENCRYPT: rc = fm_encrypt( ctx, fname, 0 ); break;
@@ -935,6 +939,7 @@
free_if_alloc (ctx->output);
progress_cleanup (&pfx);
}
+
if (fm_cmd == FM_WIPE) {
secure_unlink_set_cb (NULL, NULL);
progress_cleanup (&pfx2);
@@ -947,9 +952,8 @@
/* remove wipe files from the list */
n = listview_count_items (lv, 0);
while (n--) {
- char status[128];
listview_get_item_text (lv, n, 0, status, sizeof (status) - 1);
- if( !strcmp (status, "WIPED"))
+ if (!strcmp (status, "WIPED"))
listview_del_item (lv, n);
}
@@ -993,7 +997,7 @@
{
const char * s;
- s = get_filename_dlg (c->dlg, FILE_SAVE, msg, NULL, NULL);
+ s = get_filesave_dlg (c->dlg, msg, NULL, NULL);
if (!s)
return WPTERR_GENERAL;
@@ -1066,9 +1070,9 @@
gpgme_signers_add (ctx, key);
}
else {
- gpgme_key_t key = gpgme_signers_enum (ctx, 0);
- if (key && key->subkeys) {
- keyid = m_strdup (key->subkeys->keyid);
+ gpgme_key_t sigkey = gpgme_signers_enum (ctx, 0);
+ if (sigkey && sigkey->subkeys) {
+ keyid = m_strdup (sigkey->subkeys->keyid);
if (!keyid)
BUG (NULL);
}
@@ -1113,9 +1117,9 @@
gpg_file_data_release (in);
if (out)
gpg_file_data_release (out);
+ free_if_alloc (keyid);
if (!rc && c->wipe)
secure_unlink (name, WIPE_MODE_SIMPLE);
- free_if_alloc (keyid);
return rc;
}
@@ -1435,7 +1439,7 @@
}
fm_verify (ctx, 1, fname);
if (del_end)
- unlink (fname);
+ remove (fname);
free_if_alloc (fname);
return 0;
}
@@ -1665,7 +1669,7 @@
strcat (p, ".asc");
}
- name = get_filename_dlg (c->dlg, FILE_SAVE, _("Choose Name for Key File"),
+ name = get_filesave_dlg (c->dlg, _("Choose Name for Key File"),
NULL, p? p : NULL);
if (!name)
@@ -1754,7 +1758,10 @@
detached = 1;
fm_verify (ctx, detached, fn);
file_verify_wait ();
- break;
+ break;
+
+ default:
+ break;
}
}
@@ -1775,7 +1782,61 @@
} /* default_dirname */
+/* Store all selected files from @lv in a zip archive
+ and encrypt the zip archive then.
+ Return value: 0 on success. */
int
+fm_encrypt_into_zip (fm_state_t ctx, listview_ctrl_t lv)
+{
+ PK_FILE_LIST list=NULL;
+ const char *outfile;
+ char *out_enc;
+ int nitems = listview_count_items (lv, 0);
+ int i, idx = -1;
+ int rc;
+
+ if (!nitems) {
+ msg_box (NULL, _("Encrypting into a ZIP archive makes sense with multiple files"),
+ _("File Manager"), MB_ERR);
+ return -1;
+ }
+
+ outfile = get_filesave_dlg (NULL, _("Choose File Name for Output"),
+ NULL, "encrypted_files.zip");
+ if (!outfile)
+ return -1;
+
+ for (i=0; i < nitems; i++) {
+ char name[300];
+ if (!listview_get_item_state (lv, i))
+ continue;
+ if (idx == -1)
+ idx = i;
+ listview_get_item_text (lv, i, 1, name, sizeof (name)-1);
+ pk_list_add (&list, name);
+ }
+
+ pk_archiv_create (list, outfile);
+ pk_list_free (list);
+
+ rc = fm_encrypt (ctx, outfile, 0);
+ DeleteFile (outfile);
+ if (rc)
+ return rc;
+
+ out_enc = make_filename (NULL, outfile, "gpg");
+ fm_set_status (lv, idx, FM_ENCRYPT, 1, out_enc);
+ free_if_alloc (out_enc);
+
+ for (i=0; i < nitems; i++) {
+ if (i != idx && listview_get_item_state (lv, i))
+ listview_del_item (lv, i);
+ }
+ return 0;
+}
+
+
+int
fm_encrypt_directory( fm_state_t c, const char * name )
{
PK_FILE_LIST list = NULL;
@@ -1809,7 +1870,7 @@
free_if_alloc( p );
}
}
- s = get_filename_dlg( c->dlg, FILE_SAVE, _("Choose a Name for the Archive"),
+ s = get_filesave_dlg( c->dlg, _("Choose a Name for the Archive"),
NULL, default_dirname( name ) );
if( !s ) {
msg_box( c->dlg, _("Invalid archive name. Exit."), _("Encrypt Directory"), MB_ERR );
@@ -1822,7 +1883,7 @@
msg_box( c->dlg, _("Could not create zip archive."), _("Encrypt Directory"), MB_ERR );
else {
fm_encrypt( c, s, 0 );
- unlink( s );
+ remove( s );
}
leave:
FindClose (hd);
@@ -1871,6 +1932,7 @@
} /* fm_print_md */
+/* Send the selected file in @lv via MAPI to a mail recipient. */
int
fm_send_file (listview_ctrl_t lv)
{
@@ -1878,8 +1940,7 @@
int rc;
rc = listview_get_item_text (lv, -1, 1, buf, sizeof (buf)-1);
- if (rc == -1)
- return 0;
- /*mapi_send_ascfile (buf); XXX */
+ if (rc != -1)
+ mapi_send_ascfile (buf);
return 0;
}
Modified: trunk/Src/wptFileManagerDlg.cpp
===================================================================
--- trunk/Src/wptFileManagerDlg.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptFileManagerDlg.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -25,6 +25,7 @@
#include <windows.h>
#include <commctrl.h>
#include <sys/stat.h>
+#include <stdio.h>
#include "resource.h"
#include "wptCommonCtl.h"
@@ -62,7 +63,6 @@
{
static listview_ctrl_t lv = NULL;
static fm_state_t c;
- static int req_signer = 0;
static keylist_t list = NULL;
gpg_keycache_t kc;
gpgme_ctx_t ctx;
@@ -70,24 +70,25 @@
switch (msg) {
case WM_INITDIALOG:
- req_signer = 0;
c = (fm_state_t)lparam;
if (!c)
dlg_fatal_error( dlg, "Could not get dialog state!" );
kc = keycache_get_ctx (KEYCACHE_PUB);
if (!kc)
BUG (dlg);
-#ifndef LANG_DE
- SetWindowText( dlg, _("File Encrypt") );
- SetDlgItemText( dlg, IDC_ENCRYPT_ARMOR, _("&Text Output") );
- SetDlgItemText( dlg, IDC_ENCRYPT_WIPE, _("&Wipe Original") );
-#endif
+ SetWindowText (dlg, _("File Encrypt"));
+ SetDlgItemText (dlg, IDC_ENCRYPT_ARMOR, _("&Text Output"));
+ SetDlgItemText (dlg, IDC_ENCRYPT_WIPE, _("&Wipe Original"));
+
+ /* XXX: support --hidden-recipient */
+ EnableWindow (GetDlgItem (dlg, IDC_ENCRYPT_ANON), FALSE);
+
if (c->req_signer) {
EnableWindow (GetDlgItem (dlg, IDC_ENCRYPT_SIGN), TRUE);
seclist_init (dlg, IDC_ENCRYPT_SECLIST, KEYLIST_FLAG_SHORT, &list);
}
lv = keylist_load (GetDlgItem (dlg, IDC_ENCRYPT_LIST), kc, NULL,
- KEYLIST_ENCRYPT|KEYLIST_FLAG_FILE, KEY_SORT_USERID);
+ KEYLIST_ENCRYPT|KEYLIST_FLAG_FILE, KEY_SORT_USERID);
SetForegroundWindow (dlg);
return TRUE;
@@ -102,23 +103,23 @@
case WM_NOTIFY:
NMHDR *notify;
notify = (NMHDR *)lparam;
- if( notify && notify->code == LVN_COLUMNCLICK
- && notify->idFrom == IDC_ENCRYPT_LIST ) {
+ if (notify && notify->code == LVN_COLUMNCLICK
+ && notify->idFrom == IDC_ENCRYPT_LIST) {
NMLISTVIEW *p = (LPNMLISTVIEW) lparam;
int sortby = 0;
- switch( p->iSubItem ) {
+ switch (p->iSubItem) {
case 0: sortby = KEY_SORT_USERID; break;
case 1: sortby = KEY_SORT_KEYID; break;
case 2: sortby = KEY_SORT_LEN; break;
case 4: sortby = KEY_SORT_VALIDITY; break;
default:sortby = KEY_SORT_USERID; break;
}
- keylist_sort( lv, sortby );
+ keylist_sort (lv, sortby);
}
case WM_SYSCOMMAND:
- if( LOWORD( wparam ) == SC_CLOSE ) {
+ if (LOWORD (wparam) == SC_CLOSE) {
c->cancel = 1;
EndDialog( dlg, TRUE );
}
@@ -127,7 +128,7 @@
case WM_COMMAND:
if (HIWORD (wparam) == BN_CLICKED
&& LOWORD (wparam) == IDC_ENCRYPT_SIGN) {
- req_signer ^= 1;
+ int req_signer = IsDlgButtonChecked (dlg, IDC_ENCRYPT_SIGN);
EnableWindow (GetDlgItem (dlg, IDC_ENCRYPT_SECLIST),
req_signer? TRUE : FALSE);
}
@@ -586,6 +587,7 @@
case ID_FILEMISC_SIGNENC:
case ID_FILEMISC_VERIFY:
case ID_FILEMISC_WIPE:
+ case ID_FILEMISC_ENCRYPT_ZIP:
fm_parse_files (lv, dlg, LOWORD (wparam));
SetForegroundWindow (dlg);
return TRUE;
@@ -624,6 +626,7 @@
case ID_FILECTX_WIPE: send_cmd_id( dlg, ID_FILEMISC_WIPE ); break;
case ID_FILECTX_LIST: send_cmd_id( dlg, ID_FILEMISC_LIST ); break;
case ID_FILECTX_SEND: send_cmd_id( dlg, ID_FILEMISC_SEND ); break;
+ case ID_FILECTX_ENCRYPT_ZIP:send_cmd_id (dlg, ID_FILEMISC_ENCRYPT_ZIP); break;
}
break;
}
Modified: trunk/Src/wptGPG.cpp
===================================================================
--- trunk/Src/wptGPG.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptGPG.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -938,7 +938,7 @@
return WPTERR_GENERAL;
hwnd = GetDesktopWindow ();
- pring = get_filename_dlg (hwnd, FILE_OPEN, _("Please choose your public keyring"),
+ pring = get_fileopen_dlg (hwnd, _("Please choose your public keyring"),
_("GPG Keyrings (*.gpg)\0*.gpg\0\0"),NULL);
if (!pring) {
msg_box (hwnd, _("No keyring was chosen. Exit."), _("WinPT Error"), MB_ERR);
@@ -958,7 +958,7 @@
}
free_if_alloc (file);
- sring = get_filename_dlg (hwnd, FILE_OPEN, _("Please choose your secret keyring"),
+ sring = get_fileopen_dlg (hwnd, _("Please choose your secret keyring"),
_("GPG Keyrings (*.gpg)\0*.gpg\0\0"), NULL);
if (!sring) {
msg_box( NULL, _("No keyring was chosen. Exit."), _("WinPT Error"), MB_ERR );
Modified: trunk/Src/wptGPGPrefsDlg.cpp
===================================================================
--- trunk/Src/wptGPGPrefsDlg.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptGPGPrefsDlg.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -150,10 +150,10 @@
}
}
else {
- char * t = get_gnupg_cfgfile ();
- if (t && !file_exist_check (t))
- set_reg_entry_gpg( "OptFile", t );
- free_if_alloc (t);
+ char *cfg = get_gnupg_cfgfile ();
+ if (cfg && !file_exist_check (cfg))
+ set_reg_entry_gpg( "OptFile", cfg);
+ free_if_alloc (cfg);
}
if ( set_reg_entry_gpg( "HomeDir", homedir ) ) {
msg_box( dlg, _("Could not save 'HomeDir' in the registry."), _("Preferences"), MB_ERR );
@@ -234,17 +234,20 @@
break;
case IDC_GPGREFS_EXEDLG:
- const char * bin;
- bin = get_filename_dlg( dlg, FILE_OPEN, _("Choose GPG binary"), _("Executable Files (*.exe)\0*.exe\0\0"), NULL );
- if( bin )
- SetDlgItemText( dlg, IDC_GPGPREFS_EXEDIR, bin );
+ const char *bin;
+ bin = get_fileopen_dlg (dlg, _("Choose GPG binary"),
+ _("Executable Files (*.exe)\0*.exe\0\0"),
+ NULL);
+ if (bin)
+ SetDlgItemText (dlg, IDC_GPGPREFS_EXEDIR, bin);
return TRUE;
case IDC_GPGPREFS_OPTDLG:
- const char * opt;
- opt = get_filename_dlg( dlg, FILE_OPEN, _("Choose GPG config file"), NULL, NULL );
- if( opt )
- SetDlgItemText (dlg, IDC_GPGPREFS_OPTFILE, opt);
+ const char *optf;
+ optf = get_fileopen_dlg (dlg, _("Choose GPG config file"),
+ NULL, NULL);
+ if (optf)
+ SetDlgItemText (dlg, IDC_GPGPREFS_OPTFILE, optf);
return TRUE;
}
break;
Modified: trunk/Src/wptImportList.cpp
===================================================================
--- trunk/Src/wptImportList.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptImportList.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -127,10 +127,10 @@
rectype = KEY_secondary;
else if (!strncmp (buf, "uid", 3)) {
if (!c->uid) {
- const char *s = buf+3;
- while (s && *s == ':')
- s++;
- decode_userid ((char *)s, c);
+ const char *uid = buf+3;
+ while (uid && *uid == ':')
+ uid++;
+ decode_userid ((char *)uid, c);
}
return;
}
Modified: trunk/Src/wptKeyEdit.cpp
===================================================================
--- trunk/Src/wptKeyEdit.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptKeyEdit.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -324,9 +324,9 @@
/* Construct an object with the given key in @key. */
-GpgKeyEdit::GpgKeyEdit (gpgme_key_t key)
+GpgKeyEdit::GpgKeyEdit (gpgme_key_t _key)
{
- this->key = key;
+ this->key = _key;
pass = NULL;
type = 0;
name = NULL;
@@ -482,20 +482,20 @@
name, @cmt as the comment (or NULL) and @email as the email.
Return value: 0 on success. */
gpgme_error_t
-GpgKeyEdit::addUserid (const char *name, const char *cmt, const char *email)
+GpgKeyEdit::addUserid (const char *_name, const char *_cmt, const char *_email)
{
if (!this->key || !this->pass)
return gpg_error (GPG_ERR_INV_OBJ);
type = GPG_EDITKEY_ADDUID;
free_if_alloc (this->name);
- this->name = m_strdup (name);
+ this->name = m_strdup (_name);
free_if_alloc (this->cmt);
this->cmt = NULL;
if (cmt != NULL)
- this->cmt = m_strdup (cmt);
+ this->cmt = m_strdup (_cmt);
free_if_alloc (this->email);
- this->email = m_strdup (email);
+ this->email = m_strdup (_email);
if (!this->email || !this->name)
BUG (NULL);
return gpg_editkey (this->ctx, this->key, this);
@@ -533,16 +533,16 @@
key expires in @valid days.
Return value: 0 on success. */
gpgme_error_t
-GpgKeyEdit::addSubkey (gpgme_pubkey_algo_t pubkey_algo, unsigned int pubkey_size,
- long valid)
+GpgKeyEdit::addSubkey (gpgme_pubkey_algo_t _pubkey_algo,
+ unsigned int _pubkey_size, long _valid)
{
if (!this->key || !this->pass)
return gpg_error (GPG_ERR_INV_OBJ);
type = GPG_EDITKEY_ADDKEY;
- this->pubkey_algo = pubkey_algo;
- this->pubkey_size = pubkey_size;
- this->valid = valid;
+ this->pubkey_algo = _pubkey_algo;
+ this->pubkey_size = _pubkey_size;
+ this->valid = _valid;
return gpg_editkey (this->ctx, this->key, this);
}
Modified: trunk/Src/wptKeyEditDlgs.cpp
===================================================================
--- trunk/Src/wptKeyEditDlgs.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptKeyEditDlgs.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -280,7 +280,7 @@
switch( LOWORD( wparam ) ) {
case IDC_ADDPHOTO_SELFILE:
- s = get_filename_dlg( dlg, FILE_OPEN, _("Select Image File"), _("JPEG Files (*.jpg, *.jpeg)\0*.jpg;*.jpeg\0\0"), NULL );
+ s = get_fileopen_dlg( dlg, _("Select Image File"), _("JPEG Files (*.jpg, *.jpeg)\0*.jpg;*.jpeg\0\0"), NULL );
if( s && *s )
SetDlgItemText( dlg, IDC_ADDPHOTO_FILE, s );
break;
Modified: trunk/Src/wptKeyManager.cpp
===================================================================
--- trunk/Src/wptKeyManager.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptKeyManager.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -431,7 +431,7 @@
}
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_IMPORT, dlg,
- clip_import_dlg_proc, NULL,
+ clip_import_dlg_proc, 0,
_("Key Import"), IDS_WINPT_IMPORT);
return 0;
@@ -688,56 +688,53 @@
} /* km_send_to_keyserver */
+/* Send the selected key in @lv via MAPI to a mail recipient. */
int
-km_send_to_mail_recipient( listview_ctrl_t lv, HWND dlg )
+km_send_to_mail_recipient (listview_ctrl_t lv, HWND dlg)
{
-#if 0 /*FIXME*/
gpgme_key_t key;
gpgme_ctx_t ctx=NULL;
- gpgme_recipients_t rset=NULL;
+ gpgme_data_t out;
gpgme_error_t rc;
- const char * s;
- char keyid[32], tmp[192+256], * p =NULL;
+ const char *s;
+ char keyid[32], tmp[192+256];
int pos;
- if( listview_count_items( lv, 1 ) > 1 ) {
- msg_box( dlg, _("Please only select one key."), _("Key Manager"), MB_INFO|MB_OK );
+ if (listview_count_items (lv, 1 ) > 1) {
+ msg_box (dlg, _("Please only select one key."),
+ _("Key Manager"), MB_INFO|MB_OK);
return WPTERR_GENERAL;
}
- pos = listview_get_curr_pos( lv );
- if( pos == -1 ) {
- msg_box( dlg, _("Please select a key."), _("Key Manager"), MB_ERR );
+ pos = listview_get_curr_pos (lv);
+ if (pos == -1) {
+ msg_box (dlg, _("Please select a key."), _("Key Manager"), MB_ERR);
return WPTERR_GENERAL;
}
- listview_get_item_text( lv, pos, 1, keyid, sizeof keyid-1 );
- if( get_pubkey( keyid, &key ) )
- BUG( NULL );
+ listview_get_item_text(lv, pos, 1, keyid, sizeof keyid-1);
+ if (get_pubkey (keyid, &key))
+ BUG (NULL);
s = key->uids->name;
GetTempPath (sizeof tmp-1, tmp);
strncat (tmp, s, sizeof tmp-200);
strncat (tmp, ".asc", sizeof tmp-200);
- p = fm_quote_file (tmp);
- rc = gpgme_recipients_new (&rset);
- if (!rc)
- rc = gpgme_recipients_add_name (rset, keyid);
- if (!rc)
- rc = gpgme_new (&ctx);
- if (!rc) {
- gpgme_set_armor (ctx, 1);
- rc = gpgme_op_file_export (ctx, rset, p);
- }
+ rc = gpgme_new (&ctx);
if (rc)
+ BUG (NULL);
+ rc = gpgme_data_new (&out);
+ if (rc)
+ BUG (NULL);
+
+ gpgme_set_armor (ctx, 1);
+ rc = gpgme_op_export (ctx, key->subkeys->keyid, 0, out);
+ if (rc)
msg_box (dlg, gpgme_strerror (rc), _("Key Manager"), MB_ERR);
else
mapi_send_pubkey (keyid, tmp);
- free_if_alloc (p);
- gpgme_recipients_release (rset);
+ gpg_data_release_and_set_file (out, tmp);
gpgme_release (ctx);
return rc;
-#endif
- return 0;
}
Modified: trunk/Src/wptKeyManagerDlg.cpp
===================================================================
--- trunk/Src/wptKeyManagerDlg.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptKeyManagerDlg.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -650,7 +650,7 @@
keymanager_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
struct km_info *kmi;
- static km_group_s *gc = NULL;
+ /*static km_group_s *gc = NULL;*/
static HMENU menu = NULL;
static int refresh_keys = 0;
INITCOMMONCONTROLSEX icex;
@@ -667,7 +667,6 @@
const char *t, * host;
u16 port = 0;
int idx = 0, i=0, rc;
- size_t size = 0;
if ((msg != WM_INITDIALOG)
&& ((kmi = (struct km_info*)GetWindowLong (dlg, GWL_USERDATA)) == NULL))
@@ -1257,7 +1256,7 @@
return TRUE;
case ID_KEYMISC_IMPORT:
- t = get_filename_dlg (dlg, FILE_OPEN, _("Choose Name of the Key File"), NULL, NULL);
+ t = get_fileopen_dlg (dlg, _("Choose Name of the Key File"), NULL, NULL);
if (t)
km_file_import (dlg, t);
return TRUE;
@@ -1281,7 +1280,7 @@
listview_get_item_text (kmi->lv, idx, 1, keyid, DIM (keyid)-1);
name = gen_export_filename (keyid, 0);
}
- t = get_filename_dlg (dlg, FILE_SAVE, _("Choose Name for Key File"), NULL, name);
+ t = get_filesave_dlg (dlg, _("Choose Name for Key File"), NULL, name);
free_if_alloc (name);
if (t == NULL)
return TRUE;
@@ -1314,11 +1313,11 @@
idx = listview_get_curr_pos( kmi->lv );
listview_get_item_text( kmi->lv, idx, 1, keyid, sizeof (keyid)-8 );
name = gen_export_filename (keyid, 1);
- t = get_filename_dlg (dlg, FILE_SAVE, _("Choose Name for Key File"), NULL, name);
+ t = get_filesave_dlg (dlg, _("Choose Name for Key File"), NULL, name);
if (t != NULL)
km_privkey_export (dlg, kmi->lv, t);
}
- break;
+ return TRUE;
case ID_KEYMISC_INFO:
dialog_box_param( glob_hinst, (LPCSTR)IDD_WINPT_ABOUT, glob_hwnd,
Modified: trunk/Src/wptKeyPropsDlg.cpp
===================================================================
--- trunk/Src/wptKeyPropsDlg.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptKeyPropsDlg.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -269,13 +269,11 @@
if (!lparam)
dlg_fatal_error (dlg, "Could not get dialog param!");
k = (winpt_key_t)lparam;
- #ifndef LANG_DE
SetWindowText (dlg, _("Key Properties"));
SetDlgItemText (dlg, IDC_KEYPROPS_OT_CHANGE, _("&Change"));
SetDlgItemText (dlg, IDC_KEYPROPS_REVOKERS, _("&Revokers"));
SetDlgItemText (dlg, IDC_KEYPROPS_CHANGE_PWD, _("Change &Passwd"));
SetDlgItemText (dlg, IDC_KEYPROPS_OTINF, _("Ownertrust"));
- #endif
display_key_info (dlg, k, &key);
if (!keyprops_load_photo (dlg, key, &valid)) {
@@ -326,7 +324,7 @@
if (rc == IDNO)
return TRUE;
}
- //GetDlgItemText (dlg, IDC_KEYPROPS_OT, info, sizeof info -1);
+
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_KEYEDIT_OWNERTRUST,
dlg, (DLGPROC)keyedit_ownertrust_dlg_proc,
(LPARAM)k, _("Change Ownertrust"),
Modified: trunk/Src/wptKeyRevokeDlg.cpp
===================================================================
--- trunk/Src/wptKeyRevokeDlg.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptKeyRevokeDlg.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -115,7 +115,7 @@
case IDC_KEYREVOKE_CHOOSE:
const char *s;
mk_cert_fname (k->keyid, file, sizeof file-1);
- s = get_filename_dlg (dlg, FILE_SAVE, _("Choose File to save the Certificate"), NULL, file);
+ s = get_filesave_dlg (dlg, _("Choose File to save the Certificate"), NULL, file);
if (s && *s)
SetDlgItemText (dlg, IDC_KEYREVOKE_FILE, s);
return TRUE;
Modified: trunk/Src/wptKeygenDlg.cpp
===================================================================
--- trunk/Src/wptKeygenDlg.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptKeygenDlg.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -304,7 +304,7 @@
"Backup your keyrings now?"),
_("WARNING - Important hint" ), MB_YESNO);
if (id == IDYES) {
- name = get_filename_dlg( dlg, 1, _("Destination for Public Keyring"), NULL, "pubring.gpg" );
+ name = get_filesave_dlg( dlg, _("Destination for Public Keyring"), NULL, "pubring.gpg" );
if( name ) {
keyring = make_filename( path, "pubring", "gpg" );
if( !CopyFile( keyring, name, FALSE ) )
@@ -312,7 +312,7 @@
_("Could not copy %s -> %s"), keyring, name );
free_if_alloc( keyring );
}
- name = get_filename_dlg( dlg, 1, _("Destination for Secret Keyring"), NULL, "secring.gpg" );
+ name = get_filesave_dlg( dlg, _("Destination for Secret Keyring"), NULL, "secring.gpg" );
if( name ) {
keyring = make_filename( path, "secring", "gpg" );
if( !CopyFile( keyring, name, FALSE ) )
Modified: trunk/Src/wptKeyserver.cpp
===================================================================
--- trunk/Src/wptKeyserver.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptKeyserver.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -190,7 +190,7 @@
static int
sock_read (int fd, char *buf, int buflen, int *nbytes)
{
- DWORD nread;
+ int nread;
int nleft = buflen;
int rc, n = 0;
@@ -223,7 +223,7 @@
static int
sock_write (int fd, const char *buf, int buflen)
{
- DWORD nwritten;
+ int nwritten;
int nleft = buflen;
while (nleft > 0) {
Modified: trunk/Src/wptKeysignDlg.cpp
===================================================================
--- trunk/Src/wptKeysignDlg.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptKeysignDlg.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -225,7 +225,7 @@
switch ( msg ) {
case WM_INITDIALOG:
- if (lparam == NULL)
+ if (lparam == 0)
dlg_fatal_error (dlg, "Could not get dialog param.");
#ifndef LANG_DE
SetWindowText (dlg, _("Key Signing"));
Modified: trunk/Src/wptListView.cpp
===================================================================
--- trunk/Src/wptListView.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptListView.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -23,7 +23,6 @@
#endif
#include <stdio.h>
-#include <stdio.h>
#include <windows.h>
#include <commctrl.h>
@@ -314,6 +313,13 @@
void
+listview_deselect_all (listview_ctrl_t ctx)
+{
+ ListView_SetItemState (ctx->ctrl, -1, ~LVNI_SELECTED, LVNI_SELECTED);
+}
+
+
+void
listview_select_one (listview_ctrl_t ctx, int pos)
{
ListView_SetItemState (ctx->ctrl, pos, LVIS_SELECTED|LVIS_FOCUSED, LVIS_FOCUSED|LVIS_SELECTED);
Modified: trunk/Src/wptMAPI.cpp
===================================================================
--- trunk/Src/wptMAPI.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptMAPI.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -1,5 +1,5 @@
/* wptMAPI.cpp
- * Copyright (C) 2003, 2004 Timo Schulz
+ * Copyright (C) 2003, 2004, 2005 Timo Schulz
*
* This file is part of WinPT.
*
@@ -44,6 +44,8 @@
#define load_one_fnc(cast, hlib, name) (cast)GetProcAddress ((hlib), name)
+/* Load MAPI library and set function pointers.
+ Return value: 0 on success. */
int
mapi_init (void)
{
@@ -63,9 +65,10 @@
init = 1;
return 0;
-} /* mapi_init */
+}
+/* Free library and cleanup. */
void
mapi_deinit (void)
{
@@ -74,9 +77,10 @@
hlib = NULL;
init = 0;
}
-} /* mapi_deinit */
+}
-#if 0 /* low:priority XXX port the code */
+
+/* Send the file given in @ascfile via the MAPI mechanism. */
int
mapi_send_ascfile (char *ascfile)
{
@@ -103,6 +107,9 @@
}
+/* Send a public key stored in @keyfile with the keyid @keyid
+ via the MAPI mechanism to a mail recipient.
+ Return value: SUCCESS_SUCCESS on succes. */
int
mapi_send_pubkey (const char *keyid, char *keyfile)
{
@@ -134,9 +141,10 @@
mapi_logoff (hd, 0, 0, 0);
free_if_alloc (keyinf);
return rc;
-} /* mapi_send_pubkey */
+}
+#if 0 /* low:priority XXX port the code */
static void
free_mapi_msg (MapiMessage * msg)
{
Modified: trunk/Src/wptMDSumDlg.cpp
===================================================================
--- trunk/Src/wptMDSumDlg.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptMDSumDlg.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -118,7 +118,7 @@
gpgme_data_write (sumlist, fname, strlen (fname));
gpgme_data_write (sumlist, "\r\n", 2);
}
- const char *name = get_filename_dlg (dlg, 1, _("Select file to save checksums"), NULL, NULL);
+ const char *name = get_filesave_dlg (dlg, _("Select file to save checksums"), NULL, NULL);
if (name && *name) {
gpg_data_release_and_set_file (sumlist, name);
log_box (_("File Manager"), MB_OK, "Checksums successfully saved in '%s'", name);
Modified: trunk/Src/wptPassphraseCB.cpp
===================================================================
--- trunk/Src/wptPassphraseCB.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptPassphraseCB.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -41,8 +41,6 @@
#include "wptAgent.h"
#include "wptRegistry.h"
-
-
const char* get_symkey_algo (int algo);
#define item_ctrl_id( cmd ) \
@@ -67,9 +65,9 @@
static BOOL CALLBACK
passphrase_callback_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
- static passphrase_cb_s * c;
- gpgme_decrypt_result_t res = NULL;
- gpgme_sign_result_t res_sig = NULL;
+ static passphrase_cb_s *c;
+ gpgme_decrypt_result_t res=NULL;
+ gpgme_sign_result_t res_sig=NULL;
gpgme_key_t key;
gpgme_recipient_t recip=NULL, r;
void *item;
@@ -201,12 +199,12 @@
}
res = gpgme_op_decrypt_result (c->gpg);
if (!res)
- res_sig = gpgme_op_sign_result (c->gpg);
- if (reg_prefs.cache_time > 0 && !c->is_card &&
- ((res && res->recipients) || (res_sig && res_sig->signatures))) {
- if (agent_get_cache (c->keyid, &item))
+ res_sig = gpgme_op_sign_result (c->gpg);
+ if (reg_prefs.cache_time > 0 && !c->is_card &&
+ (res || res_sig)) {
+ if (agent_get_cache (c->keyid, &item))
agent_unlock_cache_entry (&item);
- else
+ else
agent_put_cache (c->keyid, c->pwd, reg_prefs.cache_time);
}
c->cancel = 0;
@@ -234,8 +232,10 @@
static char keyid[16+1];
/* XXX: check for leading alpha-chars? */
- if (strlen (pass_info) < 16)
+ if (strlen (pass_info) < 16) {
+ log_debug ("parse_gpg_keyid: error '%s'\r\n", pass_info);
return NULL;
+ }
/* the format of the desc buffer looks like this:
request_keyid[16] main_keyid[16] keytype[1] keylength[4]
we use the main keyid to use only one cache entry. */
@@ -261,6 +261,7 @@
/* Each uid_hint contains a long key-ID so it is at least 16 bytes. */
if (strlen (uid_hint) < 17) {
*desc = 0;
+ log_debug ("parse_gpg_description: error '%s'\r\n", uid_hint);
return -1;
}
@@ -301,8 +302,10 @@
char *p;
p = strchr (id, '/');
- if (!p)
+ if (!p) {
+ log_debug ("extract_serial_no: error '%s'\r\n", id);
return NULL;
+ }
strncpy (buf, id+(p-id)-6, 6);
return buf;
}
@@ -319,10 +322,12 @@
void *item;
const char *keyid=NULL, *pass;
DWORD n;
- int rc=0;
+ int rc = 0;
- if (!c)
+ if (!c) {
+ log_debug ("passphrase_cb: error '!c'\r\n");
return gpg_error (GPG_ERR_INV_ARG);
+ }
c->bad_pwd = prev_was_bad? 1 : 0;
if (prev_was_bad && !c->cancel) {
if (c->pwd)
@@ -345,7 +350,7 @@
}
keyid = parse_gpg_keyid (passphrase_info);
- pass = agent_get_cache (keyid+8, &item);
+ pass = agent_get_cache (keyid+8, &item);
if (pass) {
agent_unlock_cache_entry (&item);
c->pwd_init = 0;
@@ -398,8 +403,10 @@
return 0;
}
- WriteFile (hd, c->pwd, strlen (c->pwd), &n, NULL);
- WriteFile (hd, "\n", 1, &n, NULL);
+ if (!WriteFile (hd, c->pwd, strlen (c->pwd), &n, NULL))
+ log_debug ("passphrase_cb: WriteFile() failed ec=%d\n", w32_errno);
+ if (!WriteFile (hd, "\n", 1, &n, NULL))
+ log_debug ("passphrase_cb: WriteFile() failed ec=%d\n", w32_errno);
return 0;
}
Modified: trunk/Src/wptPreferencesDlg.cpp
===================================================================
--- trunk/Src/wptPreferencesDlg.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptPreferencesDlg.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -235,7 +235,7 @@
case IDC_PREFS_KSELFILE: {
const char * name;
- name = get_filename_dlg (dlg, FILE_OPEN, _("Please select a keyserver.conf file"),
+ name = get_fileopen_dlg (dlg, _("Please select a keyserver.conf file"),
NULL, NULL);
if (name != NULL)
SetDlgItemText (dlg, IDC_PREFS_KSERVER, name);
Modified: trunk/Src/wptTextInputDlg.cpp
===================================================================
--- trunk/Src/wptTextInputDlg.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptTextInputDlg.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -93,7 +93,7 @@
case IDC_TEXT_FILE:
const char *file;
- file = get_filename_dlg( dlg, FILE_OPEN, _("Text Input from File"), NULL, NULL );
+ file = get_fileopen_dlg( dlg, _("Text Input from File"), NULL, NULL );
if( file )
load_file_contents( dlg, file );
break;
Modified: trunk/Src/wptW32API.cpp
===================================================================
--- trunk/Src/wptW32API.cpp 2005-11-10 14:07:06 UTC (rev 76)
+++ trunk/Src/wptW32API.cpp 2005-11-14 15:01:01 UTC (rev 77)
@@ -84,6 +84,10 @@
}
+enum {
+ CDLG_FILE_OPEN = 0,
+ CDLG_FILE_SAVE = 1
+};
/* Use the common dialog to request a file from the user.
id can be either FILE_OPEN or FILE_SAVE.
@@ -111,14 +115,14 @@
open.hwndOwner = hwnd;
open.lpstrFile = file;
open.nMaxFile = sizeof (file) - 1;
- if (id == FILE_OPEN)
+ if (id == CDLG_FILE_OPEN)
open.Flags = OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST;
else
open.Flags = OFN_OVERWRITEPROMPT;
- if (id == FILE_OPEN && GetOpenFileName (&open))
+ if (id == CDLG_FILE_OPEN && GetOpenFileName (&open))
return open.lpstrFile;
- else if (id == FILE_SAVE && GetSaveFileName (&open))
+ else if (id == CDLG_FILE_SAVE && GetSaveFileName (&open))
return open.lpstrFile;
return NULL;
@@ -128,14 +132,14 @@
get_filesave_dlg (HWND hwnd, const char *title,
const char *filter, const char *name)
{
- return get_filename_dlg (hwnd, FILE_SAVE, title, filter, name);
+ return get_filename_dlg (hwnd, CDLG_FILE_SAVE, title, filter, name);
}
const char *
get_fileopen_dlg (HWND hwnd, const char *title, const char *filter,
const char *name)
{
- return get_filename_dlg (hwnd, FILE_OPEN, title, filter, name);
+ return get_filename_dlg (hwnd, CDLG_FILE_OPEN, title, filter, name);
}
@@ -314,23 +318,23 @@
}
-/* Return the file size of the given file. */
-size_t
+/* Return the file size of the given file @fname. */
+DWORD
get_file_size (const char *fname)
{
- size_t fsize;
+ DWORD fsize;
HANDLE fh;
- fh = CreateFile( fname, GENERIC_READ, FILE_SHARE_READ,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
- if( fh == INVALID_HANDLE_VALUE )
+ fh = CreateFile (fname, GENERIC_READ, FILE_SHARE_READ,
+ NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (fh == INVALID_HANDLE_VALUE)
return 0;
- fsize = GetFileSize( fh, NULL );
- if( fsize == 0xFFFFFFFF )
+ fsize = GetFileSize (fh, NULL);
+ if (fsize == 0xFFFFFFFF)
fsize = 0;
- CloseHandle( fh );
+ CloseHandle (fh);
return fsize;
-} /* get_file_size */
+}
int
More information about the Winpt-commits
mailing list