diff options
author | George Hazan <george.hazan@gmail.com> | 2013-06-11 17:48:18 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-06-11 17:48:18 +0000 |
commit | 2fbe1d2262383b272ef887d712f308f787cf33f1 (patch) | |
tree | 772a78df1caf0be843d8778344e02ac750ba7a03 /plugins/CryptoPP/src/GPGw | |
parent | 48fc03aa394f4506c6053323386c040fede13a29 (diff) |
64-bit compatible version of CryptoPP
git-svn-id: http://svn.miranda-ng.org/main/trunk@4917 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CryptoPP/src/GPGw')
-rw-r--r-- | plugins/CryptoPP/src/GPGw/Release/GnuPGw.dll | bin | 13824 -> 0 bytes | |||
-rw-r--r-- | plugins/CryptoPP/src/GPGw/commonheaders.c | 42 | ||||
-rw-r--r-- | plugins/CryptoPP/src/GPGw/gpg.cpp (renamed from plugins/CryptoPP/src/GPGw/gpg.c) | 5 | ||||
-rw-r--r-- | plugins/CryptoPP/src/GPGw/gpg.rc (renamed from plugins/CryptoPP/src/GPGw/resource.rc) | 15 | ||||
-rw-r--r-- | plugins/CryptoPP/src/GPGw/gpg_main.cpp (renamed from plugins/CryptoPP/src/GPGw/main.c) | 56 | ||||
-rw-r--r-- | plugins/CryptoPP/src/GPGw/gpg_res.h (renamed from plugins/CryptoPP/src/GPGw/resource.h) | 0 | ||||
-rw-r--r-- | plugins/CryptoPP/src/GPGw/gpgw.h (renamed from plugins/CryptoPP/src/GPGw/commonheaders.h) | 30 | ||||
-rw-r--r-- | plugins/CryptoPP/src/GPGw/keys.cpp (renamed from plugins/CryptoPP/src/GPGw/keys.c) | 5 | ||||
-rw-r--r-- | plugins/CryptoPP/src/GPGw/language.cpp (renamed from plugins/CryptoPP/src/GPGw/language.c) | 3 | ||||
-rw-r--r-- | plugins/CryptoPP/src/GPGw/passdialog.cpp (renamed from plugins/CryptoPP/src/GPGw/passdialog.c) | 4 | ||||
-rw-r--r-- | plugins/CryptoPP/src/GPGw/passphrases.cpp (renamed from plugins/CryptoPP/src/GPGw/passphrases.c) | 7 | ||||
-rw-r--r-- | plugins/CryptoPP/src/GPGw/pipeexec.cpp (renamed from plugins/CryptoPP/src/GPGw/pipeexec.c) | 4 | ||||
-rw-r--r-- | plugins/CryptoPP/src/GPGw/tools.cpp (renamed from plugins/CryptoPP/src/GPGw/tools.c) | 3 | ||||
-rw-r--r-- | plugins/CryptoPP/src/GPGw/userdialog.cpp (renamed from plugins/CryptoPP/src/GPGw/userdialog.c) | 5 |
14 files changed, 73 insertions, 106 deletions
diff --git a/plugins/CryptoPP/src/GPGw/Release/GnuPGw.dll b/plugins/CryptoPP/src/GPGw/Release/GnuPGw.dll Binary files differdeleted file mode 100644 index 7dba65ea45..0000000000 --- a/plugins/CryptoPP/src/GPGw/Release/GnuPGw.dll +++ /dev/null diff --git a/plugins/CryptoPP/src/GPGw/commonheaders.c b/plugins/CryptoPP/src/GPGw/commonheaders.c deleted file mode 100644 index 5404e4ed80..0000000000 --- a/plugins/CryptoPP/src/GPGw/commonheaders.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "commonheaders.h"
-
-LPCSTR szModuleName = MODULENAME;
-LPCSTR szVersionStr = MODULENAME" DLL ("__VERSION_STRING")";
-HINSTANCE g_hInst;
-
-char temporarydirectory[fullfilenamesize];
-char logfile[fullfilenamesize];
-/*
-char *txtbeginpgppublickeyblock="-----BEGIN PGP PUBLIC KEY BLOCK-----";
-char *txtendpgppublickeyblock="-----END PGP PUBLIC KEY BLOCK-----";
-*/
-char *txtbeginpgpmessage="-----BEGIN PGP MESSAGE-----";
-char *txtendpgpmessage="-----END PGP MESSAGE-----";
-
-
-void __cdecl ErrorMessage(const char *alevel, const char *atext, const char *ahint)
-{
- char buffer[errormessagesize];
-
- strcpy(buffer, atext);
- strcat(buffer, " ");
- strcat(buffer, ahint);
- MessageBox(NULL, buffer, alevel, MB_OK);
-}
-
-
-void __cdecl LogMessage(const char *astart, const char *atext, const char *aend)
-{
- FILE *log;
-
- if(logfile[0]=='\0') return;
-
- log=fopen(logfile, "a");
- if(log!=NULL)
- {
- fputs(astart, log);
- fputs(atext, log);
- fputs(aend, log);
- fclose(log);
- }
-}
diff --git a/plugins/CryptoPP/src/GPGw/gpg.c b/plugins/CryptoPP/src/GPGw/gpg.cpp index 8ec3a57b11..47d5d178dc 100644 --- a/plugins/CryptoPP/src/GPGw/gpg.c +++ b/plugins/CryptoPP/src/GPGw/gpg.cpp @@ -1,5 +1,5 @@ -#include "commonheaders.h"
-#include <stdio.h>
+#include "../commonheaders.h"
+#include "gpgw.h"
char *txtgpgargslistpublickeys=
"--homedir \"%home%\""
@@ -363,4 +363,3 @@ gpgResult gpgDecrypt(char *aresult, const char *aciphertext, const char *apassph remove(plainfile);
return gpgSuccess;
}
-
diff --git a/plugins/CryptoPP/src/GPGw/resource.rc b/plugins/CryptoPP/src/GPGw/gpg.rc index 53968a5d2e..313dad2701 100644 --- a/plugins/CryptoPP/src/GPGw/resource.rc +++ b/plugins/CryptoPP/src/GPGw/gpg.rc @@ -1,6 +1,6 @@ // Microsoft Visual C++ generated resource script.
//
-#include "resource.h"
+#include "gpg_res.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
@@ -43,7 +43,7 @@ STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTI CAPTION "GnuPG Plugin - Select public key"
FONT 8, "MS Shell Dlg"
BEGIN
- CONTROL "",IDC_KEYLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING |
+ CONTROL "",IDC_KEYLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING |
LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,258,174
PUSHBUTTON "Refresh",IDC_REFRESH,7,187,50,14
DEFPUSHBUTTON "Ok",IDOK,154,187,50,14
@@ -57,7 +57,7 @@ END //
#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
+GUIDELINES DESIGNINFO
BEGIN
IDD_SELECTKEY, DIALOG
BEGIN
@@ -76,18 +76,18 @@ END // TEXTINCLUDE
//
-1 TEXTINCLUDE
+1 TEXTINCLUDE
BEGIN
- "resource.h\0"
+ "gpg_res.h\0"
END
-2 TEXTINCLUDE
+2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
-3 TEXTINCLUDE
+3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
@@ -109,4 +109,3 @@ END /////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
-
diff --git a/plugins/CryptoPP/src/GPGw/main.c b/plugins/CryptoPP/src/GPGw/gpg_main.cpp index fc23b24262..700e27b691 100644 --- a/plugins/CryptoPP/src/GPGw/main.c +++ b/plugins/CryptoPP/src/GPGw/gpg_main.cpp @@ -1,9 +1,44 @@ -#include "commonheaders.h"
-
+#include "../commonheaders.h"
+#include "gpgw.h"
BOOL ShowSelectExecDlg(LPSTR);
BOOL ShowSelectHomeDlg(LPSTR);
+char temporarydirectory[fullfilenamesize];
+char logfile[fullfilenamesize];
+/*
+char *txtbeginpgppublickeyblock="-----BEGIN PGP PUBLIC KEY BLOCK-----";
+char *txtendpgppublickeyblock="-----END PGP PUBLIC KEY BLOCK-----";
+*/
+char *txtbeginpgpmessage="-----BEGIN PGP MESSAGE-----";
+char *txtendpgpmessage="-----END PGP MESSAGE-----";
+
+void __cdecl ErrorMessage(const char *alevel, const char *atext, const char *ahint)
+{
+ char buffer[errormessagesize];
+
+ strcpy(buffer, atext);
+ strcat(buffer, " ");
+ strcat(buffer, ahint);
+ MessageBox(NULL, buffer, alevel, MB_OK);
+}
+
+
+void __cdecl LogMessage(const char *astart, const char *atext, const char *aend)
+{
+ FILE *log;
+
+ if(logfile[0]=='\0') return;
+
+ log=fopen(logfile, "a");
+ if(log!=NULL)
+ {
+ fputs(astart, log);
+ fputs(atext, log);
+ fputs(aend, log);
+ fclose(log);
+ }
+}
int __cdecl _gpg_init()
{
@@ -74,7 +109,7 @@ void __cdecl _gpg_set_tmp(LPCSTR TmpPath) LPSTR __cdecl _gpg_get_passphrases()
{
size_t i; char *b, x;
-
+
b = (char *) LocalAlloc(LPTR,(keyuseridsize+passphrasesize)*passphrasecount+1); *b = '\0';
for(i=0; i<(size_t)passphrasecount; i++) {
@@ -155,7 +190,6 @@ LPSTR __cdecl _gpg_decrypt(LPCSTR message) char buffer[ciphertextsize];
char plaintext[plaintextsize];
char keyuserid[keyuseridsize];
- char *begin, *end;
int dlgresult;
BOOL useridvalid;
char *storedpassphrase;
@@ -164,8 +198,8 @@ LPSTR __cdecl _gpg_decrypt(LPCSTR message) int decmessagelen;
gpgResult gpgresult;
- begin=strstr(message, txtbeginpgpmessage);
- end=strstr(message, txtendpgpmessage);
+ const char *begin = strstr(message, txtbeginpgpmessage);
+ const char *end = strstr(message, txtendpgpmessage);
if ((begin!=NULL)&&(end!=NULL))
{
@@ -353,17 +387,9 @@ BOOL ShowSelectHomeDlg(LPSTR path) ofn.lpstrFilter = "Public key rings (pubring.gpg)\0pubring.gpg\0All files (*.*)\0*.*\0";
ofn.lpstrTitle = "Open Public Keyring";
if (!GetOpenFileName(&ofn)) return FALSE;
-
+
for(i=strlen(path);i && path[i]!='\\';i--);
path[i] = 0;
return TRUE;
}
-
-
-// dllmain
-BOOL WINAPI dllmain(HINSTANCE hInst, DWORD dwReason, LPVOID lpVoid) {
- g_hInst = hInst;
- return TRUE;
-}
-
diff --git a/plugins/CryptoPP/src/GPGw/resource.h b/plugins/CryptoPP/src/GPGw/gpg_res.h index af5efe29d7..af5efe29d7 100644 --- a/plugins/CryptoPP/src/GPGw/resource.h +++ b/plugins/CryptoPP/src/GPGw/gpg_res.h diff --git a/plugins/CryptoPP/src/GPGw/commonheaders.h b/plugins/CryptoPP/src/GPGw/gpgw.h index 4ae6e155a7..abaf52430e 100644 --- a/plugins/CryptoPP/src/GPGw/commonheaders.h +++ b/plugins/CryptoPP/src/GPGw/gpgw.h @@ -1,19 +1,11 @@ // Windows API
#pragma once
-#define _WIN32_IE 0x0500
-//#define WIN32_LEAN_AND_MEAN
-//#pragma warning(disable: 4078)
-#include <windows.h>
-//#include <afxwin.h>
-#include <commdlg.h>
-#include <commctrl.h>
-#include <stdio.h>
#include "..\version.h"
// gnupg plugin
-#include "resource.h"
+#include "gpg_res.h"
#include "size.h"
#include "language.h"
#include "pipeexec.h"
@@ -24,17 +16,14 @@ #include "userdialog.h"
#include "keys.h"
-// debug makro
-#define debugout(mtext) MessageBox(NULL, (mtext), "GnuPG Plugin - Debug", MB_OK)
-
// passphrase typ
-struct passphrase
+struct passphrase_t
{
- char keyuserid[keyuseridsize];
- char passphrase[passphrasesize];
+ char keyuserid[keyuseridsize];
+ char passphrase[passphrasesize];
};
-extern struct passphrase *passphrases;
+extern struct passphrase_t *passphrases;
extern int passphrasecount;
extern char temporarydirectory[fullfilenamesize];
@@ -45,14 +34,7 @@ extern char *txtendpgppublickeyblock; extern char *txtbeginpgpmessage;
extern char *txtendpgpmessage;
-#ifdef _MSC_VER
-//#pragma comment(linker,"/merge:.rdata=.text")
-#pragma comment(linker,"/entry:dllmain")
-#pragma comment(linker,"/nodefaultlib")
-#pragma comment(linker,"/subsystem:windows")
-#pragma optimize("gsy", on)
-#endif
-
+#undef MODULENAME
#define MODULENAME "GnuPG"
extern LPCSTR szModuleName;
diff --git a/plugins/CryptoPP/src/GPGw/keys.c b/plugins/CryptoPP/src/GPGw/keys.cpp index 4cfbe4f71d..19606d446a 100644 --- a/plugins/CryptoPP/src/GPGw/keys.c +++ b/plugins/CryptoPP/src/GPGw/keys.cpp @@ -1,4 +1,5 @@ -#include "commonheaders.h"
+#include "../commonheaders.h"
+#include "gpgw.h"
typedef char tkeyuserid[keyuseridsize];
@@ -41,7 +42,7 @@ void updateKeyUserIDs(const int atype) if(pos!=NULL)
{
keyuseridcount[atype]++;
- keyuserids[atype]=realloc(keyuserids[atype], sizeof(tkeyuserid)*keyuseridcount[atype]);
+ keyuserids[atype] = (tkeyuserid*)realloc(keyuserids[atype], sizeof(tkeyuserid)*keyuseridcount[atype]);
strcpy(keyuserids[atype][keyuseridcount[atype]-1], keyuserid);
}
}
diff --git a/plugins/CryptoPP/src/GPGw/language.c b/plugins/CryptoPP/src/GPGw/language.cpp index 4997711629..a815f7cff3 100644 --- a/plugins/CryptoPP/src/GPGw/language.c +++ b/plugins/CryptoPP/src/GPGw/language.cpp @@ -1,4 +1,5 @@ -#include "commonheaders.h"
+#include "../commonheaders.h"
+#include "gpgw.h"
//char *txtverifyoptions="Please verify your settings in M->Options->Plugins->GnuPG and GnuPG Advanced."; /*lang*/
//char *txtinvalidexecutable="The GnuPG Plugin requires the GnuPG executable \"gpg.exe\"."; /*lang*/
diff --git a/plugins/CryptoPP/src/GPGw/passdialog.c b/plugins/CryptoPP/src/GPGw/passdialog.cpp index cbba1139ab..d00753af9e 100644 --- a/plugins/CryptoPP/src/GPGw/passdialog.c +++ b/plugins/CryptoPP/src/GPGw/passdialog.cpp @@ -1,8 +1,8 @@ -#include "commonheaders.h"
+#include "../commonheaders.h"
+#include "gpgw.h"
char dlgpassphrase[passphrasesize];
-
BOOL CALLBACK PassphraseDialogProcedure(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
switch(msg)
diff --git a/plugins/CryptoPP/src/GPGw/passphrases.c b/plugins/CryptoPP/src/GPGw/passphrases.cpp index 5e93936ffc..847472f5ac 100644 --- a/plugins/CryptoPP/src/GPGw/passphrases.c +++ b/plugins/CryptoPP/src/GPGw/passphrases.cpp @@ -1,7 +1,8 @@ -#include "commonheaders.h"
+#include "../commonheaders.h"
+#include "gpgw.h"
// globale variablen
-struct passphrase *passphrases;
+struct passphrase_t *passphrases;
int passphrasecount;
@@ -26,7 +27,7 @@ void releasePassphrases(void) void addPassphrase(const char *akeyuserid, const char *apassphrase)
{
passphrasecount++;
- passphrases=realloc(passphrases, sizeof(struct passphrase)*passphrasecount);
+ passphrases = (passphrase_t*)realloc(passphrases, sizeof(struct passphrase_t)*passphrasecount);
strcpy(passphrases[passphrasecount-1].keyuserid, akeyuserid);
strcpy(passphrases[passphrasecount-1].passphrase, apassphrase);
diff --git a/plugins/CryptoPP/src/GPGw/pipeexec.c b/plugins/CryptoPP/src/GPGw/pipeexec.cpp index ea54f85d1a..fdefb147d6 100644 --- a/plugins/CryptoPP/src/GPGw/pipeexec.c +++ b/plugins/CryptoPP/src/GPGw/pipeexec.cpp @@ -1,5 +1,5 @@ -#include "commonheaders.h"
-
+#include "../commonheaders.h"
+#include "gpgw.h"
BOOL isWindowsNT(void)
{
diff --git a/plugins/CryptoPP/src/GPGw/tools.c b/plugins/CryptoPP/src/GPGw/tools.cpp index 002f18824d..6886088e4e 100644 --- a/plugins/CryptoPP/src/GPGw/tools.c +++ b/plugins/CryptoPP/src/GPGw/tools.cpp @@ -1,4 +1,5 @@ -#include "commonheaders.h"
+#include "../commonheaders.h"
+#include "gpgw.h"
// escape sequence type
struct escapesequence
diff --git a/plugins/CryptoPP/src/GPGw/userdialog.c b/plugins/CryptoPP/src/GPGw/userdialog.cpp index bb82917c55..65edcfe278 100644 --- a/plugins/CryptoPP/src/GPGw/userdialog.c +++ b/plugins/CryptoPP/src/GPGw/userdialog.cpp @@ -1,9 +1,8 @@ -#include "commonheaders.h"
-
+#include "../commonheaders.h"
+#include "gpgw.h"
void RefreshListView(HWND hLV);
-
BOOL CALLBACK UserIdDialogProcedure(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
static char *keyid;
|