From 88ec2ae53ddc811d08763b2fb3a0073b571a321c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 4 Jul 2012 12:37:38 +0000 Subject: these fixes aren't needed anymore git-svn-id: http://svn.miranda-ng.org/main/trunk@755 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Db3x/dbsettings.cpp | 10 +------- plugins/Db3x_mmap/dbsettings.cpp | 8 ------- plugins/Dbx_mmap_SA/dbsettings.cpp | 48 ++++++++++++++++---------------------- plugins/Dbx_tree/Compatibility.cpp | 20 ++++------------ 4 files changed, 25 insertions(+), 61 deletions(-) diff --git a/plugins/Db3x/dbsettings.cpp b/plugins/Db3x/dbsettings.cpp index c8eb18c208..209b7a13ab 100644 --- a/plugins/Db3x/dbsettings.cpp +++ b/plugins/Db3x/dbsettings.cpp @@ -941,13 +941,6 @@ static int stringCompare2( DBCachedGlobalValue* p1, DBCachedGlobalValue* p2 ) return strcmp( p1->name, p2->name ); } -static int OnPreShutdown(WPARAM, LPARAM) -{ - DestroyHookableEvent(hSettingChangeEvent); - hSettingChangeEvent = 0; - return 0; -} - int InitSettings(void) { CreateServiceFunction(MS_DB_CONTACT_GETSETTING,GetContactSetting); @@ -958,9 +951,8 @@ int InitSettings(void) CreateServiceFunction(MS_DB_CONTACT_DELETESETTING,DeleteContactSetting); CreateServiceFunction(MS_DB_CONTACT_ENUMSETTINGS,EnumContactSettings); CreateServiceFunction(MS_DB_SETSETTINGRESIDENT,SetSettingResident); - + hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED); - HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); mirCp = CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 ); diff --git a/plugins/Db3x_mmap/dbsettings.cpp b/plugins/Db3x_mmap/dbsettings.cpp index c569357567..5bdc0707f6 100644 --- a/plugins/Db3x_mmap/dbsettings.cpp +++ b/plugins/Db3x_mmap/dbsettings.cpp @@ -975,13 +975,6 @@ static int stringCompare2( char* p1, char* p2 ) return strcmp( p1, p2); } -static int OnPreShutdown(WPARAM, LPARAM) -{ - DestroyHookableEvent(hSettingChangeEvent); - hSettingChangeEvent = 0; - return 0; -} - int InitSettings(void) { CreateServiceFunction(MS_DB_CONTACT_GETSETTING,GetContactSetting); @@ -995,7 +988,6 @@ int InitSettings(void) CreateServiceFunction("DB/ResidentSettings/Enum",EnumResidentSettings); hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED); - HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); hCacheHeap = HeapCreate(0, 0, 0); lSettings.sortFunc = (FSortFunc)stringCompare; diff --git a/plugins/Dbx_mmap_SA/dbsettings.cpp b/plugins/Dbx_mmap_SA/dbsettings.cpp index fd839ab258..469abc97fd 100644 --- a/plugins/Dbx_mmap_SA/dbsettings.cpp +++ b/plugins/Dbx_mmap_SA/dbsettings.cpp @@ -991,7 +991,7 @@ void EncodeContactSettings(HANDLE hContact) if(contact -> ofsFirstSettings){ setting = (struct DBContactSettings *)DBRead(contact -> ofsFirstSettings, sizeof(struct DBContactSettings), NULL); offset = contact -> ofsFirstSettings; - do{ + do{ DWORD ofsBlobPtr; PBYTE pBlob; int bytesRemaining; @@ -1009,21 +1009,21 @@ void EncodeContactSettings(HANDLE hContact) NeedBytes(1+pBlob[0]); //CopyMemory(szSetting,pBlob+1,pBlob[0]); szSetting[pBlob[0]]=0; MoveAlong(1+pBlob[0]); - + NeedBytes(5); - + switch(pBlob[0]) { case DBVT_DELETED: break; case DBVT_BYTE: break; - case DBVT_WORD: - { + case DBVT_WORD: + { CryptoEngine->EncryptMem(pBlob+1, 2, key); break; } - case DBVT_DWORD: - { + case DBVT_DWORD: + { CryptoEngine->EncryptMem(pBlob+1, 4, key); - break; + break; } case DBVT_UTF8: case DBVT_ASCIIZ: @@ -1035,7 +1035,7 @@ void EncodeContactSettings(HANDLE hContact) CryptoEngine->EncryptMem(pBlob+3, len, key); break; } - } + } NeedBytes(3); MoveAlong(1+GetSettingValueLength(pBlob)); NeedBytes(1); @@ -1050,21 +1050,21 @@ void EncodeContactSettings(HANDLE hContact) }while(1); } - + } void DecodeContactSettings(HANDLE hContact) { struct DBContact * contact; struct DBContactSettings * setting; DWORD offset; - + if (!hContact) hContact = (HANDLE)dbHeader.ofsUser; contact = (struct DBContact *)DBRead((DWORD)hContact, sizeof(struct DBContact), NULL); if(contact -> ofsFirstSettings){ setting = (struct DBContactSettings *)DBRead(contact -> ofsFirstSettings, sizeof(struct DBContactSettings), NULL); offset = contact -> ofsFirstSettings; - do{ + do{ DWORD ofsBlobPtr; PBYTE pBlob; int bytesRemaining; @@ -1076,21 +1076,21 @@ void DecodeContactSettings(HANDLE hContact) NeedBytes(1+pBlob[0]); //CopyMemory(szSetting,pBlob+1,pBlob[0]); szSetting[pBlob[0]]=0; MoveAlong(1+pBlob[0]); - + NeedBytes(5); - + switch(pBlob[0]) { case DBVT_DELETED: break; case DBVT_BYTE: break; - case DBVT_WORD: - { + case DBVT_WORD: + { CryptoEngine->DecryptMem(pBlob+1, 2, key); break; } - case DBVT_DWORD: - { + case DBVT_DWORD: + { CryptoEngine->DecryptMem(pBlob+1, 4, key); - break; + break; } case DBVT_UTF8: case DBVT_ASCIIZ: @@ -1102,7 +1102,7 @@ void DecodeContactSettings(HANDLE hContact) CryptoEngine->DecryptMem(pBlob+3, len, key); break; } - } + } NeedBytes(3); MoveAlong(1+GetSettingValueLength(pBlob)); NeedBytes(1); @@ -1132,13 +1132,6 @@ static int stringCompare2( char* p1, char* p2 ) return strcmp( p1, p2); } -static int OnPreShutdown(WPARAM, LPARAM) -{ - DestroyHookableEvent(hSettingChangeEvent); - hSettingChangeEvent = 0; - return 0; -} - int InitSettings(void) { CreateServiceFunction(MS_DB_CONTACT_GETSETTING, GetContactSetting); @@ -1152,7 +1145,6 @@ int InitSettings(void) CreateServiceFunction("DB/ResidentSettings/Enum", EnumResidentSettings); hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED); - HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); hCacheHeap = HeapCreate(0, 0, 0); lSettings.sortFunc = (FSortFunc)stringCompare; diff --git a/plugins/Dbx_tree/Compatibility.cpp b/plugins/Dbx_tree/Compatibility.cpp index e0c34c8feb..38b8f92383 100644 --- a/plugins/Dbx_tree/Compatibility.cpp +++ b/plugins/Dbx_tree/Compatibility.cpp @@ -807,21 +807,8 @@ INT_PTR CompGetProfilePath(WPARAM cbBytes, LPARAM pszName) return gDataBase->getProfilePath(cbBytes, reinterpret_cast(pszName)); } -int OnPreShutdown(WPARAM, LPARAM) -{ - DestroyHookableEvent(hEventDeletedEvent); - DestroyHookableEvent(hEventAddedEvent); - DestroyHookableEvent(hEventFilterAddedEvent); - DestroyHookableEvent(hSettingChangeEvent); - DestroyHookableEvent(hContactDeletedEvent); - DestroyHookableEvent(hContactAddedEvent); - return 0; -} - bool CompatibilityRegister() { - HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); - gCompServices[ 0] = CreateServiceFunction(MS_DB_CONTACT_GETCOUNT, CompGetContactCount); gCompServices[ 1] = CreateServiceFunction(MS_DB_CONTACT_FINDFIRST, CompFindFirstContact); gCompServices[ 2] = CreateServiceFunction(MS_DB_CONTACT_FINDNEXT, CompFindNextContact); @@ -868,11 +855,12 @@ bool CompatibilityRegister() hContactAddedEvent = CreateHookableEvent(ME_DB_CONTACT_ADDED); return true; } - bool CompatibilityUnRegister() { - for (int i = 0; i < SIZEOF(gCompServices); ++i) + int i; + for (i = 0; i < sizeof(gCompServices) / sizeof(gCompServices[0]); ++i) + { DestroyServiceFunction(gCompServices[i]); - + } return true; } -- cgit v1.2.3