diff options
Diffstat (limited to 'plugins/CryptoPP')
-rw-r--r-- | plugins/CryptoPP/cryptopp_10.vcxproj | 1 | ||||
-rw-r--r-- | plugins/CryptoPP/cryptopp_10.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/CryptoPP/cryptopp_11.vcxproj | 1 | ||||
-rw-r--r-- | plugins/CryptoPP/cryptopp_11.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/CryptoPP/res/resource.rc | 3 | ||||
-rw-r--r-- | plugins/CryptoPP/res/version.rc | 26 | ||||
-rw-r--r-- | plugins/CryptoPP/src/commonheaders.cpp | 111 | ||||
-rw-r--r-- | plugins/CryptoPP/src/commonheaders.h | 5 | ||||
-rw-r--r-- | plugins/CryptoPP/src/main.cpp | 135 | ||||
-rw-r--r-- | plugins/CryptoPP/src/version.h | 25 |
10 files changed, 135 insertions, 178 deletions
diff --git a/plugins/CryptoPP/cryptopp_10.vcxproj b/plugins/CryptoPP/cryptopp_10.vcxproj index a1d50e1003..936d74030d 100644 --- a/plugins/CryptoPP/cryptopp_10.vcxproj +++ b/plugins/CryptoPP/cryptopp_10.vcxproj @@ -196,7 +196,6 @@ <ClCompile Include="src\gettime.cpp" />
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\mmi.cpp" />
- <ClCompile Include="src\commonheaders.cpp" />
<ClCompile Include="src\utf8.cpp" />
</ItemGroup>
<ItemGroup>
diff --git a/plugins/CryptoPP/cryptopp_10.vcxproj.filters b/plugins/CryptoPP/cryptopp_10.vcxproj.filters index 328dfb7b06..de49291ef3 100644 --- a/plugins/CryptoPP/cryptopp_10.vcxproj.filters +++ b/plugins/CryptoPP/cryptopp_10.vcxproj.filters @@ -15,9 +15,6 @@ </Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="src\commonheaders.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\cpp_cntx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
diff --git a/plugins/CryptoPP/cryptopp_11.vcxproj b/plugins/CryptoPP/cryptopp_11.vcxproj index c346ccaf95..2c6b9f6125 100644 --- a/plugins/CryptoPP/cryptopp_11.vcxproj +++ b/plugins/CryptoPP/cryptopp_11.vcxproj @@ -200,7 +200,6 @@ <ClCompile Include="src\gettime.cpp" />
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\mmi.cpp" />
- <ClCompile Include="src\commonheaders.cpp" />
<ClCompile Include="src\utf8.cpp" />
</ItemGroup>
<ItemGroup>
diff --git a/plugins/CryptoPP/cryptopp_11.vcxproj.filters b/plugins/CryptoPP/cryptopp_11.vcxproj.filters index 328dfb7b06..de49291ef3 100644 --- a/plugins/CryptoPP/cryptopp_11.vcxproj.filters +++ b/plugins/CryptoPP/cryptopp_11.vcxproj.filters @@ -15,9 +15,6 @@ </Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="src\commonheaders.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\cpp_cntx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
diff --git a/plugins/CryptoPP/res/resource.rc b/plugins/CryptoPP/res/resource.rc index 24b43511b9..93360fb460 100644 --- a/plugins/CryptoPP/res/resource.rc +++ b/plugins/CryptoPP/res/resource.rc @@ -27,9 +27,8 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT 1 TEXTINCLUDE
BEGIN
- "resource.h\0"
+ "..\\src\resource.h\0"
"afxres.h\0"
- "version.rc\0"
END
#endif // APSTUDIO_INVOKED
diff --git a/plugins/CryptoPP/res/version.rc b/plugins/CryptoPP/res/version.rc index b4914d803f..5bfbab4754 100644 --- a/plugins/CryptoPP/res/version.rc +++ b/plugins/CryptoPP/res/version.rc @@ -1,14 +1,11 @@ +// Microsoft Visual C++ generated resource script.
+//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
-#include "..\src\version.h"
#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
+#include "..\src\version.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION __FILEVERSION_STRING
@@ -20,21 +17,18 @@ VS_VERSION_INFO VERSIONINFO FILEFLAGS 0x0L
#endif
FILEOS 0x4L
- FILETYPE 0x2L
+ FILETYPE 0x0L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
- VALUE "Comments", "Licensed under the terms of the GNU General Public License"
- VALUE "FileDescription", "Crypto++ implementation for SecureIM"
- VALUE "FileVersion", __VERSION_STRING
- VALUE "InternalName", "Crypto++"
- VALUE "LegalCopyright", "Copyright é 2006-09 Baloo"
- VALUE "OriginalFilename", "cryptopp.dll"
- VALUE "ProductName", "Crypto++ library"
- VALUE "ProductVersion", __VERSION_STRING
+ VALUE "FileDescription", __DESCRIPTION
+ VALUE "InternalName", __PLUGIN_NAME
+ VALUE "LegalCopyright", __COPYRIGHT
+ VALUE "OriginalFilename", __FILENAME
+ VALUE "ProductName", __PLUGIN_NAME
END
END
BLOCK "VarFileInfo"
@@ -42,5 +36,3 @@ BEGIN VALUE "Translation", 0x0, 1200
END
END
-
-
diff --git a/plugins/CryptoPP/src/commonheaders.cpp b/plugins/CryptoPP/src/commonheaders.cpp deleted file mode 100644 index 4f6c653d19..0000000000 --- a/plugins/CryptoPP/src/commonheaders.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#include "commonheaders.h"
-
-LPCSTR szModuleName = MODULENAME;
-LPCSTR szVersionStr = MODULENAME" DLL ("__VERSION_STRING")";
-HINSTANCE g_hInst;
-
-HANDLE hPGPPRIV = NULL;
-HANDLE hRSA4096 = NULL;
-
-CRITICAL_SECTION localQueueMutex;
-CRITICAL_SECTION localContextMutex;
-
-char TEMP[MAX_PATH];
-int TEMP_SIZE = 0;
-BOOL isVista = 0;
-
-PLUGININFOEX pluginInfoEx = {
- sizeof(PLUGININFOEX),
- MODULENAME,
- __VERSION_DWORD,
- MODULENAME" library for SecureIM plugin.",
- "Baloo",
- "baloo@bk.ru",
- "© 2006-09 Baloo",
- "http://miranda-ng.org/",
- UNICODE_AWARE,
- //3613F2D9-C040-4361-A44F-DF7B5AAACF6E
- {0x3613F2D9, 0xC040, 0x4361, {0xA4, 0x4F, 0xDF, 0x7B, 0x5A, 0xAA, 0xCF, 0x6E}}
-};
-
-
-BOOL ExtractFileFromResource( HANDLE FH, int ResType, int ResId, DWORD* Size )
-{
- HRSRC RH;
- PBYTE RP;
- DWORD s,x;
-
- RH = FindResource( g_hInst, MAKEINTRESOURCE( ResId ), MAKEINTRESOURCE( ResType ) );
-
- if ( RH == NULL ) return FALSE;
- RP = (PBYTE) LoadResource( g_hInst, RH );
- if ( RP == NULL ) return FALSE;
- s = SizeofResource( g_hInst, RH );
- if ( !WriteFile( FH, RP, s, &x, NULL ) ) return FALSE;
- if ( x != s ) return FALSE;
- if ( Size ) *Size = s;
- return TRUE;
-}
-
-
-void ExtractFile( char *FileName, int ResType, int ResId )
-{
- HANDLE FH;
- FH = CreateFile( FileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
- if ( FH == INVALID_HANDLE_VALUE ) return;
- if (!ExtractFileFromResource( FH, ResType, ResId, NULL )) MessageBoxA(0,"Can't extract","!!!",MB_OK);
- CloseHandle( FH );
-}
-
-
-size_t rtrim(LPCSTR str) {
- size_t len = strlen(str);
- LPSTR ptr = (LPSTR)str+len-1;
-
- while( len ) {
- char c = *ptr;
- if ( c != '\x20' && c != '\x09' && c != '\x0A' && c != '\x0D' ) {
- *(ptr+1) = '\0';
- break;
- }
- len--; ptr--;
- }
- return len;
-}
-
-
-#if defined(_DEBUG) || defined(NETLIB_LOG)
-HANDLE hNetlibUser;
-
-void InitNetlib() {
- NETLIBUSER nl_user;
- memset(&nl_user,0,sizeof(nl_user));
- nl_user.cbSize = sizeof(nl_user);
- nl_user.szSettingsModule = (LPSTR)szModuleName;
- nl_user.szDescriptiveName = (LPSTR)szModuleName;
- nl_user.flags = NUF_NOOPTIONS;
-
- hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user);
-}
-
-void DeinitNetlib() {
- if (hNetlibUser)
- CallService(MS_NETLIB_CLOSEHANDLE, (WPARAM)hNetlibUser, 0);
-}
-
-int Sent_NetLog(const char *fmt,...)
-{
- va_list va;
- char szText[1024];
-
- va_start(va,fmt);
- mir_vsnprintf(szText,sizeof(szText),fmt,va);
- va_end(va);
- if (hNetlibUser)
- return CallService(MS_NETLIB_LOG,(WPARAM)hNetlibUser,(LPARAM)szText);
- return 0;
-}
-#endif
-
-
-// EOF
diff --git a/plugins/CryptoPP/src/commonheaders.h b/plugins/CryptoPP/src/commonheaders.h index eac473383e..d1829f7836 100644 --- a/plugins/CryptoPP/src/commonheaders.h +++ b/plugins/CryptoPP/src/commonheaders.h @@ -100,11 +100,6 @@ int Sent_NetLog(const char *,...); PBYTE cpp_alloc_pdata(pCNTX);
extern "C" {
-
- DLLEXPORT int Load();
- DLLEXPORT PLUGININFOEX *MirandaPluginInfoEx(DWORD);
- DLLEXPORT int Unload();
-
DLLEXPORT HANDLE __cdecl cpp_create_context(int); // create crypt-context
DLLEXPORT void __cdecl cpp_delete_context(HANDLE); // delete crypt-context
DLLEXPORT void __cdecl cpp_reset_context(HANDLE); // reset crypt-context (free all data)
diff --git a/plugins/CryptoPP/src/main.cpp b/plugins/CryptoPP/src/main.cpp index 1fdcd91cf5..af7aa6306f 100644 --- a/plugins/CryptoPP/src/main.cpp +++ b/plugins/CryptoPP/src/main.cpp @@ -1,39 +1,53 @@ #include "commonheaders.h"
int hLangpack;
+LPCSTR szModuleName = MODULENAME;
+LPCSTR szVersionStr = MODULENAME" DLL ("__VERSION_STRING")";
+HINSTANCE g_hInst;
+
+HANDLE hPGPPRIV = NULL;
+HANDLE hRSA4096 = NULL;
+
+CRITICAL_SECTION localQueueMutex;
+CRITICAL_SECTION localContextMutex;
+
+char TEMP[MAX_PATH];
+int TEMP_SIZE = 0;
+BOOL isVista = 0;
+
+PLUGININFOEX pluginInfoEx = {
+ sizeof(PLUGININFOEX),
+ __PLUGIN_NAME,
+ PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
+ __DESCRIPTION,
+ __AUTHOR,
+ __AUTHOREMAIL,
+ __COPYRIGHT,
+ __AUTHORWEB,
+ UNICODE_AWARE,
+ //3613F2D9-C040-4361-A44F-DF7B5AAACF6E
+ {0x3613F2D9, 0xC040, 0x4361, {0xA4, 0x4F, 0xDF, 0x7B, 0x5A, 0xAA, 0xCF, 0x6E}}
+};
-// dllmain
BOOL WINAPI DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID)
{
- if ( dwReason == DLL_PROCESS_ATTACH ) {
- g_hInst = hInst;
-
- char temp[MAX_PATH];
- GetTempPath(sizeof(temp),temp);
- GetLongPathName(temp,TEMP,sizeof(TEMP));
- TEMP_SIZE = strlen(TEMP);
- if (TEMP[TEMP_SIZE-1]=='\\') {
- TEMP_SIZE--;
- TEMP[TEMP_SIZE]='\0';
- }
- InitializeCriticalSection(&localQueueMutex);
- InitializeCriticalSection(&localContextMutex);
+ g_hInst = hInst;
+ InitializeCriticalSection(&localQueueMutex);
+ InitializeCriticalSection(&localContextMutex);
#ifdef _DEBUG
- isVista = 1;
+ isVista = 1;
#else
- isVista = ( (DWORD)(LOBYTE(LOWORD(GetVersion()))) == 6 );
+ isVista = ( (DWORD)(LOBYTE(LOWORD(GetVersion()))) == 6 );
#endif
- }
- //DLL_THREAD_ATTACH
return TRUE;
}
-PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
return &pluginInfoEx;
}
-int onModulesLoaded(WPARAM wParam,LPARAM lParam)
+int onModulesLoaded(WPARAM wParam, LPARAM lParam)
{
// updater plugin support
#if defined(_DEBUG) || defined(NETLIB_LOG)
@@ -42,7 +56,7 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) return 0;
}
-int Load()
+extern "C" __declspec(dllexport) int Load()
{
DisableThreadLibraryCalls(g_hInst);
@@ -61,10 +75,85 @@ int Load() }
-int Unload()
+extern "C" __declspec(dllexport) int Unload()
{
return 0;
}
+BOOL ExtractFileFromResource( HANDLE FH, int ResType, int ResId, DWORD* Size )
+{
+ HRSRC RH;
+ PBYTE RP;
+ DWORD s,x;
+
+ RH = FindResource( g_hInst, MAKEINTRESOURCE( ResId ), MAKEINTRESOURCE( ResType ) );
+
+ if ( RH == NULL ) return FALSE;
+ RP = (PBYTE) LoadResource( g_hInst, RH );
+ if ( RP == NULL ) return FALSE;
+ s = SizeofResource( g_hInst, RH );
+ if ( !WriteFile( FH, RP, s, &x, NULL ) ) return FALSE;
+ if ( x != s ) return FALSE;
+ if ( Size ) *Size = s;
+ return TRUE;
+}
+
+
+void ExtractFile( char *FileName, int ResType, int ResId )
+{
+ HANDLE FH;
+ FH = CreateFile( FileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
+ if ( FH == INVALID_HANDLE_VALUE ) return;
+ if (!ExtractFileFromResource( FH, ResType, ResId, NULL )) MessageBoxA(0,"Can't extract","!!!",MB_OK);
+ CloseHandle( FH );
+}
+
+
+size_t rtrim(LPCSTR str) {
+ size_t len = strlen(str);
+ LPSTR ptr = (LPSTR)str+len-1;
+
+ while( len ) {
+ char c = *ptr;
+ if ( c != '\x20' && c != '\x09' && c != '\x0A' && c != '\x0D' ) {
+ *(ptr+1) = '\0';
+ break;
+ }
+ len--; ptr--;
+ }
+ return len;
+}
+
+
+#if defined(_DEBUG) || defined(NETLIB_LOG)
+HANDLE hNetlibUser;
+
+void InitNetlib() {
+ NETLIBUSER nl_user;
+ memset(&nl_user,0,sizeof(nl_user));
+ nl_user.cbSize = sizeof(nl_user);
+ nl_user.szSettingsModule = (LPSTR)szModuleName;
+ nl_user.szDescriptiveName = (LPSTR)szModuleName;
+ nl_user.flags = NUF_NOOPTIONS;
+
+ hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user);
+}
+
+void DeinitNetlib() {
+ if (hNetlibUser)
+ CallService(MS_NETLIB_CLOSEHANDLE, (WPARAM)hNetlibUser, 0);
+}
+
+int Sent_NetLog(const char *fmt,...)
+{
+ va_list va;
+ char szText[1024];
-// EOF
+ va_start(va,fmt);
+ mir_vsnprintf(szText,sizeof(szText),fmt,va);
+ va_end(va);
+ if (hNetlibUser)
+ return CallService(MS_NETLIB_LOG,(WPARAM)hNetlibUser,(LPARAM)szText);
+ return 0;
+}
+#endif
diff --git a/plugins/CryptoPP/src/version.h b/plugins/CryptoPP/src/version.h index 27cbf73c16..59f24b02fd 100644 --- a/plugins/CryptoPP/src/version.h +++ b/plugins/CryptoPP/src/version.h @@ -1,16 +1,17 @@ -#ifndef __VERSION_H_INCLUDED
-#define __VERSION_H_INCLUDED
-
-#define __MAJOR_VERSION 1
-#define __MINOR_VERSION 0
-#define __RELEASE_NUM 4
-#define __BUILD_NUM 4
+#define __MAJOR_VERSION 1
+#define __MINOR_VERSION 0
+#define __RELEASE_NUM 4
+#define __BUILD_NUM 4
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
-#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
-#define __STRINGIFY(x) #x
-#define __TOSTRING(x) __STRINGIFY(x)
-#define __VERSION_STRING __TOSTRING(__FILEVERSION_STRING_DOTS)
+#define __TOSTRING(x) #x
+#define __VERSION_STRING __TOSTRING(__FILEVERSION_STRING)
#define __VERSION_DWORD ((__MAJOR_VERSION<<24) | (__MINOR_VERSION<<16) | (__RELEASE_NUM<<8) | __BUILD_NUM)
-#endif //__VERSION_H_INCLUDED
+#define __PLUGIN_NAME "Crypto++"
+#define __FILENAME "CryptoPP.dll"
+#define __DESCRIPTION "Crypto++ library for SecureIM plugin."
+#define __AUTHOR "Baloo"
+#define __AUTHOREMAIL "baloo@bk.ru"
+#define __AUTHORWEB "http://miranda-ng.org/"
+#define __COPYRIGHT "© 2006-09 Baloo"
|