From f7e482e4333df76b198b16c7685c2304007fbe79 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 16 Jul 2012 18:28:49 +0000 Subject: dynamic dll checker git-svn-id: http://svn.miranda-ng.org/main/trunk@989 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SecureIM/commonheaders.cpp | 61 -------------------------------------- plugins/SecureIM/commonheaders.h | 12 -------- plugins/SecureIM/main.cpp | 21 +++++-------- 3 files changed, 7 insertions(+), 87 deletions(-) (limited to 'plugins/SecureIM') diff --git a/plugins/SecureIM/commonheaders.cpp b/plugins/SecureIM/commonheaders.cpp index d9d681dc10..3f51f10ab7 100644 --- a/plugins/SecureIM/commonheaders.cpp +++ b/plugins/SecureIM/commonheaders.cpp @@ -1,7 +1,6 @@ #include "commonheaders.h" HINSTANCE g_hInst, g_hIconInst; -MUUID interfaces[] = {MIID_SECUREIM, MIID_LAST}; LPCSTR szModuleName = MODULENAME; LPCSTR szVersionStr = MODULENAME" DLL ("__VERSION_STRING")"; @@ -39,7 +38,6 @@ PLUGININFOEX pluginInfoEx = { MIID_SECUREIM }; - LPSTR myDBGetString(HANDLE hContact,const char *szModule,const char *szSetting) { char *val=NULL; DBVARIANT dbv; @@ -72,32 +70,6 @@ int myDBWriteStringEncode(HANDLE hContact,const char *szModule,const char *szSet return ret; } -/* -int DBWriteString(HANDLE hContact,const char *szModule,const char *szSetting,const char *val) { - return DBWriteContactSettingString(hContact,szModule,szSetting,val); -} - - -int DBGetByte(HANDLE hContact,const char *szModule,const char *szSetting,int errorValue) { - return DBGetContactSettingByte(hContact,szModule,szSetting,errorValue); -} - - -int DBWriteByte(HANDLE hContact,const char *szModule,const char *szSetting,BYTE val) { - return DBWriteContactSettingByte(hContact,szModule,szSetting,val); -} - - -int DBGetWord(HANDLE hContact,const char *szModule,const char *szSetting,int errorValue) { - return DBGetContactSettingWord(hContact,szModule,szSetting,errorValue); -} - - -int DBWriteWord(HANDLE hContact,const char *szModule,const char *szSetting,WORD val) { - return DBWriteContactSettingWord(hContact,szModule,szSetting,val); -} -*/ - void GetFlags() { bSFT = DBGetContactSettingByte(0,szModuleName,"sft",0); bSOM = DBGetContactSettingByte(0,szModuleName,"som",0); @@ -127,39 +99,6 @@ void SetFlags() { DBWriteContactSettingByte(0,szModuleName,"mcm",bMCM); } - -/*-----------------------------------------------------*/ -/* -LPSTR u2a( LPCWSTR src ) -{ - int codepage = ServiceExists(MS_LANGPACK_GETCODEPAGE)?CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 ):CP_ACP; - - int cbLen = WideCharToMultiByte( codepage, 0, src, -1, NULL, 0, NULL, NULL ); - LPSTR result = (LPSTR) mir_alloc( cbLen+1 ); - if ( result == NULL ) - return NULL; - - WideCharToMultiByte( codepage, 0, src, -1, result, cbLen, NULL, NULL ); - result[ cbLen ] = 0; - return result; -} - -LPWSTR a2u( LPCSTR src ) -{ - int codepage = ServiceExists(MS_LANGPACK_GETCODEPAGE)?CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 ):CP_ACP; - - int cbLen = MultiByteToWideChar( codepage, 0, src, -1, NULL, 0 ); - - LPWSTR result = (LPWSTR) mir_alloc( sizeof(WCHAR)*(cbLen+1)); - if ( result == NULL ) - return NULL; - - MultiByteToWideChar( codepage, 0, src, -1, result, cbLen ); - result[ cbLen ] = 0; - - return result; -} -*/ struct A2U { LPSTR a; LPSTR u; diff --git a/plugins/SecureIM/commonheaders.h b/plugins/SecureIM/commonheaders.h index a9f3e62508..cc12efdaa0 100644 --- a/plugins/SecureIM/commonheaders.h +++ b/plugins/SecureIM/commonheaders.h @@ -131,24 +131,12 @@ extern int TEMP_SIZE; // shared vars extern HINSTANCE g_hInst, g_hIconInst; extern PLUGININFOEX pluginInfoEx; -extern MUUID interfaces[]; #define MIID_SECUREIM {0x1B2A39E5, 0xE2F6, 0x494D, { 0x95, 0x8D, 0x18, 0x08, 0xFD, 0x11, 0x0D, 0xD5 }} //1B2A39E5-E2F6-494D-958D-1808FD110DD5 #define PREF_METANODB 0x2000 //!< Flag to indicate message should not be added to db by filter when sending #define PREF_SIMNOMETA 0x4000 //!< Flag to indicate message should not be inspected by filter on metacontact -#define DLLEXPORT __declspec(dllexport) - -extern "C" { - - DLLEXPORT int Load(void); - DLLEXPORT PLUGININFOEX *MirandaPluginInfoEx(DWORD); - DLLEXPORT MUUID* MirandaPluginInterfaces(void); - DLLEXPORT int Unload(); - -} - extern HANDLE g_hEvent[2], g_hMenu[15], g_hCLIcon, g_hFolders; extern HANDLE *g_hService; extern HANDLE *g_hHook; diff --git a/plugins/SecureIM/main.cpp b/plugins/SecureIM/main.cpp index 425a2ec08a..205a025ffe 100644 --- a/plugins/SecureIM/main.cpp +++ b/plugins/SecureIM/main.cpp @@ -1,9 +1,8 @@ #include "commonheaders.h" - int hLangpack = 0; -extern "C" BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID) { +BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID) { g_hInst = hInst; if (dwReason == DLL_PROCESS_ATTACH) { INITCOMMONCONTROLSEX icce = { @@ -14,17 +13,13 @@ extern "C" BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID) { return TRUE; } +extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_SECUREIM, MIID_LAST}; -PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) { +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ return &pluginInfoEx; } - -MUUID* MirandaPluginInterfaces(void) { - return interfaces; -} - - void AddServiceFunction(LPCSTR serviceName, MIRANDASERVICE serviceFunction) { g_hService = (HANDLE*) mir_realloc(g_hService,sizeof(HANDLE)*(iService+1)); @@ -79,9 +74,8 @@ HANDLE AddSubItem(HANDLE rootid,LPCSTR name,int pos,int poppos,LPCSTR service,WP } -int __cdecl Load(void) { - - +extern "C" __declspec(dllexport) int __cdecl Load(void) +{ DisableThreadLibraryCalls(g_hInst); InitializeCriticalSection(&localQueueMutex); @@ -168,8 +162,7 @@ int __cdecl Load(void) { return 0; } - -int __cdecl Unload() { +extern "C" __declspec(dllexport) int __cdecl Unload() { DeleteCriticalSection(&localQueueMutex); return 0; } -- cgit v1.2.3