From 81e8caf42867b65677efe2bffaa52ecff7303c3a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 27 Jun 2012 13:58:25 +0000 Subject: no more pluginLink in load() git-svn-id: http://svn.miranda-ng.org/main/trunk@652 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dbx_mmap_SA/Dbtool/encryption.cpp | 31 +++++++++++++++---------------- plugins/Dbx_mmap_SA/Import_SA/main.cpp | 6 +++--- plugins/Dbx_mmap_SA/commonheaders.h | 2 -- plugins/Dbx_mmap_SA/dialogs.cpp | 3 --- plugins/Dbx_mmap_SA/init.cpp | 19 ++++++------------- 5 files changed, 24 insertions(+), 37 deletions(-) (limited to 'plugins/Dbx_mmap_SA') diff --git a/plugins/Dbx_mmap_SA/Dbtool/encryption.cpp b/plugins/Dbx_mmap_SA/Dbtool/encryption.cpp index 4f5c0a18b6..1e7b264efa 100644 --- a/plugins/Dbx_mmap_SA/Dbtool/encryption.cpp +++ b/plugins/Dbx_mmap_SA/Dbtool/encryption.cpp @@ -48,12 +48,12 @@ void zero_fill(BYTE * pBuf, size_t bufSize) void InitSecurity() { - HMODULE hLib; + HMODULE hLib; WIN32_FIND_DATAA fd; - Cryptor* (__stdcall *GetCryptor)(); + Cryptor* (__stdcall *GetCryptor)(); - { + { TCHAR szMirandaDir[MAX_PATH]; szMirandaDir[ 0 ] = 0; TCHAR *str2; @@ -63,30 +63,30 @@ void InitSecurity() *str2=0; _tchdir(szMirandaDir); } - - HANDLE hFile = FindFirstFileA(".\\plugins\\cryptors\\*.dll", &fd); + + HANDLE hFile = FindFirstFileA(".\\plugins\\cryptors\\*.dll", &fd); AddToStatus(STATUS_MESSAGE,TranslateT("Scanning cryptors directory")); - + ModulesCount = 0; while (hFile != INVALID_HANDLE_VALUE) - { + { char tmp[MAX_PATH], buf[255]; strcpy(tmp, ".\\plugins\\cryptors\\"); strcat(tmp, fd.cFileName); - + hLib = LoadLibraryA(tmp); if(hLib){ GetCryptor = (Cryptor* (__stdcall *)()) GetProcAddress(hLib, "GetCryptor"); if(GetCryptor){ TCHAR Name[100], Version[100], DllName[100]; - + Modules[ModulesCount] = (CryptoModule*) malloc(sizeof(CryptoModule)); Modules[ModulesCount]->cryptor = GetCryptor(); strcpy(Modules[ModulesCount]->dllname, fd.cFileName); Modules[ModulesCount]->hLib = hLib; - + _snprintf(buf,SIZEOF(buf),"%d.%d.%d.%d", HIBYTE(HIWORD(Modules[ModulesCount]->cryptor->Version)), LOBYTE(HIWORD(Modules[ModulesCount]->cryptor->Version)), HIBYTE(LOWORD(Modules[ModulesCount]->cryptor->Version)), LOBYTE(LOWORD(Modules[ModulesCount]->cryptor->Version))); mbstowcs(Name, Modules[ModulesCount]->cryptor->Name, 100); @@ -94,7 +94,7 @@ void InitSecurity() mbstowcs(DllName, Modules[ModulesCount]->dllname, 100); AddToStatus(STATUS_MESSAGE,TranslateT("Cryptor loaded: %s [%s] (%s)"), Name, Version, DllName); - + ModulesCount++; }else{ FreeLibrary(hLib); @@ -112,7 +112,7 @@ void UnloadSecurity() int i; if(CryptoEngine) CryptoEngine->FreeKey(key); - + for(i = 0; i < ModulesCount; i++) { FreeLibrary(Modules[i]->hLib); @@ -229,11 +229,10 @@ BOOL CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg,WPARAM wParam,LPARAM lParam) case WM_INITDIALOG: { HWND hwndCtrl; -// if(pluginLink && ServiceExists(MS_LANGPACK_TRANSLATEDIALOG)) TranslateDialogDefault(hDlg); if(lParam && !wrongPass) SetDlgItemTextA(hDlg, IDC_DBNAME, (LPCSTR)lParam); - if(wrongPass) + if(wrongPass) { if (wrongPass > 2) { @@ -241,7 +240,7 @@ BOOL CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg,WPARAM wParam,LPARAM lParam) EnableWindow(hwndCtrl, FALSE); hwndCtrl = GetDlgItem(hDlg, IDOK); EnableWindow(hwndCtrl, FALSE); - + SetDlgItemText(hDlg, IDC_LOGININFO, TranslateT("Too many errors!")); } @@ -278,7 +277,7 @@ BOOL CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg,WPARAM wParam,LPARAM lParam) encryptKeyLength = GetDlgItemTextA(hDlg, IDC_USERPASS, encryptKey, 254); EndDialog(hDlg,IDOK); }else{ - + } }else if(uid == IDCANCEL){ EndDialog(hDlg,IDCANCEL); diff --git a/plugins/Dbx_mmap_SA/Import_SA/main.cpp b/plugins/Dbx_mmap_SA/Import_SA/main.cpp index ed83861e0f..c86d29f6c6 100644 --- a/plugins/Dbx_mmap_SA/Import_SA/main.cpp +++ b/plugins/Dbx_mmap_SA/Import_SA/main.cpp @@ -44,7 +44,7 @@ static HANDLE hImportService = NULL; INT_PTR CALLBACK WizardDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam); HINSTANCE hInst; -PLUGINLINK *pluginLink; + static HWND hwndWizard = NULL; PLUGININFOEX pluginInfo = { @@ -126,9 +126,9 @@ static int OnExit(WPARAM wParam, LPARAM lParam) return 0; } -extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) +extern "C" __declspec(dllexport) int Load(void) { - pluginLink = link; + mir_getLP( &pluginInfo ); hImportService = CreateServiceFunction(IMPORT_SERVICE, ImportCommand); diff --git a/plugins/Dbx_mmap_SA/commonheaders.h b/plugins/Dbx_mmap_SA/commonheaders.h index 8596e60821..2fb92e5399 100644 --- a/plugins/Dbx_mmap_SA/commonheaders.h +++ b/plugins/Dbx_mmap_SA/commonheaders.h @@ -60,8 +60,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "resource.h" #include "version.h" -extern PLUGINLINK *pluginLink; - extern CRITICAL_SECTION csDbAccess; extern struct DBHeader dbHeader; extern HANDLE hDbFile; diff --git a/plugins/Dbx_mmap_SA/dialogs.cpp b/plugins/Dbx_mmap_SA/dialogs.cpp index d8878a2dd1..c5503773ce 100644 --- a/plugins/Dbx_mmap_SA/dialogs.cpp +++ b/plugins/Dbx_mmap_SA/dialogs.cpp @@ -363,7 +363,6 @@ BOOL CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg,WPARAM wParam,LPARAM lParam) case WM_INITDIALOG: { HWND hwndCtrl; -// if(pluginLink && ServiceExists(MS_LANGPACK_TRANSLATEDIALOG)) TranslateDialogDefault(hDlg); hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_ICON2)); @@ -448,7 +447,6 @@ BOOL CALLBACK DlgStdNewPass(HWND hDlg, UINT uMsg,WPARAM wParam,LPARAM lParam) { case WM_INITDIALOG: { - //if(pluginLink && ServiceExists(MS_LANGPACK_TRANSLATEDIALOG)) TranslateDialogDefault(hDlg); hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_ICON2)); @@ -534,7 +532,6 @@ BOOL CALLBACK DlgChangePass(HWND hDlg, UINT uMsg,WPARAM wParam,LPARAM lParam) { case WM_INITDIALOG: { - //if(pluginLink && ServiceExists(MS_LANGPACK_TRANSLATEDIALOG)) TranslateDialogDefault(hDlg); hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_ICON2)); diff --git a/plugins/Dbx_mmap_SA/init.cpp b/plugins/Dbx_mmap_SA/init.cpp index 0f2cc52ca4..2517b3efab 100644 --- a/plugins/Dbx_mmap_SA/init.cpp +++ b/plugins/Dbx_mmap_SA/init.cpp @@ -28,7 +28,7 @@ int hLangpack; extern char szDbPath[MAX_PATH]; HINSTANCE g_hInst = NULL; -PLUGINLINK *pluginLink; + PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -116,18 +116,11 @@ static int grokHeader( char * profile, int * error ) } // returns 0 if all the APIs are injected otherwise, 1 -static int LoadDatabase( char * profile, void * plink ) +static int LoadDatabase(char *profile) { - PLUGINLINK *link = (PLUGINLINK *)plink; -#ifdef _DEBUG - _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); -#endif // don't need thread notifications strncpy(szDbPath, profile, sizeof(szDbPath)); - // this is like Load()'s pluginLink - pluginLink=link; - // set the memory, lists & UTF8 manager mir_getLP( &pluginInfo ); @@ -141,14 +134,14 @@ static int LoadDatabase( char * profile, void * plink ) { // We are running under damn violators void (*f)(); - + MessageBox(0, TranslateT("Running mmap_sa is forbidden under license violating products, sorry"), TranslateT("Warning!"), MB_OK); - + f = NULL; f(); } /* end of protected code */ - } + } // inject all APIs and hooks into the core return LoadDatabaseModule(); @@ -199,7 +192,7 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) return interfaces; } -extern "C" __declspec(dllexport) int Load(PLUGINLINK * link) +extern "C" __declspec(dllexport) int Load(void) { return 1; } -- cgit v1.2.3