From 190968e9803a32bd4e609176989564735098146c Mon Sep 17 00:00:00 2001
From: George Hazan <george.hazan@gmail.com>
Date: Thu, 28 Jun 2012 21:28:50 +0000
Subject: database stubs moved to mir_core

git-svn-id: http://svn.miranda-ng.org/main/trunk@676 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 plugins/Clist_modern/hdr/modern_commonheaders.h    |  60 ---
 plugins/Clist_modern/hdr/modern_commonprototypes.h |   1 -
 plugins/Clist_modern/modern_aniavatars.cpp         |  22 +-
 plugins/Clist_modern/modern_awaymsg.cpp            |   2 +-
 plugins/Clist_modern/modern_cachefuncs.cpp         |  54 +--
 plugins/Clist_modern/modern_clc.cpp                |  50 +--
 plugins/Clist_modern/modern_clcidents.cpp          |   2 +-
 plugins/Clist_modern/modern_clcitems.cpp           |  26 +-
 plugins/Clist_modern/modern_clcmsgs.cpp            |   2 +-
 plugins/Clist_modern/modern_clcopts.cpp            | 480 ++++++++++-----------
 plugins/Clist_modern/modern_clcutils.cpp           | 190 ++++----
 plugins/Clist_modern/modern_clistevents.cpp        |  18 +-
 plugins/Clist_modern/modern_clistmenus.cpp         |  10 +-
 plugins/Clist_modern/modern_clistmod.cpp           |  32 +-
 plugins/Clist_modern/modern_clistopts.cpp          | 268 ++++++------
 plugins/Clist_modern/modern_clistsettings.cpp      |  38 +-
 plugins/Clist_modern/modern_clisttray.cpp          |  34 +-
 plugins/Clist_modern/modern_clui.cpp               | 216 +++++-----
 plugins/Clist_modern/modern_cluiframes.cpp         | 130 +++---
 plugins/Clist_modern/modern_cluiservices.cpp       |  12 +-
 plugins/Clist_modern/modern_commonheaders.cpp      | 107 -----
 plugins/Clist_modern/modern_contact.cpp            |  14 +-
 plugins/Clist_modern/modern_docking.cpp            |  16 +-
 plugins/Clist_modern/modern_extraimage.cpp         |  48 +--
 plugins/Clist_modern/modern_groupmenu.cpp          |   6 +-
 plugins/Clist_modern/modern_keyboard.cpp           |   2 +-
 plugins/Clist_modern/modern_row.cpp                |   8 +-
 plugins/Clist_modern/modern_rowheight_funcs.cpp    |   4 +-
 plugins/Clist_modern/modern_rowtemplateopt.cpp     |   2 +-
 plugins/Clist_modern/modern_skinbutton.cpp         |  24 +-
 plugins/Clist_modern/modern_skineditor.cpp         |   8 +-
 plugins/Clist_modern/modern_skinengine.cpp         |  86 ++--
 plugins/Clist_modern/modern_skinopt.cpp            |  24 +-
 plugins/Clist_modern/modern_statusbar.cpp          |  88 ++--
 plugins/Clist_modern/modern_statusbar_options.cpp  | 112 ++---
 plugins/Clist_modern/modern_toolbar.cpp            |  96 ++---
 plugins/Clist_modern/modern_viewmodebar.cpp        | 100 ++---
 plugins/CommonLibs/CString.cpp                     |   4 +-
 plugins/Mir_core/db.cpp                            | 191 ++++++++
 plugins/Mir_core/mir_core.def                      |  16 +
 plugins/Mir_core/mir_core_10.vcxproj               |   4 +
 plugins/Mir_core/mir_core_10.vcxproj.filters       |   6 +
 42 files changed, 1331 insertions(+), 1282 deletions(-)
 create mode 100644 plugins/Mir_core/db.cpp

(limited to 'plugins')

diff --git a/plugins/Clist_modern/hdr/modern_commonheaders.h b/plugins/Clist_modern/hdr/modern_commonheaders.h
index 65f3b20fae..cb1685337a 100644
--- a/plugins/Clist_modern/hdr/modern_commonheaders.h
+++ b/plugins/Clist_modern/hdr/modern_commonheaders.h
@@ -358,7 +358,6 @@ void pdnce___SetStatus( pdisplayNameCacheEntry pdnce, WORD wStatus );
 /* move to list module */
 typedef void (*ItemDestuctor)(void*);
 
-
 void li_ListDestruct(SortedList *pList, ItemDestuctor pItemDestructor);
 void li_RemoveDestruct(SortedList *pList, int index, ItemDestuctor pItemDestructor);
 void li_RemovePtrDestruct(SortedList *pList, void * ptr, ItemDestuctor pItemDestructor);
@@ -366,19 +365,6 @@ void li_SortList(SortedList *pList, FSortFunc pSortFunct);
 
 #define mir_safe_free(a) if(a) mir_free(a)
 
-#ifdef _UNICODE
-#define mir_t2a(s) mir_u2a(s)
-#define mir_a2t(s) mir_a2u(s)
-#define mir_t2u(s) mir_wstrdup(s)
-#define mir_u2t(s) mir_wstrdup(s)
-#else
-#define mir_t2a(s) mir_strdup(s)
-#define mir_a2t(s) mir_strdup(s)
-#define mir_t2u(s) mir_a2u(s)
-#define mir_u2t(s) mir_u2a(s)
-#endif
-
-
 template <class T> class INIT : public T
 {
 public:
@@ -480,52 +466,6 @@ public:
 	};
 };
 
-#ifdef _UNICODE
-#define ModernGetStringT ModernGetStringW
-#else
-#define ModernGetStringT ModernGetStringA
-#endif
-
-char *	   ModernGetStringA			( HANDLE hContact, const char *szModule, const char *szSetting );
-wchar_t *  ModernGetStringW			( HANDLE hContact, const char *szModule, const char *szSetting );
-
-WORD	ModernGetSettingRangedWord  ( HANDLE hContact, const char *szModule, const char *szSetting, WORD errorValue, WORD minValue, WORD maxValue);
-
-
-#define ModernGetSetting(a,b,c,d)             ModernGetSetting_Helper(a,b,c,d,__FILE__,__LINE__)
-#define ModernGetSettingByte(a,b,c,d)         ModernGetSettingByte_Helper(a,b,c,d,__FILE__,__LINE__)
-#define ModernGetSettingWord(a,b,c,d)         ModernGetSettingWord_Helper(a,b,c,d,__FILE__,__LINE__)
-#define ModernGetSettingDword(a,b,c,d)        ModernGetSettingDword_Helper(a,b,c,d,__FILE__,__LINE__)
-#define ModernGetSettingString(a,b,c,d)       ModernGetSettingString_Helper(a,b,c,d,__FILE__,__LINE__,DBVT_ASCIIZ)
-#define ModernGetSettingWString(a,b,c,d)      ModernGetSettingString_Helper(a,b,c,d,__FILE__,__LINE__,DBVT_WCHAR)
-#define ModernGetSettingUTF8String(a,b,c,d)   ModernGetSettingString_Helper(a,b,c,d,__FILE__,__LINE__,DBVT_UTF8)
-
-int  __cdecl ModernGetSettingByte_Helper   ( HANDLE hContact, const char *szModule, const char *szSetting, int errorValue, const char *szFile, const int nLine);
-int  __cdecl ModernGetSettingWord_Helper   ( HANDLE hContact, const char *szModule, const char *szSetting, int errorValue, const char *szFile, const int nLine);
-int  __cdecl ModernGetSettingDword_Helper  ( HANDLE hContact, const char *szModule, const char *szSetting, int errorValue, const char *szFile, const int nLine);
-int  __cdecl ModernGetSettingString_Helper ( HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const char *szFile, const int nLine, const int nType);
-int  __cdecl ModernGetSetting_Helper       ( HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const char *szFile, const int nLine);
-
-int __cdecl ModernWriteSettingByte       ( HANDLE hContact, const char *szModule, const char *szSetting, BYTE  val  );
-int __cdecl ModernWriteSettingWord       ( HANDLE hContact, const char *szModule, const char *szSetting, WORD  val  );
-int __cdecl ModernWriteSettingDword      ( HANDLE hContact, const char *szModule, const char *szSetting, DWORD val  );
-int __cdecl ModernWriteSettingString     ( HANDLE hContact, const char *szModule, const char *szSetting, const char *val  );
-
-
-int __cdecl ModernDeleteSetting     ( HANDLE hContact, const char *szModule, const char *szSetting);
-int __cdecl ModernDBFreeVariant     ( DBVARIANT *dbv );
-
-
-#ifdef _UNICODE
-	int __cdecl ModernWriteSettingWString    ( HANDLE hContact, const char *szModule, const char *szSetting, const WCHAR *val );
-	#define ModernWriteSettingTString(a,b,c,d) ModernWriteSettingWString( a,b,c,d )
-    #define ModernGetSettingTString(a,b,c,d)   ModernGetSettingWString(a,b,c,d)
-#else
-    #define ModernWriteSettingTString(a,b,c,d) ModernWriteSettingString( a,b,c,d )
-    #define ModernGetSettingTString(a,b,c,d)   ModernGetSettingString(a,b,c,d)
-#endif //_UNICODE
-
-
 #define EXTRACOLUMNCOUNT 10
 
 
diff --git a/plugins/Clist_modern/hdr/modern_commonprototypes.h b/plugins/Clist_modern/hdr/modern_commonprototypes.h
index d1209100e0..91ca540fd9 100644
--- a/plugins/Clist_modern/hdr/modern_commonprototypes.h
+++ b/plugins/Clist_modern/hdr/modern_commonprototypes.h
@@ -212,7 +212,6 @@ INT_PTR	CALLBACK DlgSkinEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
 INT_PTR	CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);	//RowTemplate.c
 BOOL	FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles * dat);	//GenMenu.c
 BOOL	MatchMask(char * name, char * mask);												//mod_skin_selector.c
-char*   DBGetStringA(HANDLE hContact,const char *szModule,const char *szSetting);			//commonheaders.c
 char*   GetContactCachedProtocol(HANDLE hContact);											//clistsettings.c
 char*   GetParamN(char * string, char * buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces);  //mod_skin_selector.c
 DWORD	CompareContacts2_getLMTime(HANDLE u);												//contact.c
diff --git a/plugins/Clist_modern/modern_aniavatars.cpp b/plugins/Clist_modern/modern_aniavatars.cpp
index 9c6dbdcb35..4e801d945b 100644
--- a/plugins/Clist_modern/modern_aniavatars.cpp
+++ b/plugins/Clist_modern/modern_aniavatars.cpp
@@ -194,8 +194,8 @@ int AniAva_InitModule()
 {
 	memset(&AniAva,0,sizeof(AniAva));
 	if (g_CluiData.fGDIPlusFail) return 0;
-	if (!( ModernGetSettingByte(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP)&&!g_CluiData.fGDIPlusFail))
-		&& ModernGetSettingByte(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT)) ) return 0;
+	if (!( db_get_b(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP)&&!g_CluiData.fGDIPlusFail))
+		&& db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT)) ) return 0;
 	{
 		WNDCLASSEX wc;
 		ZeroMemory(&wc, sizeof(wc));
@@ -263,8 +263,8 @@ int AniAva_UpdateOptions()
 {
 	BOOL bReloadAvatars=FALSE;
 	BOOL bBeEnabled=(!g_CluiData.fGDIPlusFail
-		&& ModernGetSettingByte(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP)&&!g_CluiData.fGDIPlusFail))
-		&& ModernGetSettingByte(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT));
+		&& db_get_b(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP)&&!g_CluiData.fGDIPlusFail))
+		&& db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT));
 	if (bBeEnabled && !AniAva.bModuleStarted)
 	{
 		AniAva_InitModule();
@@ -1012,19 +1012,19 @@ static void _AniAva_LoadOptions()
 	aacheck;
 	aalock;
 	{
-		AniAva.bFlags= (ModernGetSettingByte(NULL,"CList","AvatarsDrawBorders",SETTINGS_AVATARDRAWBORDER_DEFAULT)?	AAO_HAS_BORDER		:0) |
-			(ModernGetSettingByte(NULL,"CList","AvatarsRoundCorners",SETTINGS_AVATARROUNDCORNERS_DEFAULT)?	AAO_ROUND_CORNERS	:0) |	
-			(ModernGetSettingByte(NULL,"CList","AvatarsDrawOverlay",SETTINGS_AVATARDRAWOVERLAY_DEFAULT)?	AAO_HAS_OVERLAY		:0) |
+		AniAva.bFlags= (db_get_b(NULL,"CList","AvatarsDrawBorders",SETTINGS_AVATARDRAWBORDER_DEFAULT)?	AAO_HAS_BORDER		:0) |
+			(db_get_b(NULL,"CList","AvatarsRoundCorners",SETTINGS_AVATARROUNDCORNERS_DEFAULT)?	AAO_ROUND_CORNERS	:0) |	
+			(db_get_b(NULL,"CList","AvatarsDrawOverlay",SETTINGS_AVATARDRAWOVERLAY_DEFAULT)?	AAO_HAS_OVERLAY		:0) |
 			( (0) ? AAO_OPAQUE :0);
 
 		if (AniAva.bFlags & AAO_HAS_BORDER)
-			AniAva.borderColor=(COLORREF)ModernGetSettingDword(NULL,"CList","AvatarsBorderColor",SETTINGS_AVATARBORDERCOLOR_DEFAULT);;
+			AniAva.borderColor=(COLORREF)db_get_dw(NULL,"CList","AvatarsBorderColor",SETTINGS_AVATARBORDERCOLOR_DEFAULT);;
 		if (AniAva.bFlags & AAO_ROUND_CORNERS)
-			AniAva.cornerRadius=ModernGetSettingByte(NULL,"CList","AvatarsUseCustomCornerSize",SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT)? ModernGetSettingWord(NULL,"CList","AvatarsCustomCornerSize",SETTINGS_AVATARCORNERSIZE_DEFAULT) : 0;
+			AniAva.cornerRadius=db_get_b(NULL,"CList","AvatarsUseCustomCornerSize",SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT)? db_get_w(NULL,"CList","AvatarsCustomCornerSize",SETTINGS_AVATARCORNERSIZE_DEFAULT) : 0;
 		if (AniAva.bFlags & AAO_HAS_OVERLAY)
 		{
 			//check image list
-			BYTE type=ModernGetSettingByte(NULL,"CList","AvatarsOverlayType",SETTINGS_AVATAROVERLAYTYPE_DEFAULT);
+			BYTE type=db_get_b(NULL,"CList","AvatarsOverlayType",SETTINGS_AVATAROVERLAYTYPE_DEFAULT);
 			switch(type)
 			{
 			case SETTING_AVATAR_OVERLAY_TYPE_NORMAL:
@@ -1040,7 +1040,7 @@ static void _AniAva_LoadOptions()
 		}
 		if (AniAva.bFlags & AAO_OPAQUE)
 			AniAva.bkgColor=0;
-		AniAva.bSeparateWindow = ModernGetSettingByte(NULL,"CList","AvatarsInSeparateWnd",SETTINGS_AVATARINSEPARATE_DEFAULT); 
+		AniAva.bSeparateWindow = db_get_b(NULL,"CList","AvatarsInSeparateWnd",SETTINGS_AVATARINSEPARATE_DEFAULT); 
 
 	}
 	aaunlock;
diff --git a/plugins/Clist_modern/modern_awaymsg.cpp b/plugins/Clist_modern/modern_awaymsg.cpp
index 97f2550a32..2445b27794 100644
--- a/plugins/Clist_modern/modern_awaymsg.cpp
+++ b/plugins/Clist_modern/modern_awaymsg.cpp
@@ -209,7 +209,7 @@ void amRequestAwayMsg(HANDLE hContact)
 		return;
 	//Do not re-ask for chat rooms   
 	szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
-	if (szProto == NULL || ModernGetSettingByte(hContact, szProto, "ChatRoom", 0) != 0) 	
+	if (szProto == NULL || db_get_b(hContact, szProto, "ChatRoom", 0) != 0) 	
 		return;
 	amAddHandleToChain(hContact);        
 }
diff --git a/plugins/Clist_modern/modern_cachefuncs.cpp b/plugins/Clist_modern/modern_cachefuncs.cpp
index 444fef27d7..6eb0338acb 100644
--- a/plugins/Clist_modern/modern_cachefuncs.cpp
+++ b/plugins/Clist_modern/modern_cachefuncs.cpp
@@ -221,7 +221,7 @@ void CSmileyString::ReplaceSmileys(struct SHORTDATA *dat, PDNCE pdnce, TCHAR * s
     {
         sp.Protocolname = pdnce->m_cache_cszProto;
 
-        if (ModernGetSettingByte(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->m_cache_cszProto != NULL && g_szMetaModuleName && strcmp(pdnce->m_cache_cszProto, g_szMetaModuleName) == 0)
+        if (db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->m_cache_cszProto != NULL && g_szMetaModuleName && strcmp(pdnce->m_cache_cszProto, g_szMetaModuleName) == 0)
         {
             HANDLE hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (LPARAM)pdnce->m_cache_hContact, 0);
             if (hContact != 0)
@@ -329,11 +329,11 @@ int GetStatusName(TCHAR *text, int text_size, PDNCE pdnce, BOOL xstatus_has_prio
     if (!noAwayMsg&& !noXstatus&& xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto)
     {
         DBVARIANT dbv={0};
-        if (!ModernGetSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) 
+        if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) 
         {
             //lstrcpyn(text, dbv.pszVal, text_size);
             CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
-            ModernDBFreeVariant(&dbv);
+            db_free(&dbv);
 
             if (text[0] != '\0')
                 return -1;
@@ -353,11 +353,11 @@ int GetStatusName(TCHAR *text, int text_size, PDNCE pdnce, BOOL xstatus_has_prio
     if (!noAwayMsg && !noXstatus && !xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto)
     {
         DBVARIANT dbv={0};
-        if (!ModernGetSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) 
+        if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) 
         {
             //lstrcpyn(text, dbv.pszVal, text_size);
             CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
-            ModernDBFreeVariant(&dbv);
+            db_free(&dbv);
 
             if (text[0] != '\0')
                 return -1;
@@ -379,10 +379,10 @@ void GetListeningTo(TCHAR *text, int text_size,  PDNCE pdnce)
     if (wStatus==ID_STATUS_OFFLINE || wStatus==0)
         return;
 
-    if (!ModernGetSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "ListeningTo", &dbv)) 
+    if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "ListeningTo", &dbv)) 
     {
         CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
-        ModernDBFreeVariant(&dbv);
+        db_free(&dbv);
     }
 }
 
@@ -403,11 +403,11 @@ int GetStatusMessage(TCHAR *text, int text_size,  PDNCE pdnce, BOOL xstatus_has_
     if (!noAwayMsg &&xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto)
     {
         // Try to get XStatusMsg
-        if (!ModernGetSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) 
+        if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) 
         {
             //lstrcpyn(text, dbv.pszVal, text_size);
             CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
-            ModernDBFreeVariant(&dbv);
+            db_free(&dbv);
 
             if (text[0] != '\0')
                 return -1;
@@ -417,11 +417,11 @@ int GetStatusMessage(TCHAR *text, int text_size,  PDNCE pdnce, BOOL xstatus_has_
     // Get StatusMsg
     if (pdnce->m_cache_hContact && text[0] == '\0')
     {
-        if (!ModernGetSettingTString(pdnce->m_cache_hContact, "CList", "StatusMsg", &dbv)) 
+        if (!DBGetContactSettingTString(pdnce->m_cache_hContact, "CList", "StatusMsg", &dbv)) 
         {
             //lstrcpyn(text, dbv.pszVal, text_size);
             CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
-            ModernDBFreeVariant(&dbv);
+            db_free(&dbv);
 
             if (text[0] != '\0')
                 return 1;
@@ -432,11 +432,11 @@ int GetStatusMessage(TCHAR *text, int text_size,  PDNCE pdnce, BOOL xstatus_has_
     if (!noAwayMsg && !xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto && text[0] == '\0')
     {
         // Try to get XStatusMsg
-        if (!ModernGetSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) 
+        if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) 
         {
             //lstrcpyn(text, dbv.pszVal, text_size);
             CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1);
-            ModernDBFreeVariant(&dbv);
+            db_free(&dbv);
 
             if (text[0] != '\0')
                 return -1;
@@ -464,7 +464,7 @@ int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR *
                 DBVARIANT dbv={0};
 
                 // Try to get XStatusMsg
-                if (!ModernGetSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) 
+                if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) 
                 {
                     if (dbv.ptszVal != NULL && dbv.ptszVal[0] != 0)
                     {
@@ -473,7 +473,7 @@ int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR *
                         mir_free_and_nill(tmp);
                         CopySkipUnprintableChars(text, text, text_size-1);
                     }
-                    ModernDBFreeVariant(&dbv);
+                    db_free(&dbv);
                 }
             }
 
@@ -484,10 +484,10 @@ int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR *
             if (pdnce->m_cache_hContact && pdnce->m_cache_cszProto)
             {
                 DBVARIANT dbv={0};
-                if (!ModernGetSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) 
+                if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) 
                 {
                     lstrcpyn(text, dbv.ptszVal, text_size);
-                    ModernDBFreeVariant(&dbv);
+                    db_free(&dbv);
                     CopySkipUnprintableChars(text, text, text_size-1);
                 }
             }
@@ -501,7 +501,7 @@ int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR *
                 DBVARIANT dbv={0};
 
                 // Try to get XStatusName
-                if (!ModernGetSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) 
+                if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) 
                 {
                     if (dbv.pszVal != NULL && dbv.pszVal[0] != 0)
                     {
@@ -511,19 +511,19 @@ int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR *
                         mir_free_and_nill(tmp);
                     }
                     CopySkipUnprintableChars(text, text, text_size-1);
-                    ModernDBFreeVariant(&dbv);
+                    db_free(&dbv);
                 }
             }
             else if (use_name_and_message_for_xstatus && xstatus_has_priority)
             {
                 DBVARIANT dbv={0};
                 // Try to get XStatusName
-                if (!ModernGetSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) 
+                if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) 
                 {
                     if (dbv.pszVal != NULL && dbv.pszVal[0] != 0)
                         mir_sntprintf(text, text_size, TEXT("%s"), dbv.pszVal);
                     CopySkipUnprintableChars(text, text, text_size-1);
-                    ModernDBFreeVariant(&dbv);
+                    db_free(&dbv);
                 }
             }
 
@@ -588,11 +588,11 @@ void Cache_GetFirstLineText(struct ClcData *dat, struct ClcContact *contact)
     TCHAR *name = pcli->pfnGetContactDisplayName(contact->hContact,0);
     if (dat->first_line_append_nick && (!dat->force_in_dialog)) {
         DBVARIANT dbv = {0};
-        if (!ModernGetSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) 
+        if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) 
         {
             TCHAR nick[SIZEOF(contact->szText)];
             lstrcpyn(nick, dbv.ptszVal, SIZEOF(contact->szText));
-            ModernDBFreeVariant(&dbv);
+            db_free(&dbv);
 
            if (_tcsicmp(name, nick) == 0) {
                // They are the same -> use the name to keep the case
@@ -984,7 +984,7 @@ void Cache_GetAvatar(struct ClcData *dat, struct ClcContact *contact)
     }
     if (dat->use_avatar_service && ServiceExists(MS_AV_GETAVATARBITMAP))
     {
-        if (dat->avatars_show && !ModernGetSettingByte(contact->hContact, "CList", "HideContactAvatar", 0))
+        if (dat->avatars_show && !db_get_b(contact->hContact, "CList", "HideContactAvatar", 0))
         {
             contact->avatar_data = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)contact->hContact, 0);
             if (contact->avatar_data == NULL || contact->avatar_data->cbSize != sizeof(struct avatarCacheEntry) 
@@ -1007,10 +1007,10 @@ void Cache_GetAvatar(struct ClcData *dat, struct ClcContact *contact)
     else
     {
         contact->avatar_pos = AVATAR_POS_DONT_HAVE;
-        if (dat->avatars_show && !ModernGetSettingByte(contact->hContact, "CList", "HideContactAvatar", 0))
+        if (dat->avatars_show && !db_get_b(contact->hContact, "CList", "HideContactAvatar", 0))
         {
             DBVARIANT dbv;
-            if (!ModernGetSettingTString(contact->hContact, "ContactPhoto", "File", &dbv))
+            if (!DBGetContactSettingTString(contact->hContact, "ContactPhoto", "File", &dbv))
             {
                 HBITMAP hBmp = (HBITMAP) CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)dbv.ptszVal);
                 if (hBmp != NULL)
@@ -1091,7 +1091,7 @@ void Cache_GetAvatar(struct ClcData *dat, struct ClcContact *contact)
                     DeleteObject(hBmp);
                 } //if (hBmp != NULL)
             }
-            ModernDBFreeVariant(&dbv);
+            db_free(&dbv);
         }
 
         // Remove avatar if needed
diff --git a/plugins/Clist_modern/modern_clc.cpp b/plugins/Clist_modern/modern_clc.cpp
index 40cd285410..e124c2c4fe 100644
--- a/plugins/Clist_modern/modern_clc.cpp
+++ b/plugins/Clist_modern/modern_clc.cpp
@@ -305,7 +305,7 @@ static int clcHookDbEventAdded(WPARAM wParam,LPARAM lParam)
 		if(dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT))
 		{
 			PDNCE pdnce=(PDNCE)pcli->pfnGetCacheEntry((HANDLE)wParam);
-			ModernWriteSettingDword((HANDLE)wParam, "CList", "mf_lastmsg", dbei.timestamp);
+			db_set_dw((HANDLE)wParam, "CList", "mf_lastmsg", dbei.timestamp);
 			if (pdnce)
 				pdnce->dwLastMsgTime=dbei.timestamp;
 		}
@@ -451,18 +451,18 @@ static LRESULT clcOnCreate(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPar
 	RowHeights_Initialize(dat);
 
 	dat->NeedResort=1;
-	dat->MetaIgnoreEmptyExtra=ModernGetSettingByte(NULL,"CLC","MetaIgnoreEmptyExtra",SETTING_METAIGNOREEMPTYEXTRA_DEFAULT);
+	dat->MetaIgnoreEmptyExtra=db_get_b(NULL,"CLC","MetaIgnoreEmptyExtra",SETTING_METAIGNOREEMPTYEXTRA_DEFAULT);
 
 	dat->IsMetaContactsEnabled=(!(GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_MANUALUPDATE)) &&
-		g_szMetaModuleName && ModernGetSettingByte(NULL,g_szMetaModuleName,"Enabled",1) && ServiceExists(MS_MC_GETDEFAULTCONTACT);
-
-	dat->expandMeta=ModernGetSettingByte(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT);		
-	dat->useMetaIcon=ModernGetSettingByte(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT);
-	dat->drawOverlayedStatus=ModernGetSettingByte(NULL,"CLC","DrawOverlayedStatus",SETTING_DRAWOVERLAYEDSTATUS_DEFAULT);
-	g_CluiData.bSortByOrder[0]=ModernGetSettingByte(NULL,"CList","SortBy1",SETTING_SORTBY1_DEFAULT);
-	g_CluiData.bSortByOrder[1]=ModernGetSettingByte(NULL,"CList","SortBy2",SETTING_SORTBY2_DEFAULT);
-	g_CluiData.bSortByOrder[2]=ModernGetSettingByte(NULL,"CList","SortBy3",SETTING_SORTBY3_DEFAULT);
-	g_CluiData.fSortNoOfflineBottom=ModernGetSettingByte(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT);
+		g_szMetaModuleName && db_get_b(NULL,g_szMetaModuleName,"Enabled",1) && ServiceExists(MS_MC_GETDEFAULTCONTACT);
+
+	dat->expandMeta=db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT);		
+	dat->useMetaIcon=db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT);
+	dat->drawOverlayedStatus=db_get_b(NULL,"CLC","DrawOverlayedStatus",SETTING_DRAWOVERLAYEDSTATUS_DEFAULT);
+	g_CluiData.bSortByOrder[0]=db_get_b(NULL,"CList","SortBy1",SETTING_SORTBY1_DEFAULT);
+	g_CluiData.bSortByOrder[1]=db_get_b(NULL,"CList","SortBy2",SETTING_SORTBY2_DEFAULT);
+	g_CluiData.bSortByOrder[2]=db_get_b(NULL,"CList","SortBy3",SETTING_SORTBY3_DEFAULT);
+	g_CluiData.fSortNoOfflineBottom=db_get_b(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT);
 	dat->menuOwnerID=-1;
 	dat->menuOwnerType=CLCIT_INVALID;
 	//InitDisplayNameCache(&dat->lCLCContactsCache);
@@ -732,7 +732,7 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa
 						struct ClcContact * ht=NULL;
 						KillTimer(hwnd,TIMERID_SUBEXPAND);
 						contact->SubExpanded=0;
-						ModernWriteSettingByte(contact->hContact,"CList","Expanded",0);
+						db_set_b(contact->hContact,"CList","Expanded",0);
 						ht=contact;
 						dat->NeedResort=1;
 						pcli->pfnSortCLC(hwnd,dat,1);		
@@ -749,7 +749,7 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa
 						struct ClcContact * ht=NULL;
 						KillTimer(hwnd,TIMERID_SUBEXPAND);
 						contact->SubExpanded=1;
-						ModernWriteSettingByte(contact->hContact,"CList","Expanded",1);
+						db_set_b(contact->hContact,"CList","Expanded",1);
 						ht=contact;
 						dat->NeedResort=1;
 						pcli->pfnSortCLC(hwnd,dat,1);		
@@ -871,7 +871,7 @@ static LRESULT clcOnTimer(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPara
 			if (hitcontact && dat->expandMeta)
 			{
 				if (hitcontact->SubExpanded) hitcontact->SubExpanded=0; else hitcontact->SubExpanded=1;
-				ModernWriteSettingByte(hitcontact->hContact,"CList","Expanded",hitcontact->SubExpanded);
+				db_set_b(hitcontact->hContact,"CList","Expanded",hitcontact->SubExpanded);
 				if (hitcontact->SubExpanded)
 					ht=&(hitcontact->subcontacts[hitcontact->SubAllocated-1]);
 			}
@@ -1006,7 +1006,7 @@ static LRESULT clcOnLButtonDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM
 		if(hit!=-1 && !(hitFlags&CLCHT_NOWHERE) && contact->type==CLCIT_CONTACT && contact->SubAllocated && !contact->isSubcontact)
 			if(hitFlags&CLCHT_ONITEMICON && dat->expandMeta) 
 			{
-				BYTE doubleClickExpand=ModernGetSettingByte(NULL,"CLC","MetaDoubleClick",SETTING_METAAVOIDDBLCLICK_DEFAULT);
+				BYTE doubleClickExpand=db_get_b(NULL,"CLC","MetaDoubleClick",SETTING_METAAVOIDDBLCLICK_DEFAULT);
 
 				hitcontact=contact;				
 				HitPoint.x= (short)LOWORD(lParam);
@@ -1368,7 +1368,7 @@ static LRESULT clcOnLButtonUp(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM w
 
 	if (hitcontact!=NULL && dat->expandMeta)
 	{ 
-		BYTE doubleClickExpand=ModernGetSettingByte(NULL,"CLC","MetaDoubleClick",SETTING_METAAVOIDDBLCLICK_DEFAULT);
+		BYTE doubleClickExpand=db_get_b(NULL,"CLC","MetaDoubleClick",SETTING_METAAVOIDDBLCLICK_DEFAULT);
 		CLUI_SafeSetTimer(hwnd,TIMERID_SUBEXPAND,GetDoubleClickTime()*doubleClickExpand,NULL);
 	}
 	else if (dat->iHotTrack==-1 && dat->iDragItem==-1)
@@ -1667,7 +1667,7 @@ static LRESULT clcOnIntmGroupChanged(struct ClcData *dat, HWND hwnd, UINT msg, W
 		flags = contact->flags;
 	}
 	pcli->pfnDeleteItemFromTree(hwnd, (HANDLE) wParam);
-	if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !ModernGetSettingByte((HANDLE) wParam, "CList", "Hidden", 0)) {
+	if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !db_get_b((HANDLE) wParam, "CList", "Hidden", 0)) {
 		NMCLISTCONTROL nm;
 		pcli->pfnAddContactToTree(hwnd, dat, (HANDLE) wParam, 1, 1);
 		if (pcli->pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) {
@@ -1947,7 +1947,7 @@ static LRESULT clcOnIntmStatusChanged(struct ClcData *dat, HWND hwnd, UINT msg,
 
 
 	}
-	if (ModernGetSettingByte(NULL,"CList","PlaceOfflineToRoot",SETTING_PLACEOOFLINETOROOT_DEFAULT))
+	if (db_get_b(NULL,"CList","PlaceOfflineToRoot",SETTING_PLACEOOFLINETOROOT_DEFAULT))
 	{
 		SendMessage(hwnd,CLM_AUTOREBUILD,0,0);	
 	}
@@ -1997,9 +1997,9 @@ int ClcUnloadModule()
 		ModernUnhookEvent(hIconChangedHook);
 
 	if ( g_CluiData.bOldUseGroups != (BYTE)-1 )
-		ModernWriteSettingByte(NULL,"CList","UseGroups",(BYTE)g_CluiData.bOldUseGroups );
+		db_set_b(NULL,"CList","UseGroups",(BYTE)g_CluiData.bOldUseGroups );
 	if ( g_CluiData.boldHideOffline != (BYTE)-1 )
-		ModernWriteSettingByte(NULL,"CList","HideOffline",(BYTE)g_CluiData.boldHideOffline );
+		db_set_b(NULL,"CList","HideOffline",(BYTE)g_CluiData.boldHideOffline );
 
 	return 0;
 }
@@ -2031,10 +2031,10 @@ int ClcDoProtoAck(HANDLE wParam,ACKDATA * ack)
 		if (ack->result==ACKRESULT_SUCCESS && ack->lParam) {
 			{//Do not change DB if it is IRC protocol    
 				if (ack->szModule!= NULL) 
-					if(ModernGetSettingByte(ack->hContact, ack->szModule, "ChatRoom", 0) != 0) return 0;
+					if(db_get_b(ack->hContact, ack->szModule, "ChatRoom", 0) != 0) return 0;
 			}
 
-			ModernWriteSettingTString(ack->hContact,"CList","StatusMsg",(const TCHAR *)ack->lParam);
+			db_set_ws(ack->hContact,"CList","StatusMsg",(const TCHAR *)ack->lParam);
 			gtaRenewText(ack->hContact);
 		} 
 		else
@@ -2043,15 +2043,15 @@ int ClcDoProtoAck(HANDLE wParam,ACKDATA * ack)
 			//char a='\0';
 			{//Do not change DB if it is IRC protocol    
 				if (ack->szModule!= NULL) 
-					if(ModernGetSettingByte(ack->hContact, ack->szModule, "ChatRoom", 0) != 0) return 0;
+					if(db_get_b(ack->hContact, ack->szModule, "ChatRoom", 0) != 0) return 0;
 			}
 			if (ack->hContact) 
 			{
-				char * val= ModernGetStringA(ack->hContact,"CList","StatusMsg");
+				char * val= db_get_sa(ack->hContact,"CList","StatusMsg");
 				if (val) 
 				{
 					if (!mir_bool_strcmpi(val,""))
-						ModernWriteSettingString(ack->hContact,"CList","StatusMsg","");
+						db_set_s(ack->hContact,"CList","StatusMsg","");
 					else
 						gtaRenewText(ack->hContact);
 					mir_free_and_nill(val);
diff --git a/plugins/Clist_modern/modern_clcidents.cpp b/plugins/Clist_modern/modern_clcidents.cpp
index b6106439bc..5e046807f3 100644
--- a/plugins/Clist_modern/modern_clcidents.cpp
+++ b/plugins/Clist_modern/modern_clcidents.cpp
@@ -59,7 +59,7 @@ int cliGetRowsPriorTo(struct ClcGroup *group,struct ClcGroup *subgroup,int conta
 	int count=0;
 	BYTE k;
 	int subcontactscount=0;
-	k=ModernGetSettingByte(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT);
+	k=db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT);
 	group->scanIndex=0;
 	for (;;) {
 		if(group->scanIndex==group->cl.count) {
diff --git a/plugins/Clist_modern/modern_clcitems.cpp b/plugins/Clist_modern/modern_clcitems.cpp
index 0ceff512f9..01ed44aa02 100644
--- a/plugins/Clist_modern/modern_clcitems.cpp
+++ b/plugins/Clist_modern/modern_clcitems.cpp
@@ -33,7 +33,7 @@ void AddSubcontacts(struct ClcData *dat, struct ClcContact * cont, BOOL showOffl
 	HANDLE hsub;
 	pdisplayNameCacheEntry cacheEntry;
 	cacheEntry=(pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(cont->hContact);
-	cont->SubExpanded=(ModernGetSettingByte(cont->hContact,"CList","Expanded",0) && (ModernGetSettingByte(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT)));
+	cont->SubExpanded=(db_get_b(cont->hContact,"CList","Expanded",0) && (db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT)));
 	subcount=(int)CallService(MS_MC_GETNUMCONTACTS,(WPARAM)cont->hContact,0);
 
 	if (subcount <= 0) {
@@ -54,7 +54,7 @@ void AddSubcontacts(struct ClcData *dat, struct ClcContact * cont, BOOL showOffl
 		hsub=(HANDLE)CallService(MS_MC_GETSUBCONTACT,(WPARAM)cont->hContact,j);
 		cacheEntry=(pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hsub);
 		wStatus=pdnce___GetStatus( cacheEntry );
-		if (showOfflineHereGroup||(!(ModernGetSettingByte(NULL,"CLC","MetaHideOfflineSub",SETTING_METAHIDEOFFLINESUB_DEFAULT) && ModernGetSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)) ||
+		if (showOfflineHereGroup||(!(db_get_b(NULL,"CLC","MetaHideOfflineSub",SETTING_METAHIDEOFFLINESUB_DEFAULT) && db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)) ||
 			wStatus!=ID_STATUS_OFFLINE )
 			//&&
 			//(!cacheEntry->Hidden || style&CLS_SHOWHIDDEN)
@@ -228,7 +228,7 @@ static void _LoadDataToContact(struct ClcContact * cont, struct ClcGroup *group,
 	Cache_GetText(dat,cont,1);
 	Cache_GetTimezone(dat,cont->hContact);
 	cont->iImage=CallService(MS_CLIST_GETCONTACTICON,(WPARAM)hContact,1);
-	cont->bContactRate=ModernGetSettingByte(hContact, "CList", "Rate",0);
+	cont->bContactRate=db_get_b(hContact, "CList", "Rate",0);
 }
 
 static struct ClcContact * AddContactToGroup(struct ClcData *dat,struct ClcGroup *group, pdisplayNameCacheEntry cacheEntry)
@@ -278,7 +278,7 @@ void * AddTempGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flag
 		mir_snprintf(buf,SIZEOF(buf),"%d",(i-1));
 		mir_sntprintf(b2,SIZEOF(b2),_T("#%s"),szName);
 		b2[0]=1|GROUPF_EXPANDED;
-		ModernWriteSettingTString(NULL,"CListGroups",buf,b2);
+		db_set_ws(NULL,"CListGroups",buf,b2);
 		pcli->pfnGetGroupName(i,&groupFlags);      
 		res=cli_AddGroup(hwnd,dat,szName,groupFlags,i,0);
 		return res;
@@ -366,7 +366,7 @@ void cliRebuildEntireList(HWND hwnd,struct ClcData *dat)
 	struct ClcGroup *group;
     static int rebuildCounter=0;
 
-    BOOL PlaceOfflineToRoot=ModernGetSettingByte(NULL,"CList","PlaceOfflineToRoot",SETTING_PLACEOFFLINETOROOT_DEFAULT);
+    BOOL PlaceOfflineToRoot=db_get_b(NULL,"CList","PlaceOfflineToRoot",SETTING_PLACEOFFLINETOROOT_DEFAULT);
 	KillTimer(hwnd,TIMERID_REBUILDAFTER);
 	
 	ClearRowByIndexCache();
@@ -376,14 +376,14 @@ void cliRebuildEntireList(HWND hwnd,struct ClcData *dat)
     TRACEVAR("Rebuild Entire List %d times\n",++rebuildCounter);
   
 	dat->list.expanded=1;
-	dat->list.hideOffline=ModernGetSettingByte(NULL,"CLC","HideOfflineRoot",SETTING_HIDEOFFLINEATROOT_DEFAULT) && style&CLS_USEGROUPS;
+	dat->list.hideOffline=db_get_b(NULL,"CLC","HideOfflineRoot",SETTING_HIDEOFFLINEATROOT_DEFAULT) && style&CLS_USEGROUPS;
 	dat->list.cl.count = dat->list.cl.limit = 0;
 	dat->list.cl.increment = 50;
 	dat->NeedResort=1;
 
 	HANDLE hSelected = SaveSelection( dat );
 	dat->selection=-1;
-	dat->HiLightMode=ModernGetSettingByte(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT);
+	dat->HiLightMode=db_get_b(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT);
 	{
 		int i;
 		TCHAR *szGroupName;
@@ -752,7 +752,7 @@ int cliGetGroupContentsCount(struct ClcGroup *group, int visibleOnly)
 
 int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struct ClcData *dat)
 {
-	int dbHidden = ModernGetSettingByte(hContact, "CList", "Hidden", 0);		// default hidden state, always respect it.
+	int dbHidden = db_get_b(hContact, "CList", "Hidden", 0);		// default hidden state, always respect it.
 	int filterResult = 1;
 	DBVARIANT dbv = {0};
 	char szTemp[64];
@@ -762,7 +762,7 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc
 	BOOL fEmbedded=dat->force_in_dialog;
 	// always hide subcontacts (but show them on embedded contact lists)
 	
-	if(g_CluiData.bMetaAvail && dat != NULL && dat->IsMetaContactsEnabled && g_szMetaModuleName && ModernGetSettingByte(hContact, g_szMetaModuleName, "IsSubcontact", 0))
+	if(g_CluiData.bMetaAvail && dat != NULL && dat->IsMetaContactsEnabled && g_szMetaModuleName && db_get_b(hContact, g_szMetaModuleName, "IsSubcontact", 0))
 		return -1; //subcontact
     if (pdnce && pdnce->isUnknown && !fEmbedded)    
         return 1; //'Unknown Contact'
@@ -773,10 +773,10 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc
 		// check stickies first (priority), only if we really have stickies defined (CLVM_STICKY_CONTACTS is set).
 		if(g_CluiData.bFilterEffective & CLVM_STICKY_CONTACTS) 
         {
-			if ((dwLocalMask = ModernGetSettingDword(hContact, CLVM_MODULE, g_CluiData.current_viewmode, 0)) != 0) {
+			if ((dwLocalMask = db_get_dw(hContact, CLVM_MODULE, g_CluiData.current_viewmode, 0)) != 0) {
 				if(g_CluiData.bFilterEffective & CLVM_FILTER_STICKYSTATUS) 
                 {
-					WORD wStatus = ModernGetSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
+					WORD wStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
 					return !((1 << (wStatus - ID_STATUS_OFFLINE)) & HIWORD(dwLocalMask));
 				}
 				return 0;
@@ -788,7 +788,7 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc
 			filterResult = strstr(g_CluiData.protoFilter, szTemp) ? 1 : 0;
 		}
 		if(g_CluiData.bFilterEffective & CLVM_FILTER_GROUPS) {
-			if (!ModernGetSettingTString(hContact, "CList", "Group", &dbv)) {
+			if (!DBGetContactSettingTString(hContact, "CList", "Group", &dbv)) {
 				mir_sntprintf(szGroupMask, SIZEOF(szGroupMask), _T("%s|"), &dbv.ptszVal[0]);
 				filterResult = (g_CluiData.filterFlags & CLVM_PROTOGROUP_OP) ? (filterResult | (_tcsstr(g_CluiData.groupFilter, szGroupMask) ? 1 : 0)) : (filterResult & (_tcsstr(g_CluiData.groupFilter, szGroupMask) ? 1 : 0));
 				mir_free(dbv.ptszVal);
@@ -799,7 +799,7 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc
 				filterResult = (g_CluiData.filterFlags & CLVM_PROTOGROUP_OP) ? filterResult : filterResult & 0;
 		}
 		if(g_CluiData.bFilterEffective & CLVM_FILTER_STATUS) {
-			WORD wStatus = ModernGetSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
+			WORD wStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
 			filterResult = (g_CluiData.filterFlags & CLVM_GROUPSTATUS_OP) ? ((filterResult | ((1 << (wStatus - ID_STATUS_OFFLINE)) & g_CluiData.statusMaskFilter ? 1 : 0))) : (filterResult & ((1 << (wStatus - ID_STATUS_OFFLINE)) & g_CluiData.statusMaskFilter ? 1 : 0));
 		}
 		if(g_CluiData.bFilterEffective & CLVM_FILTER_LASTMSG) 
diff --git a/plugins/Clist_modern/modern_clcmsgs.cpp b/plugins/Clist_modern/modern_clcmsgs.cpp
index 872b24c6c4..391c5b9f8a 100644
--- a/plugins/Clist_modern/modern_clcmsgs.cpp
+++ b/plugins/Clist_modern/modern_clcmsgs.cpp
@@ -214,7 +214,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,struct ClcData *dat,UINT msg,WPARA
 				index+=contact->isSubcontact;				
 			}			
 			{	
-				BYTE k=ModernGetSettingByte(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT);
+				BYTE k=db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT);
 				if (k)
 				{
 					int subcontactscount=0;
diff --git a/plugins/Clist_modern/modern_clcopts.cpp b/plugins/Clist_modern/modern_clcopts.cpp
index 10679d57f0..a950c4a018 100644
--- a/plugins/Clist_modern/modern_clcopts.cpp
+++ b/plugins/Clist_modern/modern_clcopts.cpp
@@ -235,11 +235,11 @@ void GetFontSetting(int i,LOGFONT *lf,COLORREF *colour,BYTE *effect, COLORREF *e
 	if (effect)
 	{
 		mir_snprintf(idstr,SIZEOF(idstr),"Font%dEffect",i);
-		*effect=ModernGetSettingByte(NULL,"CLC",idstr,0);
+		*effect=db_get_b(NULL,"CLC",idstr,0);
 		mir_snprintf(idstr,SIZEOF(idstr),"Font%dEffectCol1",i);
-		*eColour1=ModernGetSettingDword(NULL,"CLC",idstr,0);
+		*eColour1=db_get_dw(NULL,"CLC",idstr,0);
 		mir_snprintf(idstr,SIZEOF(idstr),"Font%dEffectCol2",i);
-		*eColour2=ModernGetSettingDword(NULL,"CLC",idstr,0);
+		*eColour2=db_get_dw(NULL,"CLC",idstr,0);
 	}
 }
 
@@ -402,18 +402,18 @@ static INT_PTR CALLBACK DlgProcClistAdditionalOpts(HWND hwndDlg, UINT msg, WPARA
 	case WM_INITDIALOG:
 
 		TranslateDialogDefault(hwndDlg);
-		CheckDlgButton(hwndDlg, IDC_META, ModernGetSettingByte(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
-		CheckDlgButton(hwndDlg, IDC_METADBLCLK, ModernGetSettingByte(NULL,"CLC","MetaDoubleClick",SETTING_METAAVOIDDBLCLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
-		CheckDlgButton(hwndDlg, IDC_METASUBEXTRA, ModernGetSettingByte(NULL,"CLC","MetaHideExtra",SETTING_METAHIDEEXTRA_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
-		CheckDlgButton(hwndDlg, IDC_METASUBEXTRA_IGN, ModernGetSettingByte(NULL,"CLC","MetaIgnoreEmptyExtra",SETTING_METAAVOIDDBLCLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
-		CheckDlgButton(hwndDlg, IDC_METASUB_HIDEOFFLINE, ModernGetSettingByte(NULL,"CLC","MetaHideOfflineSub",SETTING_METAHIDEOFFLINESUB_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
-		CheckDlgButton(hwndDlg, IDC_METAEXPAND, ModernGetSettingByte(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
-		CheckDlgButton(hwndDlg, IDC_DISCOVER_AWAYMSG, ModernGetSettingByte(NULL,"ModernData","InternalAwayMsgDiscovery",SETTING_INTERNALAWAYMSGREQUEST_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
-		CheckDlgButton(hwndDlg, IDC_REMOVE_OFFLINE_AWAYMSG, ModernGetSettingByte(NULL,"ModernData","RemoveAwayMessageForOffline",SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
+		CheckDlgButton(hwndDlg, IDC_META, db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
+		CheckDlgButton(hwndDlg, IDC_METADBLCLK, db_get_b(NULL,"CLC","MetaDoubleClick",SETTING_METAAVOIDDBLCLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
+		CheckDlgButton(hwndDlg, IDC_METASUBEXTRA, db_get_b(NULL,"CLC","MetaHideExtra",SETTING_METAHIDEEXTRA_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
+		CheckDlgButton(hwndDlg, IDC_METASUBEXTRA_IGN, db_get_b(NULL,"CLC","MetaIgnoreEmptyExtra",SETTING_METAAVOIDDBLCLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
+		CheckDlgButton(hwndDlg, IDC_METASUB_HIDEOFFLINE, db_get_b(NULL,"CLC","MetaHideOfflineSub",SETTING_METAHIDEOFFLINESUB_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
+		CheckDlgButton(hwndDlg, IDC_METAEXPAND, db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
+		CheckDlgButton(hwndDlg, IDC_DISCOVER_AWAYMSG, db_get_b(NULL,"ModernData","InternalAwayMsgDiscovery",SETTING_INTERNALAWAYMSGREQUEST_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
+		CheckDlgButton(hwndDlg, IDC_REMOVE_OFFLINE_AWAYMSG, db_get_b(NULL,"ModernData","RemoveAwayMessageForOffline",SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
 
 		SendDlgItemMessage(hwndDlg,IDC_SUBINDENTSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_SUBINDENT),0);
 		SendDlgItemMessage(hwndDlg,IDC_SUBINDENTSPIN,UDM_SETRANGE,0,MAKELONG(50,0));
-		SendDlgItemMessage(hwndDlg,IDC_SUBINDENTSPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingByte(NULL,"CLC","SubIndent",CLCDEFAULT_GROUPINDENT),0));
+		SendDlgItemMessage(hwndDlg,IDC_SUBINDENTSPIN,UDM_SETPOS,0,MAKELONG(db_get_b(NULL,"CLC","SubIndent",CLCDEFAULT_GROUPINDENT),0));
 
 		{
 			BYTE t;
@@ -461,16 +461,16 @@ static INT_PTR CALLBACK DlgProcClistAdditionalOpts(HWND hwndDlg, UINT msg, WPARA
 			switch (t->code)
 			{
 			case PSN_APPLY:
-				ModernWriteSettingByte(NULL,"CLC","Meta",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_META)); // by FYR
-				ModernWriteSettingByte(NULL,"CLC","MetaDoubleClick",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METADBLCLK)); // by FYR
-				ModernWriteSettingByte(NULL,"CLC","MetaHideExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA)); // by FYR
-				ModernWriteSettingByte(NULL,"CLC","MetaIgnoreEmptyExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA_IGN)); // by FYR
-				ModernWriteSettingByte(NULL,"CLC","MetaHideOfflineSub",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUB_HIDEOFFLINE)); // by FYR
-				ModernWriteSettingByte(NULL,"CLC","MetaExpanding",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METAEXPAND));
-				ModernWriteSettingByte(NULL,"ModernData","InternalAwayMsgDiscovery",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DISCOVER_AWAYMSG));
-				ModernWriteSettingByte(NULL,"ModernData","RemoveAwayMessageForOffline",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_REMOVE_OFFLINE_AWAYMSG));
-
-				ModernWriteSettingByte(NULL,"CLC","SubIndent",(BYTE)SendDlgItemMessage(hwndDlg,IDC_SUBINDENTSPIN,UDM_GETPOS,0,0));
+				db_set_b(NULL,"CLC","Meta",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_META)); // by FYR
+				db_set_b(NULL,"CLC","MetaDoubleClick",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METADBLCLK)); // by FYR
+				db_set_b(NULL,"CLC","MetaHideExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA)); // by FYR
+				db_set_b(NULL,"CLC","MetaIgnoreEmptyExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA_IGN)); // by FYR
+				db_set_b(NULL,"CLC","MetaHideOfflineSub",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUB_HIDEOFFLINE)); // by FYR
+				db_set_b(NULL,"CLC","MetaExpanding",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METAEXPAND));
+				db_set_b(NULL,"ModernData","InternalAwayMsgDiscovery",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DISCOVER_AWAYMSG));
+				db_set_b(NULL,"ModernData","RemoveAwayMessageForOffline",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_REMOVE_OFFLINE_AWAYMSG));
+
+				db_set_b(NULL,"CLC","SubIndent",(BYTE)SendDlgItemMessage(hwndDlg,IDC_SUBINDENTSPIN,UDM_GETPOS,0,0));
 				ClcOptionsChanged();
 				CLUI_ReloadCLUIOptions();
 				PostMessage(pcli->hwndContactList,WM_SIZE,0,0);
@@ -505,7 +505,7 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar
 			TreeView_SetImageList(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),himlCheckBoxes,TVSIL_NORMAL);
 		}
 		{
-			DWORD exStyle=ModernGetSettingDword(NULL,"CLC","ExStyle",GetDefaultExStyle());
+			DWORD exStyle=db_get_dw(NULL,"CLC","ExStyle",GetDefaultExStyle());
 			for(int i=0;i<SIZEOF(checkBoxToStyleEx);i++)
 				CheckDlgButton(hwndDlg,checkBoxToStyleEx[i].id,(exStyle&checkBoxToStyleEx[i].flag)^(checkBoxToStyleEx[i].flag*checkBoxToStyleEx[i].neg)?BST_CHECKED:BST_UNCHECKED);
 		}
@@ -513,19 +513,19 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar
 			UDACCEL accel[2]={{0,10},{2,50}};
 			SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETRANGE,0,MAKELONG(999,0));
 			SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETACCEL,SIZEOF(accel),(LPARAM)&accel);
-			SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"CLC","ScrollTime",CLCDEFAULT_SCROLLTIME),0));
+			SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CLC","ScrollTime",CLCDEFAULT_SCROLLTIME),0));
 		}
-		CheckDlgButton(hwndDlg,IDC_IDLE,ModernGetSettingByte(NULL,"CLC","ShowIdle",CLCDEFAULT_SHOWIDLE)?BST_CHECKED:BST_UNCHECKED);
+		CheckDlgButton(hwndDlg,IDC_IDLE,db_get_b(NULL,"CLC","ShowIdle",CLCDEFAULT_SHOWIDLE)?BST_CHECKED:BST_UNCHECKED);
 
 		SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_SETRANGE,0,MAKELONG(50,0));
-		SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingByte(NULL,"CLC","GroupIndent",CLCDEFAULT_GROUPINDENT),0));
-		CheckDlgButton(hwndDlg,IDC_GREYOUT,ModernGetSettingDword(NULL,"CLC","GreyoutFlags",CLCDEFAULT_GREYOUTFLAGS)?BST_CHECKED:BST_UNCHECKED);
+		SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_SETPOS,0,MAKELONG(db_get_b(NULL,"CLC","GroupIndent",CLCDEFAULT_GROUPINDENT),0));
+		CheckDlgButton(hwndDlg,IDC_GREYOUT,db_get_dw(NULL,"CLC","GreyoutFlags",CLCDEFAULT_GREYOUTFLAGS)?BST_CHECKED:BST_UNCHECKED);
 
 		EnableWindow(GetDlgItem(hwndDlg,IDC_SMOOTHTIME),IsDlgButtonChecked(hwndDlg,IDC_NOTNOSMOOTHSCROLLING));
 		EnableWindow(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),IsDlgButtonChecked(hwndDlg,IDC_GREYOUT));
-		FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),greyoutValues,SIZEOF(greyoutValues),ModernGetSettingDword(NULL,"CLC","FullGreyoutFlags",CLCDEFAULT_FULLGREYOUTFLAGS));
-		FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),offlineValues,SIZEOF(offlineValues),ModernGetSettingDword(NULL,"CLC","OfflineModes",CLCDEFAULT_OFFLINEMODES));
-		CheckDlgButton(hwndDlg,IDC_NOSCROLLBAR,ModernGetSettingByte(NULL,"CLC","NoVScrollBar",CLCDEFAULT_NOVSCROLL)?BST_CHECKED:BST_UNCHECKED);
+		FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),greyoutValues,SIZEOF(greyoutValues),db_get_dw(NULL,"CLC","FullGreyoutFlags",CLCDEFAULT_FULLGREYOUTFLAGS));
+		FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),offlineValues,SIZEOF(offlineValues),db_get_dw(NULL,"CLC","OfflineModes",CLCDEFAULT_OFFLINEMODES));
+		CheckDlgButton(hwndDlg,IDC_NOSCROLLBAR,db_get_b(NULL,"CLC","NoVScrollBar",CLCDEFAULT_NOVSCROLL)?BST_CHECKED:BST_UNCHECKED);
 		return TRUE;
 	case WM_VSCROLL:
 		SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
@@ -569,26 +569,26 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar
 				for(int i=0;i<SIZEOF(checkBoxToStyleEx);i++)
 					if ((IsDlgButtonChecked(hwndDlg,checkBoxToStyleEx[i].id)==0)==checkBoxToStyleEx[i].neg)
 						exStyle|=checkBoxToStyleEx[i].flag;
-				ModernWriteSettingDword(NULL,"CLC","ExStyle",exStyle);
+				db_set_dw(NULL,"CLC","ExStyle",exStyle);
 			}
 			{	DWORD fullGreyoutFlags=MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS));
-			ModernWriteSettingDword(NULL,"CLC","FullGreyoutFlags",fullGreyoutFlags);
+			db_set_dw(NULL,"CLC","FullGreyoutFlags",fullGreyoutFlags);
 			if(IsDlgButtonChecked(hwndDlg,IDC_GREYOUT))
-				ModernWriteSettingDword(NULL,"CLC","GreyoutFlags",fullGreyoutFlags);
+				db_set_dw(NULL,"CLC","GreyoutFlags",fullGreyoutFlags);
 			else
-				ModernWriteSettingDword(NULL,"CLC","GreyoutFlags",0);
+				db_set_dw(NULL,"CLC","GreyoutFlags",0);
 			}
 			/*						DBWriteContactSettingByte(NULL,"CLC","Meta",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_META)); // by FYR
 			DBWriteContactSettingByte(NULL,"CLC","MetaDoubleClick",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METADBLCLK)); // by FYR
 			DBWriteContactSettingByte(NULL,"CLC","MetaHideExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA)); // by FYR
 
 			*/
-			ModernWriteSettingByte(NULL,"CLC","ShowIdle",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_IDLE)?1:0));
-			ModernWriteSettingDword(NULL,"CLC","OfflineModes",MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS)));
+			db_set_b(NULL,"CLC","ShowIdle",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_IDLE)?1:0));
+			db_set_dw(NULL,"CLC","OfflineModes",MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS)));
 			//						DBWriteContactSettingByte(NULL,"CLC","LeftMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_GETPOS,0,0));
-			ModernWriteSettingWord(NULL,"CLC","ScrollTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_GETPOS,0,0));
-			ModernWriteSettingByte(NULL,"CLC","GroupIndent",(BYTE)SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_GETPOS,0,0));
-			ModernWriteSettingByte(NULL,"CLC","NoVScrollBar",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_NOSCROLLBAR)?1:0));
+			db_set_w(NULL,"CLC","ScrollTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_GETPOS,0,0));
+			db_set_b(NULL,"CLC","GroupIndent",(BYTE)SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_GETPOS,0,0));
+			db_set_b(NULL,"CLC","NoVScrollBar",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_NOSCROLLBAR)?1:0));
 
 
 			ClcOptionsChanged();
@@ -610,14 +610,14 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w
 	{
 	case WM_INITDIALOG:
 		TranslateDialogDefault(hwndDlg);
-		CheckDlgButton(hwndDlg,IDC_BITMAP,ModernGetSettingByte(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)?BST_CHECKED:BST_UNCHECKED);
+		CheckDlgButton(hwndDlg,IDC_BITMAP,db_get_b(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)?BST_CHECKED:BST_UNCHECKED);
 		SendMessage(hwndDlg,WM_USER+10,0,0);
 		SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_BKCOLOUR);
 		//		SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR));
 		SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_SELBKCOLOUR);
-		SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETCOLOUR,0,ModernGetSettingDword(NULL,"StatusBar","SelBkColour",CLCDEFAULT_SELBKCOLOUR));
+		SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_SETCOLOUR,0,db_get_dw(NULL,"StatusBar","SelBkColour",CLCDEFAULT_SELBKCOLOUR));
 		{	DBVARIANT dbv={0};
-		if (!ModernGetSettingString(NULL,"StatusBar","BkBitmap",&dbv)) {
+		if (!DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) {
 			SetDlgItemTextA(hwndDlg,IDC_FILENAME,dbv.pszVal);
 			if (ServiceExists(MS_UTILS_PATHTOABSOLUTE)) {
 				char szPath[MAX_PATH];
@@ -625,18 +625,18 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w
 				if (CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)dbv.pszVal, (LPARAM)szPath))
 					SetDlgItemTextA(hwndDlg,IDC_FILENAME,szPath);
 			}
-			ModernDBFreeVariant(&dbv);
+			db_free(&dbv);
 		}
 		}
 
-		CheckDlgButton(hwndDlg,IDC_HILIGHTMODE,ModernGetSettingByte(NULL,"StatusBar","HiLightMode",SETTING_SBHILIGHTMODE_DEFAULT)==0?BST_CHECKED:BST_UNCHECKED);
-		CheckDlgButton(hwndDlg,IDC_HILIGHTMODE1,ModernGetSettingByte(NULL,"StatusBar","HiLightMode",SETTING_SBHILIGHTMODE_DEFAULT)==1?BST_CHECKED:BST_UNCHECKED);
-		CheckDlgButton(hwndDlg,IDC_HILIGHTMODE2,ModernGetSettingByte(NULL,"StatusBar","HiLightMode",SETTING_SBHILIGHTMODE_DEFAULT)==2?BST_CHECKED:BST_UNCHECKED);
-		CheckDlgButton(hwndDlg,IDC_HILIGHTMODE3,ModernGetSettingByte(NULL,"StatusBar","HiLightMode",SETTING_SBHILIGHTMODE_DEFAULT)==3?BST_CHECKED:BST_UNCHECKED);
+		CheckDlgButton(hwndDlg,IDC_HILIGHTMODE,db_get_b(NULL,"StatusBar","HiLightMode",SETTING_SBHILIGHTMODE_DEFAULT)==0?BST_CHECKED:BST_UNCHECKED);
+		CheckDlgButton(hwndDlg,IDC_HILIGHTMODE1,db_get_b(NULL,"StatusBar","HiLightMode",SETTING_SBHILIGHTMODE_DEFAULT)==1?BST_CHECKED:BST_UNCHECKED);
+		CheckDlgButton(hwndDlg,IDC_HILIGHTMODE2,db_get_b(NULL,"StatusBar","HiLightMode",SETTING_SBHILIGHTMODE_DEFAULT)==2?BST_CHECKED:BST_UNCHECKED);
+		CheckDlgButton(hwndDlg,IDC_HILIGHTMODE3,db_get_b(NULL,"StatusBar","HiLightMode",SETTING_SBHILIGHTMODE_DEFAULT)==3?BST_CHECKED:BST_UNCHECKED);
 
 
 
-		{	WORD bmpUse=ModernGetSettingWord(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
+		{	WORD bmpUse=db_get_w(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
 		CheckDlgButton(hwndDlg,IDC_STRETCHH,bmpUse&CLB_STRETCHH?BST_CHECKED:BST_UNCHECKED);
 		CheckDlgButton(hwndDlg,IDC_STRETCHV,bmpUse&CLB_STRETCHV?BST_CHECKED:BST_UNCHECKED);
 		CheckDlgButton(hwndDlg,IDC_TILEH,bmpUse&CLBF_TILEH?BST_CHECKED:BST_UNCHECKED);
@@ -696,24 +696,24 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w
 
 
 
-			ModernWriteSettingByte(NULL,"StatusBar","UseBitmap",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BITMAP));
+			db_set_b(NULL,"StatusBar","UseBitmap",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BITMAP));
 			{	COLORREF col;
 			col=SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_GETCOLOUR,0,0);
-			if(col==CLCDEFAULT_BKCOLOUR) ModernDeleteSetting(NULL,"StatusBar","BkColour");
-			else ModernWriteSettingDword(NULL,"StatusBar","BkColour",col);
+			if(col==CLCDEFAULT_BKCOLOUR) db_unset(NULL,"StatusBar","BkColour");
+			else db_set_dw(NULL,"StatusBar","BkColour",col);
 			col=SendDlgItemMessage(hwndDlg,IDC_SELCOLOUR,CPM_GETCOLOUR,0,0);
-			if(col==CLCDEFAULT_SELBKCOLOUR) ModernDeleteSetting(NULL,"StatusBar","SelBkColour");
-			else ModernWriteSettingDword(NULL,"StatusBar","SelBkColour",col);
+			if(col==CLCDEFAULT_SELBKCOLOUR) db_unset(NULL,"StatusBar","SelBkColour");
+			else db_set_dw(NULL,"StatusBar","SelBkColour",col);
 			}
 			{
 				char str[MAX_PATH],strrel[MAX_PATH];
 				GetDlgItemTextA(hwndDlg,IDC_FILENAME,str,SIZEOF(str));
 				if (ServiceExists(MS_UTILS_PATHTORELATIVE)) {
 					if (CallService(MS_UTILS_PATHTORELATIVE, (WPARAM)str, (LPARAM)strrel))
-						ModernWriteSettingString(NULL,"StatusBar","BkBitmap",strrel);
-					else ModernWriteSettingString(NULL,"StatusBar","BkBitmap",str);
+						db_set_s(NULL,"StatusBar","BkBitmap",strrel);
+					else db_set_s(NULL,"StatusBar","BkBitmap",str);
 				}
-				else ModernWriteSettingString(NULL,"StatusBar","BkBitmap",str);
+				else db_set_s(NULL,"StatusBar","BkBitmap",str);
 
 			}
 			{	WORD flags=0;
@@ -725,7 +725,7 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w
 			if(IsDlgButtonChecked(hwndDlg,IDC_PROPORTIONAL)) flags|=CLBF_PROPORTIONAL;
 			if(IsDlgButtonChecked(hwndDlg,IDC_TILEVROWH)) flags|=CLBF_TILEVTOROWHEIGHT;
 
-			ModernWriteSettingWord(NULL,"StatusBar","BkBmpUse",flags);
+			db_set_w(NULL,"StatusBar","BkBmpUse",flags);
 			}
 			{
 				int hil=0;
@@ -733,7 +733,7 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w
 				if (IsDlgButtonChecked(hwndDlg,IDC_HILIGHTMODE2))  hil=2;
 				if (IsDlgButtonChecked(hwndDlg,IDC_HILIGHTMODE3))  hil=3;
 
-				ModernWriteSettingByte(NULL,"StatusBar","HiLightMode",(BYTE)hil);
+				db_set_b(NULL,"StatusBar","HiLightMode",(BYTE)hil);
 
 			}
 
@@ -771,16 +771,16 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
             TranslateDialogDefault(hwndDlg);
             SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED,hwndDlg,WM_USER+1));
 
-            CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, ModernGetSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-            CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, ModernGetSettingByte(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-            CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ModernGetSettingByte(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED);
-            CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, ModernGetSettingByte(NULL,"CList","ConfirmDelete",SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+            CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+            CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, db_get_b(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+            CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, db_get_b(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED);
+            CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, db_get_b(NULL,"CList","ConfirmDelete",SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 
-            CheckDlgButton(hwndDlg,IDC_GAMMACORRECT,ModernGetSettingByte(NULL,"CLC","GammaCorrect",CLCDEFAULT_GAMMACORRECT)?BST_CHECKED:BST_UNCHECKED);
-            CheckDlgButton(hwndDlg,IDC_HILIGHTMODE,ModernGetSettingByte(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT)==0?BST_CHECKED:BST_UNCHECKED);
-            CheckDlgButton(hwndDlg,IDC_HILIGHTMODE1,ModernGetSettingByte(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT)==1?BST_CHECKED:BST_UNCHECKED);
-            CheckDlgButton(hwndDlg,IDC_HILIGHTMODE2,ModernGetSettingByte(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT)==2?BST_CHECKED:BST_UNCHECKED);
-            CheckDlgButton(hwndDlg,IDC_HILIGHTMODE3,ModernGetSettingByte(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT)==3?BST_CHECKED:BST_UNCHECKED);
+            CheckDlgButton(hwndDlg,IDC_GAMMACORRECT,db_get_b(NULL,"CLC","GammaCorrect",CLCDEFAULT_GAMMACORRECT)?BST_CHECKED:BST_UNCHECKED);
+            CheckDlgButton(hwndDlg,IDC_HILIGHTMODE,db_get_b(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT)==0?BST_CHECKED:BST_UNCHECKED);
+            CheckDlgButton(hwndDlg,IDC_HILIGHTMODE1,db_get_b(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT)==1?BST_CHECKED:BST_UNCHECKED);
+            CheckDlgButton(hwndDlg,IDC_HILIGHTMODE2,db_get_b(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT)==2?BST_CHECKED:BST_UNCHECKED);
+            CheckDlgButton(hwndDlg,IDC_HILIGHTMODE3,db_get_b(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT)==3?BST_CHECKED:BST_UNCHECKED);
 
             int i, item;
             int s1, s2, s3;
@@ -794,9 +794,9 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
                 SendDlgItemMessage(hwndDlg,IDC_CLSORT3,CB_SETITEMDATA,item,(LPARAM)0);
 
             }
-            s1=ModernGetSettingByte(NULL,"CList","SortBy1",SETTING_SORTBY1_DEFAULT);
-            s2=ModernGetSettingByte(NULL,"CList","SortBy2",SETTING_SORTBY2_DEFAULT);
-            s3=ModernGetSettingByte(NULL,"CList","SortBy3",SETTING_SORTBY3_DEFAULT);
+            s1=db_get_b(NULL,"CList","SortBy1",SETTING_SORTBY1_DEFAULT);
+            s2=db_get_b(NULL,"CList","SortBy2",SETTING_SORTBY2_DEFAULT);
+            s3=db_get_b(NULL,"CList","SortBy3",SETTING_SORTBY3_DEFAULT);
 
             for (i=0; i<SIZEOF(sortby); i++)
             {
@@ -808,8 +808,8 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
                     SendDlgItemMessage(hwndDlg,IDC_CLSORT3,CB_SETCURSEL,i,0);
             }
 
-            CheckDlgButton(hwndDlg, IDC_NOOFFLINEMOVE, ModernGetSettingByte(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-            CheckDlgButton(hwndDlg, IDC_OFFLINETOROOT, ModernGetSettingByte(NULL,"CList","PlaceOfflineToRoot",SETTING_PLACEOFFLINETOROOT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+            CheckDlgButton(hwndDlg, IDC_NOOFFLINEMOVE, db_get_b(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+            CheckDlgButton(hwndDlg, IDC_OFFLINETOROOT, db_get_b(NULL,"CList","PlaceOfflineToRoot",SETTING_PLACEOFFLINETOROOT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
         }
 		return TRUE;
 	case WM_COMMAND:
@@ -825,17 +825,17 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
                 switch (((LPNMHDR)lParam)->code)
                 {
                 case PSN_APPLY:
-                    ModernWriteSettingByte(NULL,"CList","HideOffline",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEOFFLINE));
-                    ModernWriteSettingByte(NULL,"CList","HideEmptyGroups",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEEMPTYGROUPS));
-                    ModernWriteSettingByte(NULL,"CList","UseGroups",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_DISABLEGROUPS));
-                    ModernWriteSettingByte(NULL,"CList","ConfirmDelete",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CONFIRMDELETE));
+                    db_set_b(NULL,"CList","HideOffline",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEOFFLINE));
+                    db_set_b(NULL,"CList","HideEmptyGroups",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEEMPTYGROUPS));
+                    db_set_b(NULL,"CList","UseGroups",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_DISABLEGROUPS));
+                    db_set_b(NULL,"CList","ConfirmDelete",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CONFIRMDELETE));
 
-                    ModernWriteSettingByte(NULL,"CLC","GammaCorrect",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_GAMMACORRECT));
+                    db_set_b(NULL,"CLC","GammaCorrect",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_GAMMACORRECT));
                     int hil=0;
                     if (IsDlgButtonChecked(hwndDlg,IDC_HILIGHTMODE1))  hil=1;
                     if (IsDlgButtonChecked(hwndDlg,IDC_HILIGHTMODE2))  hil=2;
                     if (IsDlgButtonChecked(hwndDlg,IDC_HILIGHTMODE3))  hil=3;
-                    ModernWriteSettingByte(NULL,"CLC","HiLightMode",(BYTE)hil);
+                    db_set_b(NULL,"CLC","HiLightMode",(BYTE)hil);
 
                     int s1=SendDlgItemMessage(hwndDlg,IDC_CLSORT1,CB_GETCURSEL,0,0);
                     int s2=SendDlgItemMessage(hwndDlg,IDC_CLSORT2,CB_GETCURSEL,0,0);
@@ -843,12 +843,12 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
                     if (s1>=0) s1=sortbyValue[s1];
                     if (s2>=0) s2=sortbyValue[s2];
                     if (s3>=0) s3=sortbyValue[s3];
-                    ModernWriteSettingByte(NULL,"CList","SortBy1",(BYTE)s1);
-                    ModernWriteSettingByte(NULL,"CList","SortBy2",(BYTE)s2);
-                    ModernWriteSettingByte(NULL,"CList","SortBy3",(BYTE)s3);
+                    db_set_b(NULL,"CList","SortBy1",(BYTE)s1);
+                    db_set_b(NULL,"CList","SortBy2",(BYTE)s2);
+                    db_set_b(NULL,"CList","SortBy3",(BYTE)s3);
 
-                    ModernWriteSettingByte(NULL,"CList","NoOfflineBottom",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_NOOFFLINEMOVE));
-                    ModernWriteSettingByte(NULL,"CList","PlaceOfflineToRoot",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_OFFLINETOROOT));
+                    db_set_b(NULL,"CList","NoOfflineBottom",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_NOOFFLINEMOVE));
+                    db_set_b(NULL,"CList","PlaceOfflineToRoot",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_OFFLINETOROOT));
 
                     pcli->pfnLoadContactTree(); /* this won't do job properly since it only really works when changes happen */
                     SendMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0); /* force reshuffle */
@@ -872,11 +872,11 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
     case WM_INITDIALOG:
         {
             TranslateDialogDefault(hwndDlg);
-            CheckDlgButton(hwndDlg, IDC_NOOFFLINEMOVE, ModernGetSettingByte( NULL,"CList", "NoOfflineBottom",    SETTING_NOOFFLINEBOTTOM_DEFAULT ) ? BST_CHECKED : BST_UNCHECKED);
-            CheckDlgButton(hwndDlg, IDC_OFFLINETOROOT, ModernGetSettingByte( NULL,"CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT ) ? BST_CHECKED : BST_UNCHECKED);
-			CheckDlgButton(hwndDlg, IDC_ONECLK,        ModernGetSettingByte( NULL,"CList", "Tray1Click",         SETTING_TRAY1CLICK_DEFAULT ) ? BST_CHECKED : BST_UNCHECKED);
+            CheckDlgButton(hwndDlg, IDC_NOOFFLINEMOVE, db_get_b( NULL,"CList", "NoOfflineBottom",    SETTING_NOOFFLINEBOTTOM_DEFAULT ) ? BST_CHECKED : BST_UNCHECKED);
+            CheckDlgButton(hwndDlg, IDC_OFFLINETOROOT, db_get_b( NULL,"CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT ) ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_ONECLK,        db_get_b( NULL,"CList", "Tray1Click",         SETTING_TRAY1CLICK_DEFAULT ) ? BST_CHECKED : BST_UNCHECKED);
             {
-                BYTE trayOption=ModernGetSettingByte(NULL,"CLUI","XStatusTray",SETTING_TRAYOPTION_DEFAULT);
+                BYTE trayOption=db_get_b(NULL,"CLUI","XStatusTray",SETTING_TRAYOPTION_DEFAULT);
                 CheckDlgButton(hwndDlg, IDC_SHOWXSTATUS, (trayOption&3) ? BST_CHECKED : BST_UNCHECKED);
                 CheckDlgButton(hwndDlg, IDC_SHOWNORMAL,  (trayOption&2) ? BST_CHECKED : BST_UNCHECKED);
                 CheckDlgButton(hwndDlg, IDC_TRANSPARENTOVERLAY, (trayOption&4) ? BST_CHECKED : BST_UNCHECKED);
@@ -885,17 +885,17 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
                 EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)&&IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL));
 
             }
-            CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, ModernGetSettingByte(NULL,"CList","AlwaysStatus",SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+            CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, db_get_b(NULL,"CList","AlwaysStatus",SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 
-            CheckDlgButton(hwndDlg, IDC_ALWAYSPRIMARY, !ModernGetSettingByte(NULL,"CList","AlwaysPrimary",SETTING_ALWAYSPRIMARY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+            CheckDlgButton(hwndDlg, IDC_ALWAYSPRIMARY, !db_get_b(NULL,"CList","AlwaysPrimary",SETTING_ALWAYSPRIMARY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 
-            CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !ModernGetSettingByte(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-            CheckDlgButton(hwndDlg, IDC_DONTCYCLE, ModernGetSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT)==SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
-            CheckDlgButton(hwndDlg, IDC_CYCLE, ModernGetSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT)==SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
-            CheckDlgButton(hwndDlg, IDC_MULTITRAY, ModernGetSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT)==SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
-            CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, ModernGetSettingByte(NULL,"CList","DisableTrayFlash",SETTING_DISABLETRAYFLASH_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
-            CheckDlgButton(hwndDlg, IDC_SHOW_AVATARS, ModernGetSettingByte(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-            CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, ModernGetSettingByte(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP)&&!g_CluiData.fGDIPlusFail)) == 1 ? BST_CHECKED : BST_UNCHECKED );
+            CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !db_get_b(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+            CheckDlgButton(hwndDlg, IDC_DONTCYCLE, db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT)==SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
+            CheckDlgButton(hwndDlg, IDC_CYCLE, db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT)==SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
+            CheckDlgButton(hwndDlg, IDC_MULTITRAY, db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT)==SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
+            CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, db_get_b(NULL,"CList","DisableTrayFlash",SETTING_DISABLETRAYFLASH_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
+            CheckDlgButton(hwndDlg, IDC_SHOW_AVATARS, db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+            CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP)&&!g_CluiData.fGDIPlusFail)) == 1 ? BST_CHECKED : BST_UNCHECKED );
 
             if(IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)) {
                 EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIMESPIN),FALSE);
@@ -914,12 +914,12 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
                 EnableWindow(GetDlgItem(hwndDlg,IDC_ALWAYSPRIMARY),FALSE);
             }
             SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_SETRANGE,0,MAKELONG(120,1));
-            SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"CList","CycleTime",SETTING_CYCLETIME_DEFAULT),0));
+            SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","CycleTime",SETTING_CYCLETIME_DEFAULT),0));
             {
                 int i,count,item;
                 PROTOACCOUNT **accs;
                 DBVARIANT dbv={DBVT_DELETED};
-                ModernGetSetting(NULL,"CList","PrimaryStatus",&dbv);
+                db_get(NULL,"CList","PrimaryStatus",&dbv);
                 ProtoEnumAccounts( &count, &accs );
                 item=SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_ADDSTRING,0,(LPARAM)TranslateT("Global"));
                 SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETITEMDATA,item,(LPARAM)0);
@@ -932,13 +932,13 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
                     if ((dbv.type==DBVT_ASCIIZ || dbv.type==DBVT_UTF8)&& !strcmp(dbv.pszVal,accs[i]->szModuleName))
                         SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETCURSEL,item,0);
                 }
-                ModernDBFreeVariant(&dbv);
+                db_free(&dbv);
             }
             if (-1==(int)SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETCURSEL,0,0))
                 SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETCURSEL,0,0);
             SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_BLINKTIME),0);		// set buddy
             SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETRANGE,0,MAKELONG(0x3FFF,250));
-            SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"CList","IconFlashTime",SETTING_ICONFLASHTIME_DEFAULT),0));
+            SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","IconFlashTime",SETTING_ICONFLASHTIME_DEFAULT),0));
             {
                 int i=_GetNetVisibleProtoCount();
                 if (i<2)
@@ -984,35 +984,35 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
                 switch (((LPNMHDR)lParam)->code)
                 {
                 case PSN_APPLY:
-                    ModernWriteSettingByte(NULL,"CList","Tray1Click",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONECLK));
-                    ModernWriteSettingByte(NULL,"CList","AlwaysStatus",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALWAYSSTATUS));
+                    db_set_b(NULL,"CList","Tray1Click",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONECLK));
+                    db_set_b(NULL,"CList","AlwaysStatus",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALWAYSSTATUS));
 
-                    ModernWriteSettingByte(NULL,"CList","AlwaysMulti",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_ALWAYSMULTI));
-                    ModernWriteSettingByte(NULL,"CList","AlwaysPrimary",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_ALWAYSPRIMARY));
+                    db_set_b(NULL,"CList","AlwaysMulti",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_ALWAYSMULTI));
+                    db_set_b(NULL,"CList","AlwaysPrimary",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_ALWAYSPRIMARY));
 
-                    ModernWriteSettingWord(NULL,"CList","CycleTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_GETPOS,0,0));
-                    ModernWriteSettingWord(NULL,"CList","IconFlashTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_GETPOS,0,0));
-                    ModernWriteSettingByte(NULL,"CList","DisableTrayFlash",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DISABLEBLINK));
+                    db_set_w(NULL,"CList","CycleTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_CYCLETIMESPIN,UDM_GETPOS,0,0));
+                    db_set_w(NULL,"CList","IconFlashTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_GETPOS,0,0));
+                    db_set_b(NULL,"CList","DisableTrayFlash",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DISABLEBLINK));
 
 
                     if (_GetNetVisibleProtoCount()>1)
-                        ModernWriteSettingByte(NULL,"CList","TrayIcon",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)?SETTING_TRAYICON_SINGLE:(IsDlgButtonChecked(hwndDlg,IDC_CYCLE)?SETTING_TRAYICON_CYCLE:SETTING_TRAYICON_MULTI)));
+                        db_set_b(NULL,"CList","TrayIcon",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)?SETTING_TRAYICON_SINGLE:(IsDlgButtonChecked(hwndDlg,IDC_CYCLE)?SETTING_TRAYICON_CYCLE:SETTING_TRAYICON_MULTI)));
 
                     {
                         BYTE xOptions=0;
                         xOptions=IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)?1:0;
                         xOptions|=(xOptions && IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL))?2:0;
                         xOptions|=(xOptions && IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENTOVERLAY))?4:0;
-                        ModernWriteSettingByte(NULL,"CLUI","XStatusTray",xOptions);
+                        db_set_b(NULL,"CLUI","XStatusTray",xOptions);
                     }
 
                     {
                         int cursel = SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETCURSEL,0,0);
                         PROTOACCOUNT* pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETITEMDATA,cursel,0);
                         if ( !pa )
-                            ModernDeleteSetting(NULL, "CList","PrimaryStatus");
+                            db_unset(NULL, "CList","PrimaryStatus");
                         else
-                            ModernWriteSettingString(NULL,"CList","PrimaryStatus", pa->szModuleName);
+                            db_set_s(NULL,"CList","PrimaryStatus", pa->szModuleName);
                     }
                     pcli->pfnTrayIconIconsChanged();
                     pcli->pfnLoadContactTree(); /* this won't do job properly since it only really works when changes happen */
@@ -1048,28 +1048,28 @@ static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM
 	case WM_INITDIALOG:
 
 		TranslateDialogDefault(hwndDlg);
-		CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, ModernGetSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-		CheckDlgButton(hwndDlg, IDC_DRAGTOSCROLL, (ModernGetSettingByte(NULL,"CLUI","DragToScroll",SETTING_DRAGTOSCROLL_DEFAULT)&&!ModernGetSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_DRAGTOSCROLL, (db_get_b(NULL,"CLUI","DragToScroll",SETTING_DRAGTOSCROLL_DEFAULT)&&!db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) ? BST_CHECKED : BST_UNCHECKED);
 		CheckDlgButton(hwndDlg, IDC_AUTOSIZE, g_CluiData.fAutoSize ? BST_CHECKED : BST_UNCHECKED);
-		CheckDlgButton(hwndDlg, IDC_LOCKSIZING, ModernGetSettingByte(NULL,"CLUI","LockSize",SETTING_LOCKSIZE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-		CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, ModernGetSettingByte(NULL,"CList","BringToFront",SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_LOCKSIZING, db_get_b(NULL,"CLUI","LockSize",SETTING_LOCKSIZE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, db_get_b(NULL,"CList","BringToFront",SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 
 
 		SendDlgItemMessage(hwndDlg,IDC_MAXSIZESPIN,UDM_SETRANGE,0,MAKELONG(100,0));
-		SendDlgItemMessage(hwndDlg,IDC_MAXSIZESPIN,UDM_SETPOS,0,ModernGetSettingByte(NULL,"CLUI","MaxSizeHeight",SETTING_MAXSIZEHEIGHT_DEFAULT));
+		SendDlgItemMessage(hwndDlg,IDC_MAXSIZESPIN,UDM_SETPOS,0,db_get_b(NULL,"CLUI","MaxSizeHeight",SETTING_MAXSIZEHEIGHT_DEFAULT));
 		SendDlgItemMessage(hwndDlg,IDC_MINSIZESPIN,UDM_SETRANGE,0,MAKELONG(100,0));
-		SendDlgItemMessage(hwndDlg,IDC_MINSIZESPIN,UDM_SETPOS,0,ModernGetSettingByte(NULL,"CLUI","MinSizeHeight",SETTING_MINSIZEHEIGHT_DEFAULT));
-		CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, ModernGetSettingByte(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-		CheckDlgButton(hwndDlg, IDC_SNAPTOEDGES, ModernGetSettingByte(NULL,"CLUI","SnapToEdges",SETTING_SNAPTOEDGES_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-		CheckDlgButton(hwndDlg, IDC_DOCKTOSIDES, ModernGetSettingByte(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+		SendDlgItemMessage(hwndDlg,IDC_MINSIZESPIN,UDM_SETPOS,0,db_get_b(NULL,"CLUI","MinSizeHeight",SETTING_MINSIZEHEIGHT_DEFAULT));
+		CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, db_get_b(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_SNAPTOEDGES, db_get_b(NULL,"CLUI","SnapToEdges",SETTING_SNAPTOEDGES_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_DOCKTOSIDES, db_get_b(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 
-		CheckDlgButton(hwndDlg, IDC_EVENTAREA_NONE, ModernGetSettingByte(NULL,"CLUI","EventArea",SETTING_EVENTAREAMODE_DEFAULT)==0 ? BST_CHECKED : BST_UNCHECKED);
-		CheckDlgButton(hwndDlg, IDC_EVENTAREA, ModernGetSettingByte(NULL,"CLUI","EventArea",SETTING_EVENTAREAMODE_DEFAULT)==1 ? BST_CHECKED : BST_UNCHECKED);
-		CheckDlgButton(hwndDlg, IDC_EVENTAREA_ALWAYS, ModernGetSettingByte(NULL,"CLUI","EventArea",SETTING_EVENTAREAMODE_DEFAULT)==2 ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_EVENTAREA_NONE, db_get_b(NULL,"CLUI","EventArea",SETTING_EVENTAREAMODE_DEFAULT)==0 ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_EVENTAREA, db_get_b(NULL,"CLUI","EventArea",SETTING_EVENTAREAMODE_DEFAULT)==1 ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_EVENTAREA_ALWAYS, db_get_b(NULL,"CLUI","EventArea",SETTING_EVENTAREAMODE_DEFAULT)==2 ? BST_CHECKED : BST_UNCHECKED);
 
-		CheckDlgButton(hwndDlg, IDC_AUTOHIDE, ModernGetSettingByte(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_AUTOHIDE, db_get_b(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 		SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETRANGE,0,MAKELONG(900,1));
-		SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),0));
+		SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),0));
 		EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE));
 		EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE));
 		EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC01),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE));
@@ -1079,15 +1079,15 @@ static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM
 			for (i=0; i<SIZEOF(hidemode); i++) {
 				item=SendDlgItemMessage(hwndDlg,IDC_HIDEMETHOD,CB_ADDSTRING,0,(LPARAM)(hidemode[i]));
 				SendDlgItemMessage(hwndDlg,IDC_HIDEMETHOD,CB_SETITEMDATA,item,(LPARAM)0);
-				SendDlgItemMessage(hwndDlg,IDC_HIDEMETHOD,CB_SETCURSEL,ModernGetSettingByte(NULL,"ModernData","HideBehind",SETTING_HIDEBEHIND_DEFAULT),0);
+				SendDlgItemMessage(hwndDlg,IDC_HIDEMETHOD,CB_SETCURSEL,db_get_b(NULL,"ModernData","HideBehind",SETTING_HIDEBEHIND_DEFAULT),0);
 			}
 		}
 		SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN2,UDM_SETRANGE,0,MAKELONG(600,0));
-		SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN2,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"ModernData","ShowDelay",SETTING_SHOWDELAY_DEFAULT),0));
+		SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN2,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"ModernData","ShowDelay",SETTING_SHOWDELAY_DEFAULT),0));
 		SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN3,UDM_SETRANGE,0,MAKELONG(600,0));
-		SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN3,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"ModernData","HideDelay",SETTING_HIDEDELAY_DEFAULT),0));
+		SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN3,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"ModernData","HideDelay",SETTING_HIDEDELAY_DEFAULT),0));
 		SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN4,UDM_SETRANGE,0,MAKELONG(50,1));
-		SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN4,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"ModernData","HideBehindBorderSize",SETTING_HIDEBEHINDBORDERSIZE_DEFAULT),0));
+		SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN4,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"ModernData","HideBehindBorderSize",SETTING_HIDEBEHINDBORDERSIZE_DEFAULT),0));
 		{
 			int mode=SendDlgItemMessage(hwndDlg,IDC_HIDEMETHOD,CB_GETCURSEL,0,0);
 			EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWDELAY),mode!=0);
@@ -1170,29 +1170,29 @@ static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM
 			//	DBWriteContactSettingByte(NULL,"ModernData","EnableLayering",0);
 			//else
 			//	DBDeleteContactSetting(NULL,"ModernData","EnableLayering");
-			ModernWriteSettingByte(NULL,"ModernData","HideBehind",(BYTE)SendDlgItemMessage(hwndDlg,IDC_HIDEMETHOD,CB_GETCURSEL,0,0));
-			ModernWriteSettingWord(NULL,"ModernData","ShowDelay",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN2,UDM_GETPOS,0,0));
-			ModernWriteSettingWord(NULL,"ModernData","HideDelay",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN3,UDM_GETPOS,0,0));
-			ModernWriteSettingWord(NULL,"ModernData","HideBehindBorderSize",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN4,UDM_GETPOS,0,0));
+			db_set_b(NULL,"ModernData","HideBehind",(BYTE)SendDlgItemMessage(hwndDlg,IDC_HIDEMETHOD,CB_GETCURSEL,0,0));
+			db_set_w(NULL,"ModernData","ShowDelay",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN2,UDM_GETPOS,0,0));
+			db_set_w(NULL,"ModernData","HideDelay",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN3,UDM_GETPOS,0,0));
+			db_set_w(NULL,"ModernData","HideBehindBorderSize",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN4,UDM_GETPOS,0,0));
 
-			ModernWriteSettingByte(NULL,"CLUI","DragToScroll",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DRAGTOSCROLL));
-			ModernWriteSettingByte(NULL,"CList","BringToFront",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BRINGTOFRONT));
+			db_set_b(NULL,"CLUI","DragToScroll",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DRAGTOSCROLL));
+			db_set_b(NULL,"CList","BringToFront",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BRINGTOFRONT));
 			g_mutex_bChangingMode=TRUE;
-			ModernWriteSettingByte(NULL,"CLUI","ClientAreaDrag",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CLIENTDRAG));
-			ModernWriteSettingByte(NULL,"CLUI","AutoSize",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE));
-			ModernWriteSettingByte(NULL,"CLUI","LockSize",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_LOCKSIZING));
-			ModernWriteSettingByte(NULL,"CLUI","MaxSizeHeight",(BYTE)GetDlgItemInt(hwndDlg,IDC_MAXSIZEHEIGHT,NULL,FALSE));
-			ModernWriteSettingByte(NULL,"CLUI","MinSizeHeight",(BYTE)GetDlgItemInt(hwndDlg,IDC_MINSIZEHEIGHT,NULL,FALSE));
-			ModernWriteSettingByte(NULL,"CLUI","AutoSizeUpward",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZEUPWARD));
-			ModernWriteSettingByte(NULL,"CLUI","SnapToEdges",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SNAPTOEDGES));
+			db_set_b(NULL,"CLUI","ClientAreaDrag",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CLIENTDRAG));
+			db_set_b(NULL,"CLUI","AutoSize",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE));
+			db_set_b(NULL,"CLUI","LockSize",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_LOCKSIZING));
+			db_set_b(NULL,"CLUI","MaxSizeHeight",(BYTE)GetDlgItemInt(hwndDlg,IDC_MAXSIZEHEIGHT,NULL,FALSE));
+			db_set_b(NULL,"CLUI","MinSizeHeight",(BYTE)GetDlgItemInt(hwndDlg,IDC_MINSIZEHEIGHT,NULL,FALSE));
+			db_set_b(NULL,"CLUI","AutoSizeUpward",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZEUPWARD));
+			db_set_b(NULL,"CLUI","SnapToEdges",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SNAPTOEDGES));
 
-			ModernWriteSettingByte(NULL,"CLUI","DockToSides",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DOCKTOSIDES));
+			db_set_b(NULL,"CLUI","DockToSides",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DOCKTOSIDES));
 
-			ModernWriteSettingByte(NULL,"CLUI","EventArea",
+			db_set_b(NULL,"CLUI","EventArea",
 				(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_EVENTAREA_ALWAYS)?2:(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EVENTAREA)?1:0));
 
-			ModernWriteSettingByte(NULL,"CList","AutoHide",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE));
-			ModernWriteSettingWord(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0));
+			db_set_b(NULL,"CList","AutoHide",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE));
+			db_set_w(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0));
 			CLUI_ChangeWindowMode();
 			SendMessage(pcli->hwndContactTree,WM_SIZE,0,0);	//forces it to send a cln_listsizechanged
 			CLUI_ReloadCLUIOptions();
@@ -1215,7 +1215,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP
 
 		TranslateDialogDefault(hwndDlg);
 		g_hCLUIOptionsWnd=hwndDlg;
-		CheckDlgButton(hwndDlg, IDC_ONTOP, ModernGetSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 		{	// ====== Activate/Deactivate Non-Layered items =======
 			fEnabled=!g_CluiData.fLayered || g_CluiData.fDisableSkinEngine;
 			EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),fEnabled);
@@ -1231,14 +1231,14 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP
 			EnableWindow(GetDlgItem(hwndDlg,IDC_ROUNDCORNERS),fEnabled);
 		}
 		{   // ====== Non-Layered Mode =====
-			CheckDlgButton(hwndDlg, IDC_TOOLWND, ModernGetSettingByte(NULL,"CList","ToolWindow",SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-			CheckDlgButton(hwndDlg, IDC_MIN2TRAY, ModernGetSettingByte(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-			CheckDlgButton(hwndDlg, IDC_BORDER, ModernGetSettingByte(NULL,"CList","ThinBorder",SETTING_THINBORDER_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-			CheckDlgButton(hwndDlg, IDC_NOBORDERWND, ModernGetSettingByte(NULL,"CList","NoBorder",SETTING_NOBORDER_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_TOOLWND, db_get_b(NULL,"CList","ToolWindow",SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_MIN2TRAY, db_get_b(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_BORDER, db_get_b(NULL,"CList","ThinBorder",SETTING_THINBORDER_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_NOBORDERWND, db_get_b(NULL,"CList","NoBorder",SETTING_NOBORDER_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 			if(IsDlgButtonChecked(hwndDlg,IDC_TOOLWND))
 				EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),FALSE);
-			CheckDlgButton(hwndDlg, IDC_SHOWCAPTION, ModernGetSettingByte(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-			CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, ModernGetSettingByte(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_SHOWCAPTION, db_get_b(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, db_get_b(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 			//EnableWindow(GetDlgItem(hwndDlg,IDC_CLIENTDRAG),!IsDlgButtonChecked(hwndDlg,IDC_DRAGTOSCROLL));
 			if (!IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION))
 			{
@@ -1253,64 +1253,64 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP
 				EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),FALSE);
 				EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWCAPTION),FALSE);
 			}
-			CheckDlgButton(hwndDlg, IDC_DROPSHADOW, ModernGetSettingByte(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-			CheckDlgButton(hwndDlg, IDC_ROUNDCORNERS, ModernGetSettingByte(NULL,"CLC","RoundCorners",SETTING_ROUNDCORNERS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_DROPSHADOW, db_get_b(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_ROUNDCORNERS, db_get_b(NULL,"CLC","RoundCorners",SETTING_ROUNDCORNERS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 		}   // ====== End of Non-Layered Mode =====
 
-		CheckDlgButton(hwndDlg, IDC_FADEINOUT, ModernGetSettingByte(NULL,"CLUI","FadeInOut",SETTING_FADEIN_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-		CheckDlgButton(hwndDlg, IDC_ONDESKTOP, ModernGetSettingByte(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_FADEINOUT, db_get_b(NULL,"CLUI","FadeInOut",SETTING_FADEIN_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_ONDESKTOP, db_get_b(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 		SendDlgItemMessage(hwndDlg,IDC_FRAMESSPIN,UDM_SETRANGE,0,MAKELONG(50,0));
 		SendDlgItemMessage(hwndDlg,IDC_CAPTIONSSPIN,UDM_SETRANGE,0,MAKELONG(50,0));
-		SendDlgItemMessage(hwndDlg,IDC_FRAMESSPIN,UDM_SETPOS,0,ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT));
-		SendDlgItemMessage(hwndDlg,IDC_CAPTIONSSPIN,UDM_SETPOS,0,ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT));
+		SendDlgItemMessage(hwndDlg,IDC_FRAMESSPIN,UDM_SETPOS,0,db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT));
+		SendDlgItemMessage(hwndDlg,IDC_CAPTIONSSPIN,UDM_SETPOS,0,db_get_dw(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT));
 		SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETRANGE,0,MAKELONG(250,0));
 		SendDlgItemMessage(hwndDlg,IDC_RIGHTMARGINSPIN,UDM_SETRANGE,0,MAKELONG(250,0));
 		SendDlgItemMessage(hwndDlg,IDC_TOPMARGINSPIN,UDM_SETRANGE,0,MAKELONG(250,0));
 		SendDlgItemMessage(hwndDlg,IDC_BOTTOMMARGINSPIN,UDM_SETRANGE,0,MAKELONG(250,0));
-		SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETPOS,0,ModernGetSettingByte(NULL,"CLUI","LeftClientMargin",SETTING_LEFTCLIENTMARIGN_DEFAULT));
-		SendDlgItemMessage(hwndDlg,IDC_RIGHTMARGINSPIN,UDM_SETPOS,0,ModernGetSettingByte(NULL,"CLUI","RightClientMargin",SETTING_RIGHTCLIENTMARIGN_DEFAULT));
-		SendDlgItemMessage(hwndDlg,IDC_TOPMARGINSPIN,UDM_SETPOS,0,ModernGetSettingByte(NULL,"CLUI","TopClientMargin",SETTING_TOPCLIENTMARIGN_DEFAULT));
-		SendDlgItemMessage(hwndDlg,IDC_BOTTOMMARGINSPIN,UDM_SETPOS,0,ModernGetSettingByte(NULL,"CLUI","BottomClientMargin",SETTING_BOTTOMCLIENTMARIGN_DEFAULT));
+		SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETPOS,0,db_get_b(NULL,"CLUI","LeftClientMargin",SETTING_LEFTCLIENTMARIGN_DEFAULT));
+		SendDlgItemMessage(hwndDlg,IDC_RIGHTMARGINSPIN,UDM_SETPOS,0,db_get_b(NULL,"CLUI","RightClientMargin",SETTING_RIGHTCLIENTMARIGN_DEFAULT));
+		SendDlgItemMessage(hwndDlg,IDC_TOPMARGINSPIN,UDM_SETPOS,0,db_get_b(NULL,"CLUI","TopClientMargin",SETTING_TOPCLIENTMARIGN_DEFAULT));
+		SendDlgItemMessage(hwndDlg,IDC_BOTTOMMARGINSPIN,UDM_SETPOS,0,db_get_b(NULL,"CLUI","BottomClientMargin",SETTING_BOTTOMCLIENTMARIGN_DEFAULT));
 
-		CheckDlgButton(hwndDlg, IDC_DISABLEENGINE, ModernGetSettingByte(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-		CheckDlgButton(hwndDlg, IDC_AEROGLASS, ModernGetSettingByte(NULL,"ModernData","AeroGlass",SETTING_AEROGLASS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_DISABLEENGINE, db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+		CheckDlgButton(hwndDlg, IDC_AEROGLASS, db_get_b(NULL,"ModernData","AeroGlass",SETTING_AEROGLASS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 
-		EnableWindow(GetDlgItem(hwndDlg,IDC_LAYERENGINE),(g_proc_UpdateLayeredWindow!=NULL && !ModernGetSettingByte(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT))?TRUE:FALSE);
-		CheckDlgButton(hwndDlg, IDC_LAYERENGINE, ((ModernGetSettingByte(NULL,"ModernData","EnableLayering",SETTING_ENABLELAYERING_DEFAULT)&&g_proc_UpdateLayeredWindow!=NULL) && !ModernGetSettingByte(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT)) ? BST_UNCHECKED:BST_CHECKED);
+		EnableWindow(GetDlgItem(hwndDlg,IDC_LAYERENGINE),(g_proc_UpdateLayeredWindow!=NULL && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT))?TRUE:FALSE);
+		CheckDlgButton(hwndDlg, IDC_LAYERENGINE, ((db_get_b(NULL,"ModernData","EnableLayering",SETTING_ENABLELAYERING_DEFAULT)&&g_proc_UpdateLayeredWindow!=NULL) && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT)) ? BST_UNCHECKED:BST_CHECKED);
 
 		{
 			DBVARIANT dbv={0};
 			TCHAR *s=NULL;
 			char szUin[20];
-			if (!ModernGetSettingTString(NULL,"CList","TitleText",&dbv))
+			if (!DBGetContactSettingTString(NULL,"CList","TitleText",&dbv))
 				s=mir_tstrdup(dbv.ptszVal);
 			else
 				s=mir_tstrdup(_T(MIRANDANAME));
 			//dbv.pszVal=s;
 			SetDlgItemText(hwndDlg,IDC_TITLETEXT,s);
 			if (s) mir_free_and_nill(s);
-			ModernDBFreeVariant(&dbv);
+			db_free(&dbv);
 			//if (s) mir_free_and_nill(s);
 			SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)MIRANDANAME);
-			sprintf(szUin,"%u",ModernGetSettingDword(NULL,"ICQ","UIN",0));
+			sprintf(szUin,"%u",db_get_dw(NULL,"ICQ","UIN",0));
 			SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)szUin);
 
-			if (!ModernGetSettingString(NULL,"ICQ","Nick",&dbv)) {
+			if (!DBGetContactSettingString(NULL,"ICQ","Nick",&dbv)) {
 				SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal);
 				//mir_free_and_nill(dbv.pszVal);
-				ModernDBFreeVariant(&dbv);
+				db_free(&dbv);
 				dbv.pszVal=NULL;
 			}
-			if (!ModernGetSettingString(NULL,"ICQ","FirstName",&dbv)) {
+			if (!DBGetContactSettingString(NULL,"ICQ","FirstName",&dbv)) {
 				SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal);
 				//mir_free_and_nill(dbv.pszVal);
-				ModernDBFreeVariant(&dbv);
+				db_free(&dbv);
 				dbv.pszVal=NULL;
 			}
-			if (!ModernGetSettingString(NULL,"ICQ","e-mail",&dbv)) {
+			if (!DBGetContactSettingString(NULL,"ICQ","e-mail",&dbv)) {
 				SendDlgItemMessage(hwndDlg,IDC_TITLETEXT,CB_ADDSTRING,0,(LPARAM)dbv.pszVal);
 				//mir_free_and_nill(dbv.pszVal);
-				ModernDBFreeVariant(&dbv);
+				db_free(&dbv);
 				dbv.pszVal=NULL;
 			}
 		}
@@ -1319,7 +1319,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP
 			EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENT),FALSE);
 			EnableWindow(GetDlgItem(hwndDlg,IDC_DROPSHADOW),FALSE);
 		}
-		else CheckDlgButton(hwndDlg,IDC_TRANSPARENT,ModernGetSettingByte(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)?BST_CHECKED:BST_UNCHECKED);
+		else CheckDlgButton(hwndDlg,IDC_TRANSPARENT,db_get_b(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)?BST_CHECKED:BST_UNCHECKED);
 		if (!IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)) {
 			EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC11),FALSE);
 			EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC12),FALSE);
@@ -1330,8 +1330,8 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP
 		}
 		SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_SETRANGE,FALSE,MAKELONG(1,255));
 		SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_SETRANGE,FALSE,MAKELONG(1,255));
-		SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_SETPOS,TRUE,ModernGetSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT));
-		SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_SETPOS,TRUE,ModernGetSettingByte(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT));
+		SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_SETPOS,TRUE,db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT));
+		SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_SETPOS,TRUE,db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT));
 		SendMessage(hwndDlg,WM_HSCROLL,0x12345678,0);
 		return TRUE;
 
@@ -1413,40 +1413,40 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP
 		{
 		case PSN_APPLY:
 			{
-				ModernWriteSettingByte(NULL,"CLUI","LeftClientMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_GETPOS,0,0));
-				ModernWriteSettingByte(NULL,"CLUI","RightClientMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_RIGHTMARGINSPIN,UDM_GETPOS,0,0));
-				ModernWriteSettingByte(NULL,"CLUI","TopClientMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TOPMARGINSPIN,UDM_GETPOS,0,0));
-				ModernWriteSettingByte(NULL,"CLUI","BottomClientMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_BOTTOMMARGINSPIN,UDM_GETPOS,0,0));
-				ModernWriteSettingByte(NULL,"ModernData","DisableEngine",IsDlgButtonChecked(hwndDlg,IDC_DISABLEENGINE));
-				ModernWriteSettingByte(NULL,"ModernData","AeroGlass",IsDlgButtonChecked(hwndDlg,IDC_AEROGLASS));
+				db_set_b(NULL,"CLUI","LeftClientMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_GETPOS,0,0));
+				db_set_b(NULL,"CLUI","RightClientMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_RIGHTMARGINSPIN,UDM_GETPOS,0,0));
+				db_set_b(NULL,"CLUI","TopClientMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TOPMARGINSPIN,UDM_GETPOS,0,0));
+				db_set_b(NULL,"CLUI","BottomClientMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_BOTTOMMARGINSPIN,UDM_GETPOS,0,0));
+				db_set_b(NULL,"ModernData","DisableEngine",IsDlgButtonChecked(hwndDlg,IDC_DISABLEENGINE));
+				db_set_b(NULL,"ModernData","AeroGlass",IsDlgButtonChecked(hwndDlg,IDC_AEROGLASS));
 				if (!IsDlgButtonChecked(hwndDlg,IDC_DISABLEENGINE))
 				{
 					if (g_proc_UpdateLayeredWindow!=NULL && IsDlgButtonChecked(hwndDlg,IDC_LAYERENGINE))
-						ModernWriteSettingByte(NULL,"ModernData","EnableLayering",0);
+						db_set_b(NULL,"ModernData","EnableLayering",0);
 					else
-						ModernDeleteSetting(NULL,"ModernData","EnableLayering");
+						db_unset(NULL,"ModernData","EnableLayering");
 				}
-				g_CluiData.dwKeyColor=ModernGetSettingDword(NULL,"ModernSettings","KeyColor",(DWORD)SETTING_KEYCOLOR_DEFAULT);
-				ModernWriteSettingByte(NULL,"CList","OnDesktop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP));
-				ModernWriteSettingByte(NULL,"CList","OnTop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONTOP));
+				g_CluiData.dwKeyColor=db_get_dw(NULL,"ModernSettings","KeyColor",(DWORD)SETTING_KEYCOLOR_DEFAULT);
+				db_set_b(NULL,"CList","OnDesktop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP));
+				db_set_b(NULL,"CList","OnTop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONTOP));
 				SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg,IDC_ONTOP)?HWND_TOPMOST:HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |SWP_NOACTIVATE);
-				ModernWriteSettingByte(NULL,"CLUI","DragToScroll",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DRAGTOSCROLL));
+				db_set_b(NULL,"CLUI","DragToScroll",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DRAGTOSCROLL));
 
 				{ //====== Non-Layered Mode ======
-					ModernWriteSettingByte(NULL,"CList","ToolWindow",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TOOLWND));
-					ModernWriteSettingByte(NULL,"CLUI","ShowCaption",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION));
-					ModernWriteSettingByte(NULL,"CLUI","ShowMainMenu",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWMAINMENU));
-					ModernWriteSettingByte(NULL,"CList","ThinBorder",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BORDER));
-					ModernWriteSettingByte(NULL,"CList","NoBorder",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND));
+					db_set_b(NULL,"CList","ToolWindow",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TOOLWND));
+					db_set_b(NULL,"CLUI","ShowCaption",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION));
+					db_set_b(NULL,"CLUI","ShowMainMenu",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWMAINMENU));
+					db_set_b(NULL,"CList","ThinBorder",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BORDER));
+					db_set_b(NULL,"CList","NoBorder",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND));
 					{
 						TCHAR title[256];
 						GetDlgItemText(hwndDlg,IDC_TITLETEXT,title,SIZEOF(title));
-						ModernWriteSettingTString(NULL,"CList","TitleText",title);
+						db_set_ws(NULL,"CList","TitleText",title);
 						//			SetWindowText(pcli->hwndContactList,title);
 					}
-					ModernWriteSettingByte(NULL,"CList","Min2Tray",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_MIN2TRAY));
-					ModernWriteSettingByte(NULL,"CList","WindowShadow",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DROPSHADOW));
-					ModernWriteSettingByte(NULL,"CLC","RoundCorners",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ROUNDCORNERS));
+					db_set_b(NULL,"CList","Min2Tray",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_MIN2TRAY));
+					db_set_b(NULL,"CList","WindowShadow",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DROPSHADOW));
+					db_set_b(NULL,"CLC","RoundCorners",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ROUNDCORNERS));
 				} //====== End of Non-Layered Mode ======
 				g_mutex_bChangingMode=TRUE;
 
@@ -1470,7 +1470,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP
 					g_CluiData.fOnDesktop=0;
 				}
 				AniAva_UpdateParent();
-				ModernWriteSettingByte(NULL,"CLUI","FadeInOut",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_FADEINOUT));
+				db_set_b(NULL,"CLUI","FadeInOut",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_FADEINOUT));
 				g_CluiData.fSmoothAnimation=IsWinVer2000Plus()&&(BYTE)IsDlgButtonChecked(hwndDlg,IDC_FADEINOUT);
 				{
 					int i1;
@@ -1478,14 +1478,14 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP
 					i1=SendDlgItemMessage(hwndDlg,IDC_FRAMESSPIN,UDM_GETPOS,0,0);
 					i2=SendDlgItemMessage(hwndDlg,IDC_CAPTIONSSPIN,UDM_GETPOS,0,0);
 
-					ModernWriteSettingDword(NULL,"CLUIFrames","GapBetweenFrames",(DWORD)i1);
-					ModernWriteSettingDword(NULL,"CLUIFrames","GapBetweenTitleBar",(DWORD)i2);
+					db_set_dw(NULL,"CLUIFrames","GapBetweenFrames",(DWORD)i1);
+					db_set_dw(NULL,"CLUIFrames","GapBetweenTitleBar",(DWORD)i2);
 					Sync(CLUIFramesOnClistResize, (WPARAM)pcli->hwndContactList,(LPARAM)0);
 				}
-				ModernWriteSettingByte(NULL,"CList","Transparent",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT));
-				ModernWriteSettingByte(NULL,"CList","Alpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_GETPOS,0,0));
-				ModernWriteSettingByte(NULL,"CList","AutoAlpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_GETPOS,0,0));
-				ModernWriteSettingByte(NULL,"CList","OnDesktop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP));
+				db_set_b(NULL,"CList","Transparent",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT));
+				db_set_b(NULL,"CList","Alpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_GETPOS,0,0));
+				db_set_b(NULL,"CList","AutoAlpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_GETPOS,0,0));
+				db_set_b(NULL,"CList","OnDesktop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP));
 
 				ske_LoadSkinFromDB();
 				CLUI_UpdateLayeredMode();
@@ -1570,13 +1570,13 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
 				int jndx;
 
 				dat->item[indx].changed = FALSE;
-				dat->item[indx].useBitmap = ModernGetSettingByte(NULL,module, "UseBitmap", DEFAULT_USEBITMAP);
-				dat->item[indx].bkColor = ModernGetSettingDword(NULL,module, "BkColour", DEFAULT_BKCOLOUR);
-				dat->item[indx].selColor = ModernGetSettingDword(NULL,module, "SelBkColour", DEFAULT_SELBKCOLOUR);
-				dat->item[indx].useWinColours = ModernGetSettingByte(NULL,module, "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
+				dat->item[indx].useBitmap = db_get_b(NULL,module, "UseBitmap", DEFAULT_USEBITMAP);
+				dat->item[indx].bkColor = db_get_dw(NULL,module, "BkColour", DEFAULT_BKCOLOUR);
+				dat->item[indx].selColor = db_get_dw(NULL,module, "SelBkColour", DEFAULT_SELBKCOLOUR);
+				dat->item[indx].useWinColours = db_get_b(NULL,module, "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
 				{
 					DBVARIANT dbv;
-					if (!ModernGetSettingString(NULL,module,"BkBitmap",&dbv))
+					if (!DBGetContactSettingString(NULL,module,"BkBitmap",&dbv))
 					{
 						int retval = CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)dbv.pszVal, (LPARAM)dat->item[indx].filename);
 						if (!retval || retval == CALLSERVICE_NOTFOUND)
@@ -1586,7 +1586,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
 					else
 						*dat->item[indx].filename = 0;
 				}
-				dat->item[indx].flags = ModernGetSettingWord(NULL,module,"BkBmpUse", DEFAULT_BKBMPUSE);
+				dat->item[indx].flags = db_get_w(NULL,module,"BkBmpUse", DEFAULT_BKBMPUSE);
 				jndx = SendMessageA(hList, CB_ADDSTRING, 0, (LPARAM)Translate(bkgrList[indx]));
 				SendMessage(hList, CB_SETITEMDATA, jndx, indx);
 			}
@@ -1780,21 +1780,21 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
 							if(dat->item[indx].changed)
 							{
 								char *module = bkgrList[indx] + strlen(bkgrList[indx]) + 1;
-								ModernWriteSettingByte(NULL, module, "UseBitmap", (BYTE)dat->item[indx].useBitmap);
+								db_set_b(NULL, module, "UseBitmap", (BYTE)dat->item[indx].useBitmap);
 								{
 									COLORREF col;
 
 									if ((col = dat->item[indx].bkColor) == DEFAULT_BKCOLOUR)
-										ModernDeleteSetting(NULL, module, "BkColour");
+										db_unset(NULL, module, "BkColour");
 									else
-										ModernWriteSettingDword(NULL, module, "BkColour", col);
+										db_set_dw(NULL, module, "BkColour", col);
 
 									if ((col = dat->item[indx].selColor) == DEFAULT_SELBKCOLOUR)
-										ModernDeleteSetting(NULL, module, "SelBkColour");
+										db_unset(NULL, module, "SelBkColour");
 									else
-										ModernWriteSettingDword(NULL, module, "SelBkColour", col);
+										db_set_dw(NULL, module, "SelBkColour", col);
 								}
-								ModernWriteSettingByte(NULL, module, "UseWinColours", (BYTE)dat->item[indx].useWinColours);
+								db_set_b(NULL, module, "UseWinColours", (BYTE)dat->item[indx].useWinColours);
 
 								{
 									char str[MAX_PATH];
@@ -1802,11 +1802,11 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
 										(WPARAM)dat->item[indx].filename,
 										(LPARAM)str);
 									if (!retval || retval == CALLSERVICE_NOTFOUND)
-										ModernWriteSettingString(NULL, module, "BkBitmap", dat->item[indx].filename);
+										db_set_s(NULL, module, "BkBitmap", dat->item[indx].filename);
 									else
-										ModernWriteSettingString(NULL, module, "BkBitmap", str);
+										db_set_s(NULL, module, "BkBitmap", str);
 								}
-								ModernWriteSettingWord(NULL, module, "BkBmpUse", dat->item[indx].flags);
+								db_set_w(NULL, module, "BkBmpUse", dat->item[indx].flags);
 								dat->item[indx].changed = FALSE;
 								NotifyEventHooks(g_CluiData.hEventBkgrChanged, (WPARAM)module, 0);
 							}
@@ -1913,11 +1913,11 @@ DWORD OptCheckBox_LoadValue(struct OptCheckBox *cb)
 		switch (cb->dbType)
 		{
 		case DBVT_BYTE:
-			return ModernGetSettingByte(NULL, cb->dbModule, cb->dbSetting, cb->defValue);
+			return db_get_b(NULL, cb->dbModule, cb->dbSetting, cb->defValue);
 		case DBVT_WORD:
-			return ModernGetSettingWord(NULL, cb->dbModule, cb->dbSetting, cb->defValue);
+			return db_get_w(NULL, cb->dbModule, cb->dbSetting, cb->defValue);
 		case DBVT_DWORD:
-			return ModernGetSettingDword(NULL, cb->dbModule, cb->dbSetting, cb->defValue);
+			return db_get_dw(NULL, cb->dbModule, cb->dbSetting, cb->defValue);
 		}
 		break;
 
@@ -1956,13 +1956,13 @@ void OptCheckBox_Save(HWND hwnd, struct OptCheckBox *cb)
 	switch (cb->dbType)
 	{
 	case DBVT_BYTE:
-		ModernWriteSettingByte(NULL, cb->dbModule, cb->dbSetting, (BYTE)value);
+		db_set_b(NULL, cb->dbModule, cb->dbSetting, (BYTE)value);
 		break;
 	case DBVT_WORD:
-		ModernWriteSettingWord(NULL, cb->dbModule, cb->dbSetting, (WORD)value);
+		db_set_w(NULL, cb->dbModule, cb->dbSetting, (WORD)value);
 		break;
 	case DBVT_DWORD:
-		ModernWriteSettingDword(NULL, cb->dbModule, cb->dbSetting, (DWORD)value);
+		db_set_dw(NULL, cb->dbModule, cb->dbSetting, (DWORD)value);
 		break;
 	}
 
@@ -2024,7 +2024,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
 			EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE));
 			EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE));
 			SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETRANGE,0,MAKELONG(900,1));
-			SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),0));
 
 			if (!IsWinVer2000Plus())
 			{
@@ -2044,8 +2044,8 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
 			}
 			SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_SETRANGE,FALSE,MAKELONG(1,255));
 			SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_SETRANGE,FALSE,MAKELONG(1,255));
-			SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_SETPOS,TRUE,ModernGetSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT));
-			SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_SETPOS,TRUE,ModernGetSettingByte(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT));
+			SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_SETPOS,TRUE,db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT));
+			SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_SETPOS,TRUE,db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT));
 			SendMessage(hwndDlg,WM_HSCROLL,0x12345678,0);
 
 
@@ -2059,9 +2059,9 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
 				SendDlgItemMessage(hwndDlg,IDC_CLSORT3,CB_SETITEMDATA,item,(LPARAM)0);
 
 			}
-			s1=ModernGetSettingByte(NULL,"CList","SortBy1",SETTING_SORTBY1_DEFAULT);
-			s2=ModernGetSettingByte(NULL,"CList","SortBy2",SETTING_SORTBY2_DEFAULT);
-			s3=ModernGetSettingByte(NULL,"CList","SortBy3",SETTING_SORTBY3_DEFAULT);
+			s1=db_get_b(NULL,"CList","SortBy1",SETTING_SORTBY1_DEFAULT);
+			s2=db_get_b(NULL,"CList","SortBy2",SETTING_SORTBY2_DEFAULT);
+			s3=db_get_b(NULL,"CList","SortBy3",SETTING_SORTBY3_DEFAULT);
 
 			for (i=0; i<SIZEOF(sortby); i++)
 			{
@@ -2127,10 +2127,10 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
 								OptCheckBox_Save(hwndDlg, opts+i);
 
 							SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg,IDC_ONTOP)?HWND_TOPMOST:HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
-							ModernWriteSettingWord(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0));
+							db_set_w(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0));
 
-							ModernWriteSettingByte(NULL,"CList","Alpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_GETPOS,0,0));
-							ModernWriteSettingByte(NULL,"CList","AutoAlpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_GETPOS,0,0));
+							db_set_b(NULL,"CList","Alpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_GETPOS,0,0));
+							db_set_b(NULL,"CList","AutoAlpha",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_GETPOS,0,0));
 
 							{
 								int s1=SendDlgItemMessage(hwndDlg,IDC_CLSORT1,CB_GETCURSEL,0,0);
@@ -2139,9 +2139,9 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
 								if (s1>=0) s1=sortbyValue[s1];
 								if (s2>=0) s2=sortbyValue[s2];
 								if (s3>=0) s3=sortbyValue[s3];
-								ModernWriteSettingByte(NULL,"CList","SortBy1",(BYTE)s1);
-								ModernWriteSettingByte(NULL,"CList","SortBy2",(BYTE)s2);
-								ModernWriteSettingByte(NULL,"CList","SortBy3",(BYTE)s3);
+								db_set_b(NULL,"CList","SortBy1",(BYTE)s1);
+								db_set_b(NULL,"CList","SortBy2",(BYTE)s2);
+								db_set_b(NULL,"CList","SortBy3",(BYTE)s3);
 							}
 
 							ClcOptionsChanged();
diff --git a/plugins/Clist_modern/modern_clcutils.cpp b/plugins/Clist_modern/modern_clcutils.cpp
index 33830c6e63..6a30eefd71 100644
--- a/plugins/Clist_modern/modern_clcutils.cpp
+++ b/plugins/Clist_modern/modern_clcutils.cpp
@@ -468,9 +468,9 @@ int GetDropTargetInformation(HWND hwnd,struct ClcData *dat,POINT pt)
 }
 COLORREF sttGetColor(char * module, char * color, COLORREF defColor)
 {
-	BOOL useWinColor=ModernGetSettingByte(NULL, module, "UseWinColours",CLCDEFAULT_USEWINDOWSCOLOURS);
+	BOOL useWinColor=db_get_b(NULL, module, "UseWinColours",CLCDEFAULT_USEWINDOWSCOLOURS);
 	if (useWinColor) return defColor;
-	else return ModernGetSettingDword(NULL, module, color, defColor);
+	else return db_get_dw(NULL, module, color, defColor);
 }
 void RegisterCLUIFonts( void );
 void LoadCLCFonts( HWND hwnd, struct ClcData *dat )
@@ -507,26 +507,26 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
 { 
 	int i;
 
-	g_CluiData.fDisableSkinEngine=ModernGetSettingByte(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
+	g_CluiData.fDisableSkinEngine=db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
 	
 	LoadCLCFonts( hwnd, dat );
 
-	g_CluiData.bSortByOrder[0]=ModernGetSettingByte(NULL,"CList","SortBy1",SETTING_SORTBY1_DEFAULT);
-	g_CluiData.bSortByOrder[1]=ModernGetSettingByte(NULL,"CList","SortBy2",SETTING_SORTBY2_DEFAULT);
-	g_CluiData.bSortByOrder[2]=ModernGetSettingByte(NULL,"CList","SortBy3",SETTING_SORTBY3_DEFAULT);
-	g_CluiData.fSortNoOfflineBottom=ModernGetSettingByte(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT);
+	g_CluiData.bSortByOrder[0]=db_get_b(NULL,"CList","SortBy1",SETTING_SORTBY1_DEFAULT);
+	g_CluiData.bSortByOrder[1]=db_get_b(NULL,"CList","SortBy2",SETTING_SORTBY2_DEFAULT);
+	g_CluiData.bSortByOrder[2]=db_get_b(NULL,"CList","SortBy3",SETTING_SORTBY3_DEFAULT);
+	g_CluiData.fSortNoOfflineBottom=db_get_b(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT);
 
 	// Row
-	dat->row_min_heigh = ModernGetSettingWord(NULL,"CList","MinRowHeight",CLCDEFAULT_ROWHEIGHT);
-	dat->row_border = ModernGetSettingWord(NULL,"CList","RowBorder",SETTING_ROWBORDER_DEFAULT);
+	dat->row_min_heigh = db_get_w(NULL,"CList","MinRowHeight",CLCDEFAULT_ROWHEIGHT);
+	dat->row_border = db_get_w(NULL,"CList","RowBorder",SETTING_ROWBORDER_DEFAULT);
 	dat->row_before_group_space =((hwnd!=pcli->hwndContactTree&&pcli->hwndContactTree!=NULL) 
-		|| !ModernGetSettingByte(NULL,"ModernData","UseAdvancedRowLayout",SETTING_ROW_ADVANCEDLAYOUT_DEFAULT))?0:ModernGetSettingWord(NULL,"ModernSkin","SpaceBeforeGroup",SKIN_SPACEBEFOREGROUP_DEFAULT);
-	dat->row_variable_height = ModernGetSettingByte(NULL,"CList","VariableRowHeight",SETTING_VARIABLEROWHEIGHT_DEFAULT);
-	dat->row_align_left_items_to_left = ModernGetSettingByte(NULL,"CList","AlignLeftItemsToLeft",SETTING_ALIGNLEFTTOLEFT_DEFAULT);
-	dat->row_hide_group_icon = ModernGetSettingByte(NULL,"CList","HideGroupsIcon",SETTING_HIDEGROUPSICON_DEFAULT);
-	dat->row_align_right_items_to_right = ModernGetSettingByte(NULL,"CList","AlignRightItemsToRight",SETTING_ALIGNRIGHTORIGHT_DEFAULT);
+		|| !db_get_b(NULL,"ModernData","UseAdvancedRowLayout",SETTING_ROW_ADVANCEDLAYOUT_DEFAULT))?0:db_get_w(NULL,"ModernSkin","SpaceBeforeGroup",SKIN_SPACEBEFOREGROUP_DEFAULT);
+	dat->row_variable_height = db_get_b(NULL,"CList","VariableRowHeight",SETTING_VARIABLEROWHEIGHT_DEFAULT);
+	dat->row_align_left_items_to_left = db_get_b(NULL,"CList","AlignLeftItemsToLeft",SETTING_ALIGNLEFTTOLEFT_DEFAULT);
+	dat->row_hide_group_icon = db_get_b(NULL,"CList","HideGroupsIcon",SETTING_HIDEGROUPSICON_DEFAULT);
+	dat->row_align_right_items_to_right = db_get_b(NULL,"CList","AlignRightItemsToRight",SETTING_ALIGNRIGHTORIGHT_DEFAULT);
 	//TODO: Add to settings
-	dat->row_align_group_mode=ModernGetSettingByte(NULL,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT);
+	dat->row_align_group_mode=db_get_b(NULL,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT);
 	if (pcli->hwndContactTree==NULL || dat->hWnd==pcli->hwndContactTree)
 	{
 
@@ -535,7 +535,7 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
 		{
 			char tmp[128];
 			mir_snprintf(tmp, SIZEOF(tmp), "RowPos%d", i);
-			dat->row_items[i] = ModernGetSettingWord(NULL, "CList", tmp, defItemsOrder[i]);
+			dat->row_items[i] = db_get_w(NULL, "CList", tmp, defItemsOrder[i]);
 		}
 	}
 	else
@@ -548,17 +548,17 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
 	// Avatar
 	if (pcli->hwndContactTree == hwnd  || pcli->hwndContactTree==NULL)
 	{
-		dat->avatars_show = ModernGetSettingByte(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT);
-		dat->avatars_draw_border = ModernGetSettingByte(NULL,"CList","AvatarsDrawBorders",SETTINGS_AVATARDRAWBORDER_DEFAULT);
-		dat->avatars_border_color = (COLORREF)ModernGetSettingDword(NULL,"CList","AvatarsBorderColor",SETTINGS_AVATARBORDERCOLOR_DEFAULT);
-		dat->avatars_round_corners = ModernGetSettingByte(NULL,"CList","AvatarsRoundCorners",SETTINGS_AVATARROUNDCORNERS_DEFAULT);
-		dat->avatars_use_custom_corner_size = ModernGetSettingByte(NULL,"CList","AvatarsUseCustomCornerSize",SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT);
-		dat->avatars_custom_corner_size = ModernGetSettingWord(NULL,"CList","AvatarsCustomCornerSize",SETTINGS_AVATARCORNERSIZE_DEFAULT);
-		dat->avatars_ignore_size_for_row_height = ModernGetSettingByte(NULL,"CList","AvatarsIgnoreSizeForRow",SETTINGS_AVATARIGNORESIZEFORROW_DEFAULT);
-		dat->avatars_draw_overlay = ModernGetSettingByte(NULL,"CList","AvatarsDrawOverlay",SETTINGS_AVATARDRAWOVERLAY_DEFAULT);
-		dat->avatars_overlay_type = ModernGetSettingByte(NULL,"CList","AvatarsOverlayType",SETTINGS_AVATAROVERLAYTYPE_DEFAULT);
-		dat->avatars_maxheight_size = ModernGetSettingWord(NULL,"CList","AvatarsSize",SETTING_AVATARHEIGHT_DEFAULT);
-		dat->avatars_maxwidth_size = ModernGetSettingWord(NULL,"CList","AvatarsWidth",SETTING_AVATARWIDTH_DEFAULT);
+		dat->avatars_show = db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT);
+		dat->avatars_draw_border = db_get_b(NULL,"CList","AvatarsDrawBorders",SETTINGS_AVATARDRAWBORDER_DEFAULT);
+		dat->avatars_border_color = (COLORREF)db_get_dw(NULL,"CList","AvatarsBorderColor",SETTINGS_AVATARBORDERCOLOR_DEFAULT);
+		dat->avatars_round_corners = db_get_b(NULL,"CList","AvatarsRoundCorners",SETTINGS_AVATARROUNDCORNERS_DEFAULT);
+		dat->avatars_use_custom_corner_size = db_get_b(NULL,"CList","AvatarsUseCustomCornerSize",SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT);
+		dat->avatars_custom_corner_size = db_get_w(NULL,"CList","AvatarsCustomCornerSize",SETTINGS_AVATARCORNERSIZE_DEFAULT);
+		dat->avatars_ignore_size_for_row_height = db_get_b(NULL,"CList","AvatarsIgnoreSizeForRow",SETTINGS_AVATARIGNORESIZEFORROW_DEFAULT);
+		dat->avatars_draw_overlay = db_get_b(NULL,"CList","AvatarsDrawOverlay",SETTINGS_AVATARDRAWOVERLAY_DEFAULT);
+		dat->avatars_overlay_type = db_get_b(NULL,"CList","AvatarsOverlayType",SETTINGS_AVATAROVERLAYTYPE_DEFAULT);
+		dat->avatars_maxheight_size = db_get_w(NULL,"CList","AvatarsSize",SETTING_AVATARHEIGHT_DEFAULT);
+		dat->avatars_maxwidth_size = db_get_w(NULL,"CList","AvatarsWidth",SETTING_AVATARWIDTH_DEFAULT);
 	}
 	else
 	{
@@ -578,9 +578,9 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
 	// Icon
 	if (pcli->hwndContactTree == hwnd|| pcli->hwndContactTree==NULL)
 	{
-		dat->icon_hide_on_avatar = ModernGetSettingByte(NULL,"CList","IconHideOnAvatar",SETTING_HIDEICONONAVATAR_DEFAULT);
-		dat->icon_draw_on_avatar_space = ModernGetSettingByte(NULL,"CList","IconDrawOnAvatarSpace",SETTING_ICONONAVATARPLACE_DEFAULT);
-		dat->icon_ignore_size_for_row_height = ModernGetSettingByte(NULL,"CList","IconIgnoreSizeForRownHeight",SETTING_ICONIGNORESIZE_DEFAULT);
+		dat->icon_hide_on_avatar = db_get_b(NULL,"CList","IconHideOnAvatar",SETTING_HIDEICONONAVATAR_DEFAULT);
+		dat->icon_draw_on_avatar_space = db_get_b(NULL,"CList","IconDrawOnAvatarSpace",SETTING_ICONONAVATARPLACE_DEFAULT);
+		dat->icon_ignore_size_for_row_height = db_get_b(NULL,"CList","IconIgnoreSizeForRownHeight",SETTING_ICONIGNORESIZE_DEFAULT);
 	}
 	else
 	{
@@ -592,8 +592,8 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
 	// Contact time
 	if (pcli->hwndContactTree == hwnd|| pcli->hwndContactTree==NULL)
 	{
-		dat->contact_time_show = ModernGetSettingByte(NULL,"CList","ContactTimeShow",SETTING_SHOWTIME_DEFAULT);
-		dat->contact_time_show_only_if_different = ModernGetSettingByte(NULL,"CList","ContactTimeShowOnlyIfDifferent",SETTING_SHOWTIMEIFDIFF_DEFAULT);
+		dat->contact_time_show = db_get_b(NULL,"CList","ContactTimeShow",SETTING_SHOWTIME_DEFAULT);
+		dat->contact_time_show_only_if_different = db_get_b(NULL,"CList","ContactTimeShowOnlyIfDifferent",SETTING_SHOWTIMEIFDIFF_DEFAULT);
 	}
 	else
 	{
@@ -602,16 +602,16 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
 	}
 
 	// Text
-	dat->text_rtl = ModernGetSettingByte(NULL,"CList","TextRTL",SETTING_TEXT_RTL_DEFAULT);
-	dat->text_align_right = ModernGetSettingByte(NULL,"CList","TextAlignToRight",SETTING_TEXT_RIGHTALIGN_DEFAULT);
-	dat->text_replace_smileys = ModernGetSettingByte(NULL,"CList","TextReplaceSmileys",SETTING_TEXT_SMILEY_DEFAULT);
-	dat->text_resize_smileys = ModernGetSettingByte(NULL,"CList","TextResizeSmileys",SETTING_TEXT_RESIZESMILEY_DEFAULT);
+	dat->text_rtl = db_get_b(NULL,"CList","TextRTL",SETTING_TEXT_RTL_DEFAULT);
+	dat->text_align_right = db_get_b(NULL,"CList","TextAlignToRight",SETTING_TEXT_RIGHTALIGN_DEFAULT);
+	dat->text_replace_smileys = db_get_b(NULL,"CList","TextReplaceSmileys",SETTING_TEXT_SMILEY_DEFAULT);
+	dat->text_resize_smileys = db_get_b(NULL,"CList","TextResizeSmileys",SETTING_TEXT_RESIZESMILEY_DEFAULT);
 	dat->text_smiley_height = 0;
-	dat->text_use_protocol_smileys = ModernGetSettingByte(NULL,"CList","TextUseProtocolSmileys",SETTING_TEXT_PROTOSMILEY_DEFAULT);
+	dat->text_use_protocol_smileys = db_get_b(NULL,"CList","TextUseProtocolSmileys",SETTING_TEXT_PROTOSMILEY_DEFAULT);
 
 	if (pcli->hwndContactTree == hwnd|| pcli->hwndContactTree==NULL)
 	{
-		dat->text_ignore_size_for_row_height = ModernGetSettingByte(NULL,"CList","TextIgnoreSizeForRownHeight",SETTING_TEXT_IGNORESIZE_DEFAULT);
+		dat->text_ignore_size_for_row_height = db_get_b(NULL,"CList","TextIgnoreSizeForRownHeight",SETTING_TEXT_IGNORESIZE_DEFAULT);
 	}
 	else
 	{
@@ -619,35 +619,35 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
 	}
 
 	// First line
-	dat->first_line_draw_smileys = ModernGetSettingByte(NULL,"CList","FirstLineDrawSmileys",SETTING_FIRSTLINE_SMILEYS_DEFAULT);
-	dat->first_line_append_nick = ModernGetSettingByte(NULL,"CList","FirstLineAppendNick",SETTING_FIRSTLINE_APPENDNICK_DEFAULT);
-	gl_TrimText=ModernGetSettingByte(NULL,"CList","TrimText",SETTING_FIRSTLINE_TRIMTEXT_DEFAULT);
+	dat->first_line_draw_smileys = db_get_b(NULL,"CList","FirstLineDrawSmileys",SETTING_FIRSTLINE_SMILEYS_DEFAULT);
+	dat->first_line_append_nick = db_get_b(NULL,"CList","FirstLineAppendNick",SETTING_FIRSTLINE_APPENDNICK_DEFAULT);
+	gl_TrimText=db_get_b(NULL,"CList","TrimText",SETTING_FIRSTLINE_TRIMTEXT_DEFAULT);
 
 	// Second line
 	if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree==NULL)
 	{
-		dat->second_line_show = ModernGetSettingByte(NULL,"CList","SecondLineShow",SETTING_SECONDLINE_SHOW_DEFAULT);
-		dat->second_line_top_space = ModernGetSettingWord(NULL,"CList","SecondLineTopSpace",SETTING_SECONDLINE_TOPSPACE_DEFAULT);
-		dat->second_line_draw_smileys = ModernGetSettingByte(NULL,"CList","SecondLineDrawSmileys",SETTING_SECONDLINE_SMILEYS_DEFAULT);
-		dat->second_line_type = ModernGetSettingWord(NULL,"CList","SecondLineType",SETTING_SECONDLINE_TYPE_DEFAULT);
+		dat->second_line_show = db_get_b(NULL,"CList","SecondLineShow",SETTING_SECONDLINE_SHOW_DEFAULT);
+		dat->second_line_top_space = db_get_w(NULL,"CList","SecondLineTopSpace",SETTING_SECONDLINE_TOPSPACE_DEFAULT);
+		dat->second_line_draw_smileys = db_get_b(NULL,"CList","SecondLineDrawSmileys",SETTING_SECONDLINE_SMILEYS_DEFAULT);
+		dat->second_line_type = db_get_w(NULL,"CList","SecondLineType",SETTING_SECONDLINE_TYPE_DEFAULT);
 		{
 			DBVARIANT dbv={0};
 
-			if (!ModernGetSettingTString(NULL, "CList","SecondLineText", &dbv))
+			if (!DBGetContactSettingTString(NULL, "CList","SecondLineText", &dbv))
 			{
 				lstrcpyn(dat->second_line_text, dbv.ptszVal, SIZEOF(dat->second_line_text)-1);
 				dat->second_line_text[SIZEOF(dat->second_line_text)-1] = _T('\0');
-				ModernDBFreeVariant(&dbv);
+				db_free(&dbv);
 			}
 			else
 			{
 				dat->second_line_text[0] = _T('\0');
 			}
 		}
-		dat->second_line_xstatus_has_priority = ModernGetSettingByte(NULL,"CList","SecondLineXStatusHasPriority",SETTING_SECONDLINE_XSTATUS_DEFAULT);
-		dat->second_line_show_status_if_no_away=ModernGetSettingByte(NULL,"CList","SecondLineShowStatusIfNoAway",SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT);
-		dat->second_line_show_listening_if_no_away=ModernGetSettingByte(NULL,"CList","SecondLineShowListeningIfNoAway",SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT);
-		dat->second_line_use_name_and_message_for_xstatus = ModernGetSettingByte(NULL,"CList","SecondLineUseNameAndMessageForXStatus",SETTING_SECONDLINE_XSTATUSNAMETEXT_DEFAULT);
+		dat->second_line_xstatus_has_priority = db_get_b(NULL,"CList","SecondLineXStatusHasPriority",SETTING_SECONDLINE_XSTATUS_DEFAULT);
+		dat->second_line_show_status_if_no_away=db_get_b(NULL,"CList","SecondLineShowStatusIfNoAway",SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT);
+		dat->second_line_show_listening_if_no_away=db_get_b(NULL,"CList","SecondLineShowListeningIfNoAway",SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT);
+		dat->second_line_use_name_and_message_for_xstatus = db_get_b(NULL,"CList","SecondLineUseNameAndMessageForXStatus",SETTING_SECONDLINE_XSTATUSNAMETEXT_DEFAULT);
 	}
 	else
 	{
@@ -664,28 +664,28 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
 	// Third line
 	if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree==NULL)
 	{
-		dat->third_line_show = ModernGetSettingByte(NULL,"CList","ThirdLineShow",SETTING_THIRDLINE_SHOW_DEFAULT);
-		dat->third_line_top_space = ModernGetSettingWord(NULL,"CList","ThirdLineTopSpace",SETTING_THIRDLINE_TOPSPACE_DEFAULT);
-		dat->third_line_draw_smileys = ModernGetSettingByte(NULL,"CList","ThirdLineDrawSmileys",SETTING_THIRDLINE_SMILEYS_DEFAULT);
-		dat->third_line_type = ModernGetSettingWord(NULL,"CList","ThirdLineType",SETTING_THIRDLINE_TYPE_DEFAULT);
+		dat->third_line_show = db_get_b(NULL,"CList","ThirdLineShow",SETTING_THIRDLINE_SHOW_DEFAULT);
+		dat->third_line_top_space = db_get_w(NULL,"CList","ThirdLineTopSpace",SETTING_THIRDLINE_TOPSPACE_DEFAULT);
+		dat->third_line_draw_smileys = db_get_b(NULL,"CList","ThirdLineDrawSmileys",SETTING_THIRDLINE_SMILEYS_DEFAULT);
+		dat->third_line_type = db_get_w(NULL,"CList","ThirdLineType",SETTING_THIRDLINE_TYPE_DEFAULT);
 		{
 			DBVARIANT dbv={0};
 
-			if (!ModernGetSettingTString(NULL, "CList","ThirdLineText", &dbv))
+			if (!DBGetContactSettingTString(NULL, "CList","ThirdLineText", &dbv))
 			{
 				lstrcpyn(dat->third_line_text, dbv.ptszVal, SIZEOF(dat->third_line_text)-1);
 				dat->third_line_text[SIZEOF(dat->third_line_text)-1] = _T('\0');
-				ModernDBFreeVariant(&dbv);
+				db_free(&dbv);
 			}
 			else
 			{
 				dat->third_line_text[0] = _T('\0');
 			}
 		}
-		dat->third_line_xstatus_has_priority = ModernGetSettingByte(NULL,"CList","ThirdLineXStatusHasPriority",SETTING_THIRDLINE_XSTATUS_DEFAULT);
-		dat->third_line_show_status_if_no_away=ModernGetSettingByte(NULL,"CList","ThirdLineShowStatusIfNoAway",SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT);
-		dat->third_line_show_listening_if_no_away=ModernGetSettingByte(NULL,"CList","ThirdLineShowListeningIfNoAway",SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT);
-		dat->third_line_use_name_and_message_for_xstatus = ModernGetSettingByte(NULL,"CList","ThirdLineUseNameAndMessageForXStatus",SETTING_THIRDLINE_XSTATUSNAMETEXT_DEFAULT);
+		dat->third_line_xstatus_has_priority = db_get_b(NULL,"CList","ThirdLineXStatusHasPriority",SETTING_THIRDLINE_XSTATUS_DEFAULT);
+		dat->third_line_show_status_if_no_away=db_get_b(NULL,"CList","ThirdLineShowStatusIfNoAway",SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT);
+		dat->third_line_show_listening_if_no_away=db_get_b(NULL,"CList","ThirdLineShowListeningIfNoAway",SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT);
+		dat->third_line_use_name_and_message_for_xstatus = db_get_b(NULL,"CList","ThirdLineUseNameAndMessageForXStatus",SETTING_THIRDLINE_XSTATUSNAMETEXT_DEFAULT);
 	}
 	else
 	{
@@ -698,22 +698,22 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
 		dat->third_line_use_name_and_message_for_xstatus = 0;
 	}
 
-	dat->leftMargin=ModernGetSettingByte(NULL,"CLC","LeftMargin",CLCDEFAULT_LEFTMARGIN);
-	dat->rightMargin=ModernGetSettingByte(NULL,"CLC","RightMargin",CLCDEFAULT_RIGHTMARGIN);
-	dat->exStyle=ModernGetSettingDword(NULL,"CLC","ExStyle",GetDefaultExStyle());
-	dat->scrollTime=ModernGetSettingWord(NULL,"CLC","ScrollTime",CLCDEFAULT_SCROLLTIME);
+	dat->leftMargin=db_get_b(NULL,"CLC","LeftMargin",CLCDEFAULT_LEFTMARGIN);
+	dat->rightMargin=db_get_b(NULL,"CLC","RightMargin",CLCDEFAULT_RIGHTMARGIN);
+	dat->exStyle=db_get_dw(NULL,"CLC","ExStyle",GetDefaultExStyle());
+	dat->scrollTime=db_get_w(NULL,"CLC","ScrollTime",CLCDEFAULT_SCROLLTIME);
 	dat->force_in_dialog=(pcli->hwndContactTree)?(hwnd!=pcli->hwndContactTree):0;
-	dat->groupIndent=ModernGetSettingByte(NULL,"CLC","GroupIndent",CLCDEFAULT_GROUPINDENT);
-	dat->subIndent=ModernGetSettingByte(NULL,"CLC","SubIndent",CLCDEFAULT_GROUPINDENT);
-	dat->gammaCorrection=ModernGetSettingByte(NULL,"CLC","GammaCorrect",CLCDEFAULT_GAMMACORRECT);
-	dat->showIdle=ModernGetSettingByte(NULL,"CLC","ShowIdle",CLCDEFAULT_SHOWIDLE);
-	dat->noVScrollbar=ModernGetSettingByte(NULL,"CLC","NoVScrollBar",CLCDEFAULT_NOVSCROLL);
+	dat->groupIndent=db_get_b(NULL,"CLC","GroupIndent",CLCDEFAULT_GROUPINDENT);
+	dat->subIndent=db_get_b(NULL,"CLC","SubIndent",CLCDEFAULT_GROUPINDENT);
+	dat->gammaCorrection=db_get_b(NULL,"CLC","GammaCorrect",CLCDEFAULT_GAMMACORRECT);
+	dat->showIdle=db_get_b(NULL,"CLC","ShowIdle",CLCDEFAULT_SHOWIDLE);
+	dat->noVScrollbar=db_get_b(NULL,"CLC","NoVScrollBar",CLCDEFAULT_NOVSCROLL);
 	SendMessage(hwnd,INTM_SCROLLBARCHANGED,0,0);
 	
 	if (dat->hBmpBackground) {DeleteObject(dat->hBmpBackground); dat->hBmpBackground=NULL;}
 	if (dat->hMenuBackground) {DeleteObject(dat->hMenuBackground); dat->hMenuBackground=NULL;}
 	
-	dat->useWindowsColours = ModernGetSettingByte(NULL, "CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
+	dat->useWindowsColours = db_get_b(NULL, "CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
 
 	if (g_CluiData.fDisableSkinEngine)
 	{
@@ -722,16 +722,16 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
 		{
 			dat->bkColour=sttGetColor("CLC","BkColour",GetSysColor(COLOR_3DFACE));
 			{	
-				if(ModernGetSettingByte(NULL,"CLC","UseBitmap",CLCDEFAULT_USEBITMAP)) 
+				if(db_get_b(NULL,"CLC","UseBitmap",CLCDEFAULT_USEBITMAP)) 
 				{
-					if (!ModernGetSettingString(NULL,"CLC","BkBitmap",&dbv)) 
+					if (!DBGetContactSettingString(NULL,"CLC","BkBitmap",&dbv)) 
 					{
 						dat->hBmpBackground=(HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);				
-						ModernDBFreeVariant(&dbv);						
+						db_free(&dbv);						
 					}
 				}
 			}
-			dat->backgroundBmpUse=ModernGetSettingWord(NULL,"CLC","BkBmpUse",CLCDEFAULT_BKBMPUSE);
+			dat->backgroundBmpUse=db_get_w(NULL,"CLC","BkBmpUse",CLCDEFAULT_BKBMPUSE);
 		}		
 		dat->MenuBkColor=sttGetColor("Menu","BkColour",CLCDEFAULT_BKCOLOUR);
 		dat->MenuBkHiColor=sttGetColor("Menu","SelBkColour",CLCDEFAULT_SELBKCOLOUR);
@@ -739,40 +739,40 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat )
 		dat->MenuTextColor=sttGetColor("Menu","TextColour",CLCDEFAULT_TEXTCOLOUR);
 		dat->MenuTextHiColor=sttGetColor("Menu","SelTextColour",CLCDEFAULT_MODERN_SELTEXTCOLOUR);
 		
-		if(ModernGetSettingByte(NULL,"Menu","UseBitmap",CLCDEFAULT_USEBITMAP)) {
-			if (!ModernGetSettingString(NULL,"Menu","BkBitmap",&dbv)) {
+		if(db_get_b(NULL,"Menu","UseBitmap",CLCDEFAULT_USEBITMAP)) {
+			if (!DBGetContactSettingString(NULL,"Menu","BkBitmap",&dbv)) {
 				dat->hMenuBackground=(HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
 				//mir_free_and_nill(dbv.pszVal);
-				ModernDBFreeVariant(&dbv);
+				db_free(&dbv);
 			}
 		}
-		dat->MenuBmpUse=ModernGetSettingWord(NULL,"Menu","BkBmpUse",CLCDEFAULT_BKBMPUSE);
+		dat->MenuBmpUse=db_get_w(NULL,"Menu","BkBmpUse",CLCDEFAULT_BKBMPUSE);
 	}
 	
-	dat->greyoutFlags=ModernGetSettingDword(NULL,"CLC","GreyoutFlags",CLCDEFAULT_GREYOUTFLAGS);
-	dat->offlineModes=ModernGetSettingDword(NULL,"CLC","OfflineModes",CLCDEFAULT_OFFLINEMODES);
+	dat->greyoutFlags=db_get_dw(NULL,"CLC","GreyoutFlags",CLCDEFAULT_GREYOUTFLAGS);
+	dat->offlineModes=db_get_dw(NULL,"CLC","OfflineModes",CLCDEFAULT_OFFLINEMODES);
 	dat->selBkColour=sttGetColor("CLC","SelBkColour",CLCDEFAULT_SELBKCOLOUR);
-	dat->selTextColour=ModernGetSettingDword(NULL,"CLC","SelTextColour",CLCDEFAULT_MODERN_SELTEXTCOLOUR);
-	dat->hotTextColour=ModernGetSettingDword(NULL,"CLC","HotTextColour",CLCDEFAULT_MODERN_HOTTEXTCOLOUR);
-	dat->quickSearchColour=ModernGetSettingDword(NULL,"CLC","QuickSearchColour",CLCDEFAULT_MODERN_QUICKSEARCHCOLOUR);
+	dat->selTextColour=db_get_dw(NULL,"CLC","SelTextColour",CLCDEFAULT_MODERN_SELTEXTCOLOUR);
+	dat->hotTextColour=db_get_dw(NULL,"CLC","HotTextColour",CLCDEFAULT_MODERN_HOTTEXTCOLOUR);
+	dat->quickSearchColour=db_get_dw(NULL,"CLC","QuickSearchColour",CLCDEFAULT_MODERN_QUICKSEARCHCOLOUR);
 	if (!g_szMetaModuleName && ServiceExists(MS_MC_GETPROTOCOLNAME)) g_szMetaModuleName = (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
 	dat->IsMetaContactsEnabled=(!(GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_MANUALUPDATE)) &&
-		g_szMetaModuleName && ModernGetSettingByte(NULL,g_szMetaModuleName,"Enabled",1) && ServiceExists(MS_MC_GETDEFAULTCONTACT);
+		g_szMetaModuleName && db_get_b(NULL,g_szMetaModuleName,"Enabled",1) && ServiceExists(MS_MC_GETDEFAULTCONTACT);
 
 	if (pcli->hwndContactTree==NULL || dat->hWnd==pcli->hwndContactTree)
-		dat->MetaIgnoreEmptyExtra=ModernGetSettingByte(NULL,"CLC","MetaIgnoreEmptyExtra",SETTING_METAIGNOREEMPTYEXTRA_DEFAULT);
+		dat->MetaIgnoreEmptyExtra=db_get_b(NULL,"CLC","MetaIgnoreEmptyExtra",SETTING_METAIGNOREEMPTYEXTRA_DEFAULT);
 	else
 		dat->MetaIgnoreEmptyExtra=FALSE;
 
-	dat->expandMeta=ModernGetSettingByte(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT);
-	dat->useMetaIcon=ModernGetSettingByte(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT);
+	dat->expandMeta=db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT);
+	dat->useMetaIcon=db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT);
 	
-	dat->drawOverlayedStatus=ModernGetSettingByte(NULL,"CLC","DrawOverlayedStatus",SETTING_DRAWOVERLAYEDSTATUS_DEFAULT);
+	dat->drawOverlayedStatus=db_get_b(NULL,"CLC","DrawOverlayedStatus",SETTING_DRAWOVERLAYEDSTATUS_DEFAULT);
 
-	dat->dbbMetaHideExtra=ModernGetSettingByte(NULL,"CLC","MetaHideExtra",SETTING_METAHIDEEXTRA_DEFAULT);
-	dat->dbbBlendInActiveState=ModernGetSettingByte(NULL,"CLC","BlendInActiveState",SETTING_BLENDINACTIVESTATE_DEFAULT);
-	dat->dbbBlend25=ModernGetSettingByte(NULL,"CLC","Blend25%",SETTING_BLENDINACTIVESTATE_DEFAULT);
-	dat->bCompactMode=ModernGetSettingByte(NULL,"CLC","CompactMode",SETTING_COMPACTMODE_DEFAULT);
+	dat->dbbMetaHideExtra=db_get_b(NULL,"CLC","MetaHideExtra",SETTING_METAHIDEEXTRA_DEFAULT);
+	dat->dbbBlendInActiveState=db_get_b(NULL,"CLC","BlendInActiveState",SETTING_BLENDINACTIVESTATE_DEFAULT);
+	dat->dbbBlend25=db_get_b(NULL,"CLC","Blend25%",SETTING_BLENDINACTIVESTATE_DEFAULT);
+	dat->bCompactMode=db_get_b(NULL,"CLC","CompactMode",SETTING_COMPACTMODE_DEFAULT);
 	if ((pcli->hwndContactTree == hwnd || pcli->hwndContactTree==NULL))
 	{
 		IvalidateDisplayNameCache(16);
@@ -794,9 +794,9 @@ int ExpandMetaContact(HWND hwnd, struct ClcContact * contact, struct ClcData * d
 {
 	struct ClcContact * ht=NULL;
 	KillTimer(hwnd,TIMERID_SUBEXPAND);
-	if (contact->type!=CLCIT_CONTACT ||contact->SubAllocated==0 || contact->SubExpanded==bExpand || !ModernGetSettingByte(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT)) return 0;
+	if (contact->type!=CLCIT_CONTACT ||contact->SubAllocated==0 || contact->SubExpanded==bExpand || !db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT)) return 0;
 	contact->SubExpanded=bExpand;
-	ModernWriteSettingByte(contact->hContact,"CList","Expanded",contact->SubExpanded);
+	db_set_b(contact->hContact,"CList","Expanded",contact->SubExpanded);
 	dat->NeedResort=1;
 	pcli->pfnSortCLC(hwnd,dat,1);		
 	cliRecalcScrollBar(hwnd,dat);
diff --git a/plugins/Clist_modern/modern_clistevents.cpp b/plugins/Clist_modern/modern_clistevents.cpp
index 8f3f667d85..42f65091f6 100644
--- a/plugins/Clist_modern/modern_clistevents.cpp
+++ b/plugins/Clist_modern/modern_clistevents.cpp
@@ -132,7 +132,7 @@ struct CListEvent* cli_AddEvent(CLISTEVENT *cle)
 				nmi = (struct NotifyMenuItemExData *) malloc(sizeof(struct NotifyMenuItemExData));
 				if (nmi) {
 					TCHAR szBuffer[128];
-					TCHAR* szStatus = pcli->pfnGetStatusModeDescription(ModernGetSettingWord(p->cle.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
+					TCHAR* szStatus = pcli->pfnGetStatusModeDescription(db_get_w(p->cle.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
 					TCHAR szwProto[64];
 					MultiByteToWideChar(CP_ACP, 0, szProto, -1, szwProto, 64);
 					szwProto[63] = 0;
@@ -284,14 +284,14 @@ static int  ehhEventAreaBackgroundSettingsChanged(WPARAM wParam, LPARAM lParam)
 	{
 		DBVARIANT dbv;
 		event_area.bkColour=sttGetColor("EventArea","BkColour",CLCDEFAULT_BKCOLOUR);
-		if(ModernGetSettingByte(NULL,"EventArea","UseBitmap",CLCDEFAULT_USEBITMAP)) {
-			if (!ModernGetSettingString(NULL,"EventArea","BkBitmap",&dbv)) {
+		if(db_get_b(NULL,"EventArea","UseBitmap",CLCDEFAULT_USEBITMAP)) {
+			if (!DBGetContactSettingString(NULL,"EventArea","BkBitmap",&dbv)) {
 				event_area.hBmpBackground=(HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
-				ModernDBFreeVariant(&dbv);
+				db_free(&dbv);
 			}
 		}
-		event_area.useWinColors = ModernGetSettingByte(NULL, "EventArea", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
-		event_area.backgroundBmpUse = ModernGetSettingWord(NULL, "EventArea", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
+		event_area.useWinColors = db_get_b(NULL, "EventArea", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
+		event_area.backgroundBmpUse = db_get_w(NULL, "EventArea", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
 	}	
 	PostMessage(pcli->hwndContactList,WM_SIZE,0,0);
 	return 0;
@@ -302,8 +302,8 @@ void EventArea_ConfigureEventArea()
 	int iCount = pcli->events.count;
   
     g_CluiData.dwFlags&=~(CLUI_FRAME_AUTOHIDENOTIFY|CLUI_FRAME_SHOWALWAYS);
-    if (ModernGetSettingByte(NULL,"CLUI","EventArea",SETTING_EVENTAREAMODE_DEFAULT)==1) g_CluiData.dwFlags|=CLUI_FRAME_AUTOHIDENOTIFY;
-    if (ModernGetSettingByte(NULL,"CLUI","EventArea",SETTING_EVENTAREAMODE_DEFAULT)==2) g_CluiData.dwFlags|=CLUI_FRAME_SHOWALWAYS;
+    if (db_get_b(NULL,"CLUI","EventArea",SETTING_EVENTAREAMODE_DEFAULT)==1) g_CluiData.dwFlags|=CLUI_FRAME_AUTOHIDENOTIFY;
+    if (db_get_b(NULL,"CLUI","EventArea",SETTING_EVENTAREAMODE_DEFAULT)==2) g_CluiData.dwFlags|=CLUI_FRAME_SHOWALWAYS;
 
 	if (g_CluiData.dwFlags & CLUI_FRAME_SHOWALWAYS)
 		g_CluiData.bNotifyActive = 1;
@@ -451,7 +451,7 @@ int EventArea_Create(HWND hCluiWnd)
     Frame.hWnd=g_CluiData.hwndEventFrame;
     Frame.align=alBottom;
     Frame.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
-    Frame.Flags=(ModernGetSettingByte(NULL,"CLUI","ShowEventArea",SETTING_SHOWEVENTAREAFRAME_DEFAULT)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_NO_SUBCONTAINER|F_TCHAR;
+    Frame.Flags=(db_get_b(NULL,"CLUI","ShowEventArea",SETTING_SHOWEVENTAREAFRAME_DEFAULT)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_NO_SUBCONTAINER|F_TCHAR;
     Frame.height=h;
     Frame.tname=_T("EventArea"); //do not translate
     Frame.TBtname=TranslateT("Event Area");
diff --git a/plugins/Clist_modern/modern_clistmenus.cpp b/plugins/Clist_modern/modern_clistmenus.cpp
index 95e41c4d81..7212e675f0 100644
--- a/plugins/Clist_modern/modern_clistmenus.cpp
+++ b/plugins/Clist_modern/modern_clistmenus.cpp
@@ -79,7 +79,7 @@ static int FAV_OnContactMenuBuild(WPARAM wParam,LPARAM lParam)
 {
 	CLISTMENUITEM mi;
 	BOOL NeedFree=FALSE;
-	BYTE bContactRate=ModernGetSettingByte((HANDLE)wParam, "CList", "Rate",0);
+	BYTE bContactRate=db_get_b((HANDLE)wParam, "CList", "Rate",0);
 	//if (hFavoriteContactMenu)
 
 	static TCHAR * FAVMENUROOTNAME =_T("&Contact rate");
@@ -171,7 +171,7 @@ static int FAV_OnContactMenuBuild(WPARAM wParam,LPARAM lParam)
 		
 		mi.hIcon=NULL;
 		mi.ptszName=_T("Show even if offline");
-		mi.flags=CMIF_CHILDPOPUP|CMIF_TCHAR|(ModernGetSettingByte((HANDLE)wParam,"CList","noOffline",0)?CMIF_CHECKED:0);
+		mi.flags=CMIF_CHILDPOPUP|CMIF_TCHAR|(db_get_b((HANDLE)wParam,"CList","noOffline",0)?CMIF_CHECKED:0);
 		mi.pszService=CLUI_FAVTOGGLESHOWOFFLINE;
 		mi.popupPosition=i+100000000;
 		mi.position=-100000000;
@@ -188,7 +188,7 @@ INT_PTR FAV_SetRate(WPARAM hContact, LPARAM nRate)
 {
 	if (hContact)
 	{
-		ModernWriteSettingByte((HANDLE)hContact, "CList", "Rate",(BYTE)nRate);
+		db_set_b((HANDLE)hContact, "CList", "Rate",(BYTE)nRate);
 	}
 	return 0;
 }
@@ -197,8 +197,8 @@ INT_PTR FAV_ToggleShowOffline(WPARAM hContact,LPARAM lParam)
 {
 	if (hContact)
 	{
-		ModernWriteSettingByte((HANDLE)hContact,"CList","noOffline",
-			ModernGetSettingByte((HANDLE)hContact,"CList","noOffline",0)?0:1);
+		db_set_b((HANDLE)hContact,"CList","noOffline",
+			db_get_b((HANDLE)hContact,"CList","noOffline",0)?0:1);
 	}
 	return 0;
 }
diff --git a/plugins/Clist_modern/modern_clistmod.cpp b/plugins/Clist_modern/modern_clistmod.cpp
index 64143550da..c57f58405e 100644
--- a/plugins/Clist_modern/modern_clistmod.cpp
+++ b/plugins/Clist_modern/modern_clistmod.cpp
@@ -71,7 +71,7 @@ HICON cliGetIconFromStatusMode(HANDLE hContact, const char *szProto,int status)
 	HICON hIcon=NULL;
 	HICON hXIcon=NULL;
 	// check if options is turned on
-	BYTE trayOption=ModernGetSettingByte(NULL,"CLUI","XStatusTray",SETTING_TRAYOPTION_DEFAULT);
+	BYTE trayOption=db_get_b(NULL,"CLUI","XStatusTray",SETTING_TRAYOPTION_DEFAULT);
 	if (trayOption&3 && szProto!=NULL)
 	{
 		// check service exists
@@ -143,7 +143,7 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact)
        char AdvancedService[255]={0};
        int  nActStatus=nStatus;
        HANDLE hActContact=hContact;
-       if (!ModernGetSettingByte(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) && g_szMetaModuleName && !mir_strcmp(szActProto,g_szMetaModuleName))
+       if (!db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) && g_szMetaModuleName && !mir_strcmp(szActProto,g_szMetaModuleName))
        {
             // substitute params by mostonline contact datas
            HANDLE hMostOnlineContact=(HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hActContact,0);
@@ -198,7 +198,7 @@ INT_PTR GetContactIcon(WPARAM wParam,LPARAM lParam)
 	if (szProto == NULL)
 		status = ID_STATUS_OFFLINE;
 	else
-		status = ModernGetSettingWord((HANDLE) wParam, szProto, "Status", ID_STATUS_OFFLINE);
+		status = db_get_w((HANDLE) wParam, szProto, "Status", ID_STATUS_OFFLINE);
     res=ExtIconFromStatusMode((HANDLE)wParam,szProto,szProto==NULL?ID_STATUS_OFFLINE:status); //by FYR
     if (lParam==0 && res!=-1) res&=0xFFFF;
     return res;
@@ -357,7 +357,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) {
 	
 	if (IsIconic(hWnd) || !IsWindowVisible(hWnd))
 		return GWVS_HIDDEN;
-	else if ( ModernGetSettingByte(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT) || !ModernGetSettingByte(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT))
+	else if ( db_get_b(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT) || !db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT))
 		return GWVS_VISIBLE;
 	else if ( hwndFocused == pcli->hwndContactList || GetParent(hwndFocused) == pcli->hwndContactList )
 		return GWVS_VISIBLE;
@@ -474,10 +474,10 @@ int cliShowHide(WPARAM wParam,LPARAM lParam)
 
 	int iVisibleState = GetWindowVisibleState(pcli->hwndContactList,0,0);
 	int method;
-	method=ModernGetSettingByte(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT);; //(0-none, 1-leftedge, 2-rightedge);
+	method=db_get_b(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT);; //(0-none, 1-leftedge, 2-rightedge);
 	if (method)
 	{
-		if (ModernGetSettingByte(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT)==0 && lParam!=1)
+		if (db_get_b(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT)==0 && lParam!=1)
 		{
 			//hide
 			CLUI_HideBehindEdge();
@@ -490,13 +490,13 @@ int cliShowHide(WPARAM wParam,LPARAM lParam)
 		iVisibleState=GWVS_HIDDEN;
 	}
 
-	if (!method && ModernGetSettingByte(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT)>0)
+	if (!method && db_get_b(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT)>0)
 	{
-		g_CluiData.bBehindEdgeSettings=ModernGetSettingByte(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT);
+		g_CluiData.bBehindEdgeSettings=db_get_b(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT);
 		CLUI_ShowFromBehindEdge();
 		g_CluiData.bBehindEdgeSettings=0;
 		g_CluiData.nBehindEdgeState=0;
-		ModernDeleteSetting(NULL, "ModernData", "BehindEdge");
+		db_unset(NULL, "ModernData", "BehindEdge");
 	}
 
 	//bShow is FALSE when we enter the switch if no hide behind edge.
@@ -518,12 +518,12 @@ int cliShowHide(WPARAM wParam,LPARAM lParam)
 		Sync( CLUIFrames_ActivateSubContainers, TRUE );
 		CLUI_ShowWindowMod(pcli->hwndContactList, SW_RESTORE);
 
-		if (!ModernGetSettingByte(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT))
+		if (!db_get_b(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT))
 		{
 			Sync(CLUIFrames_OnShowHide, pcli->hwndContactList,1);	//TO BE PROXIED
 			SetWindowPos(pcli->hwndContactList, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |SWP_NOACTIVATE);
 			g_bCalledFromShowHide=1;
-			if (!ModernGetSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT))
+			if (!db_get_b(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT))
 				SetWindowPos(pcli->hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
 			g_bCalledFromShowHide=0;
 		}
@@ -533,7 +533,7 @@ int cliShowHide(WPARAM wParam,LPARAM lParam)
 			Sync(CLUIFrames_OnShowHide, pcli->hwndContactList,1);
 			SetForegroundWindow(pcli->hwndContactList);
 		}
-		ModernWriteSettingByte(NULL,"CList","State",SETTING_STATE_NORMAL);
+		db_set_b(NULL,"CList","State",SETTING_STATE_NORMAL);
 
 		RECT rcWindow;
 		GetWindowRect(pcli->hwndContactList,&rcWindow);
@@ -551,18 +551,18 @@ int cliShowHide(WPARAM wParam,LPARAM lParam)
 		if (GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)
 		{
 			CListMod_HideWindow(pcli->hwndContactList, SW_HIDE);
-			ModernWriteSettingByte(NULL,"CList","State",SETTING_STATE_HIDDEN);
+			db_set_b(NULL,"CList","State",SETTING_STATE_HIDDEN);
 		}
 		else
 		{
-			if (ModernGetSettingByte(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT)) {
+			if (db_get_b(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT)) {
 				CLUI_ShowWindowMod(pcli->hwndContactList, SW_HIDE);
-				ModernWriteSettingByte(NULL,"CList","State",SETTING_STATE_HIDDEN);
+				db_set_b(NULL,"CList","State",SETTING_STATE_HIDDEN);
 			}
 			else
 			{
 				CLUI_ShowWindowMod(pcli->hwndContactList, SW_MINIMIZE);
-				ModernWriteSettingByte(NULL,"CList","State",SETTING_STATE_MINIMIZED);
+				db_set_b(NULL,"CList","State",SETTING_STATE_MINIMIZED);
 			}
 		}
 
diff --git a/plugins/Clist_modern/modern_clistopts.cpp b/plugins/Clist_modern/modern_clistopts.cpp
index 198678312b..5a3042d8ed 100644
--- a/plugins/Clist_modern/modern_clistopts.cpp
+++ b/plugins/Clist_modern/modern_clistopts.cpp
@@ -96,25 +96,25 @@ static INT_PTR CALLBACK DlgProcItemRowOpts(HWND hwndDlg, UINT msg, WPARAM wParam
             TranslateDialogDefault(hwndDlg);
 			SendDlgItemMessage(hwndDlg,IDC_MIN_ROW_HEIGHT_SPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_MIN_ROW_HEIGHT),0);		// set buddy			
 			SendDlgItemMessage(hwndDlg,IDC_MIN_ROW_HEIGHT_SPIN,UDM_SETRANGE,0,MAKELONG(255,0));
-			SendDlgItemMessage(hwndDlg,IDC_MIN_ROW_HEIGHT_SPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"CList","MinRowHeight",CLCDEFAULT_ROWHEIGHT),0));
+			SendDlgItemMessage(hwndDlg,IDC_MIN_ROW_HEIGHT_SPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","MinRowHeight",CLCDEFAULT_ROWHEIGHT),0));
 
 			SendDlgItemMessage(hwndDlg,IDC_ROW_BORDER_SPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_ROW_BORDER),0);		// set buddy			
 			SendDlgItemMessage(hwndDlg,IDC_ROW_BORDER_SPIN,UDM_SETRANGE,0,MAKELONG(255,0));
-			SendDlgItemMessage(hwndDlg,IDC_ROW_BORDER_SPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"CList","RowBorder",SETTING_ROWBORDER_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_ROW_BORDER_SPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","RowBorder",SETTING_ROWBORDER_DEFAULT),0));
 
-			CheckDlgButton(hwndDlg, IDC_VARIABLE_ROW_HEIGHT, ModernGetSettingByte(NULL,"CList","VariableRowHeight",SETTING_VARIABLEROWHEIGHT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_ALIGN_TO_LEFT, ModernGetSettingByte(NULL,"CList","AlignLeftItemsToLeft",SETTING_ALIGNLEFTTOLEFT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_ALIGN_TO_RIGHT, ModernGetSettingByte(NULL,"CList","AlignRightItemsToRight",SETTING_ALIGNRIGHTORIGHT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_VARIABLE_ROW_HEIGHT, db_get_b(NULL,"CList","VariableRowHeight",SETTING_VARIABLEROWHEIGHT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_ALIGN_TO_LEFT, db_get_b(NULL,"CList","AlignLeftItemsToLeft",SETTING_ALIGNLEFTTOLEFT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_ALIGN_TO_RIGHT, db_get_b(NULL,"CList","AlignRightItemsToRight",SETTING_ALIGNRIGHTORIGHT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
 			
-			CheckDlgButton(hwndDlg, IDC_MINIMODE, ModernGetSettingByte(NULL,"CLC","CompactMode",SETTING_COMPACTMODE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_MINIMODE, db_get_b(NULL,"CLC","CompactMode",SETTING_COMPACTMODE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
 
 			SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_LEFTMARGIN),0);		// set buddy			
 			SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETRANGE,0,MAKELONG(64,0));
-			SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingByte(NULL,"CLC","LeftMargin",CLCDEFAULT_LEFTMARGIN),0));
+			SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETPOS,0,MAKELONG(db_get_b(NULL,"CLC","LeftMargin",CLCDEFAULT_LEFTMARGIN),0));
 
 			SendDlgItemMessage(hwndDlg,IDC_RIGHTMARGINSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_RIGHTMARGIN),0);		// set buddy			
 			SendDlgItemMessage(hwndDlg,IDC_RIGHTMARGINSPIN,UDM_SETRANGE,0,MAKELONG(64,0));
-			SendDlgItemMessage(hwndDlg,IDC_RIGHTMARGINSPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingByte(NULL,"CLC","RightMargin",CLCDEFAULT_RIGHTMARGIN),0));
+			SendDlgItemMessage(hwndDlg,IDC_RIGHTMARGINSPIN,UDM_SETPOS,0,MAKELONG(db_get_b(NULL,"CLC","RightMargin",CLCDEFAULT_RIGHTMARGIN),0));
 
 			// Listbox
 			hwndList = GetDlgItem(hwndDlg, IDC_LIST_ORDER);
@@ -126,7 +126,7 @@ static INT_PTR CALLBACK DlgProcItemRowOpts(HWND hwndDlg, UINT msg, WPARAM wParam
 				int pos=0;
 
 				mir_snprintf(tmp, SIZEOF(tmp), "RowPos%d", i);
-				type = ModernGetSettingWord(NULL, "CList", tmp, i);
+				type = db_get_w(NULL, "CList", tmp, i);
 
 				switch(type)
 				{
@@ -316,21 +316,21 @@ static INT_PTR CALLBACK DlgProcItemRowOpts(HWND hwndDlg, UINT msg, WPARAM wParam
 							int i;
 							HWND hwndList;
 
-							ModernWriteSettingWord(NULL,"CList","MinRowHeight",(WORD)SendDlgItemMessage(hwndDlg,IDC_MIN_ROW_HEIGHT_SPIN,UDM_GETPOS,0,0));
-							ModernWriteSettingWord(NULL,"CList","RowBorder",(WORD)SendDlgItemMessage(hwndDlg,IDC_ROW_BORDER_SPIN,UDM_GETPOS,0,0));
-							ModernWriteSettingByte(NULL,"CList","VariableRowHeight", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_VARIABLE_ROW_HEIGHT));
-							ModernWriteSettingByte(NULL,"CList","AlignLeftItemsToLeft", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALIGN_TO_LEFT));
-							ModernWriteSettingByte(NULL,"CList","AlignRightItemsToRight", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALIGN_TO_RIGHT));
-							ModernWriteSettingByte(NULL,"CLC","CompactMode", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_MINIMODE));
-							ModernWriteSettingByte(NULL,"CLC","LeftMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_GETPOS,0,0));
-							ModernWriteSettingByte(NULL,"CLC","RightMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_RIGHTMARGINSPIN,UDM_GETPOS,0,0));
+							db_set_w(NULL,"CList","MinRowHeight",(WORD)SendDlgItemMessage(hwndDlg,IDC_MIN_ROW_HEIGHT_SPIN,UDM_GETPOS,0,0));
+							db_set_w(NULL,"CList","RowBorder",(WORD)SendDlgItemMessage(hwndDlg,IDC_ROW_BORDER_SPIN,UDM_GETPOS,0,0));
+							db_set_b(NULL,"CList","VariableRowHeight", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_VARIABLE_ROW_HEIGHT));
+							db_set_b(NULL,"CList","AlignLeftItemsToLeft", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALIGN_TO_LEFT));
+							db_set_b(NULL,"CList","AlignRightItemsToRight", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALIGN_TO_RIGHT));
+							db_set_b(NULL,"CLC","CompactMode", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_MINIMODE));
+							db_set_b(NULL,"CLC","LeftMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_GETPOS,0,0));
+							db_set_b(NULL,"CLC","RightMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_RIGHTMARGINSPIN,UDM_GETPOS,0,0));
 
 							hwndList = GetDlgItem(hwndDlg, IDC_LIST_ORDER);
 							for(i = 0 ; i < NUM_ITEM_TYPE ; i++)
 							{
 								char tmp[128];
 								mir_snprintf(tmp, SIZEOF(tmp), "RowPos%d", i);
-								ModernWriteSettingWord(NULL,"CList",tmp,(WORD)SendMessage(hwndList, LB_GETITEMDATA, i, 0));
+								db_set_w(NULL,"CList",tmp,(WORD)SendMessage(hwndList, LB_GETITEMDATA, i, 0));
 							}
 
 							ClcOptionsChanged();
@@ -354,16 +354,16 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa
 	case WM_INITDIALOG:
 		{
             TranslateDialogDefault(hwndDlg);
-			CheckDlgButton(hwndDlg, IDC_SHOW_AVATARS, ModernGetSettingByte(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, ModernGetSettingByte(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP)&&!g_CluiData.fGDIPlusFail)) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_AVATAR_FASTDRAW, ModernGetSettingByte(NULL,"CList","AvatarsInSeparateWnd",SETTINGS_AVATARINSEPARATE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); 
-			CheckDlgButton(hwndDlg, IDC_AVATAR_DRAW_BORDER, ModernGetSettingByte(NULL,"CList","AvatarsDrawBorders",SETTINGS_AVATARDRAWBORDER_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_AVATAR_ROUND_CORNERS, ModernGetSettingByte(NULL,"CList","AvatarsRoundCorners",SETTINGS_AVATARROUNDCORNERS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK, ModernGetSettingByte(NULL,"CList","AvatarsUseCustomCornerSize",SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_AVATAR_IGNORE_SIZE, ModernGetSettingByte(NULL,"CList","AvatarsIgnoreSizeForRow",SETTINGS_AVATARIGNORESIZEFORROW_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_AVATAR_OVERLAY_ICONS, ModernGetSettingByte(NULL,"CList","AvatarsDrawOverlay",SETTINGS_AVATARDRAWOVERLAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_SHOW_AVATARS, db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP)&&!g_CluiData.fGDIPlusFail)) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_AVATAR_FASTDRAW, db_get_b(NULL,"CList","AvatarsInSeparateWnd",SETTINGS_AVATARINSEPARATE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); 
+			CheckDlgButton(hwndDlg, IDC_AVATAR_DRAW_BORDER, db_get_b(NULL,"CList","AvatarsDrawBorders",SETTINGS_AVATARDRAWBORDER_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_AVATAR_ROUND_CORNERS, db_get_b(NULL,"CList","AvatarsRoundCorners",SETTINGS_AVATARROUNDCORNERS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK, db_get_b(NULL,"CList","AvatarsUseCustomCornerSize",SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_AVATAR_IGNORE_SIZE, db_get_b(NULL,"CList","AvatarsIgnoreSizeForRow",SETTINGS_AVATARIGNORESIZEFORROW_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_AVATAR_OVERLAY_ICONS, db_get_b(NULL,"CList","AvatarsDrawOverlay",SETTINGS_AVATARDRAWOVERLAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
 			
-			switch(ModernGetSettingByte(NULL,"CList","AvatarsOverlayType",SETTINGS_AVATAROVERLAYTYPE_DEFAULT))
+			switch(db_get_b(NULL,"CList","AvatarsOverlayType",SETTINGS_AVATAROVERLAYTYPE_DEFAULT))
 			{
 			case SETTING_AVATAR_OVERLAY_TYPE_NORMAL:
 				{
@@ -384,17 +384,17 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa
 
 			SendDlgItemMessage(hwndDlg,IDC_AVATAR_SIZE_SPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_AVATAR_SIZE),0);		// set buddy			
 			SendDlgItemMessage(hwndDlg,IDC_AVATAR_SIZE_SPIN,UDM_SETRANGE,0,MAKELONG(255,1));
-			SendDlgItemMessage(hwndDlg,IDC_AVATAR_SIZE_SPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"CList","AvatarsSize",SETTING_AVATARHEIGHT_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_AVATAR_SIZE_SPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","AvatarsSize",SETTING_AVATARHEIGHT_DEFAULT),0));
 
 			SendDlgItemMessage(hwndDlg,IDC_AVATAR_WIDTH_SPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_AVATAR_WIDTH),0);		// set buddy			
 			SendDlgItemMessage(hwndDlg,IDC_AVATAR_WIDTH_SPIN,UDM_SETRANGE,0,MAKELONG(255,0));
-			SendDlgItemMessage(hwndDlg,IDC_AVATAR_WIDTH_SPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"CList","AvatarsWidth",SETTING_AVATARWIDTH_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_AVATAR_WIDTH_SPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","AvatarsWidth",SETTING_AVATARWIDTH_DEFAULT),0));
 
 			SendDlgItemMessage(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE),0);		// set buddy
 			SendDlgItemMessage(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN,UDM_SETRANGE,0,MAKELONG(255,1));
-			SendDlgItemMessage(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"CList","AvatarsCustomCornerSize",SETTINGS_AVATARCORNERSIZE_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","AvatarsCustomCornerSize",SETTINGS_AVATARCORNERSIZE_DEFAULT),0));
 
-			SendDlgItemMessage(hwndDlg, IDC_AVATAR_BORDER_COLOR, CPM_SETCOLOUR, 0, (COLORREF)ModernGetSettingDword(NULL,"CList","AvatarsBorderColor",SETTINGS_AVATARBORDERCOLOR_DEFAULT));
+			SendDlgItemMessage(hwndDlg, IDC_AVATAR_BORDER_COLOR, CPM_SETCOLOUR, 0, (COLORREF)db_get_dw(NULL,"CList","AvatarsBorderColor",SETTINGS_AVATARBORDERCOLOR_DEFAULT));
 
 			if (!IsDlgButtonChecked(hwndDlg,IDC_SHOW_AVATARS)) 
 			{
@@ -541,26 +541,26 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa
 					{
 					case PSN_APPLY:
 						{
-							ModernWriteSettingByte(NULL,"CList","AvatarsShow", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW_AVATARS));
-							ModernWriteSettingByte(NULL,"CList","AvatarsAnimated", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW_ANIAVATARS));
-							ModernWriteSettingByte(NULL,"CList","AvatarsInSeparateWnd", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_AVATAR_FASTDRAW));
-
-							ModernWriteSettingByte(NULL,"CList","AvatarsDrawBorders", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_AVATAR_DRAW_BORDER));
-							ModernWriteSettingDword(NULL,"CList","AvatarsBorderColor", (DWORD)SendDlgItemMessage(hwndDlg, IDC_AVATAR_BORDER_COLOR, CPM_GETCOLOUR, 0, 0));
-							ModernWriteSettingByte(NULL,"CList","AvatarsRoundCorners", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_AVATAR_ROUND_CORNERS));
-							ModernWriteSettingByte(NULL,"CList","AvatarsIgnoreSizeForRow", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_AVATAR_IGNORE_SIZE));
-							ModernWriteSettingByte(NULL,"CList","AvatarsUseCustomCornerSize", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK));
-							ModernWriteSettingWord(NULL,"CList","AvatarsCustomCornerSize",(WORD)SendDlgItemMessage(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN,UDM_GETPOS,0,0));
-							ModernWriteSettingByte(NULL,"CList","AvatarsDrawOverlay", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_AVATAR_OVERLAY_ICONS));
-							ModernWriteSettingWord(NULL,"CList","AvatarsSize",(WORD)SendDlgItemMessage(hwndDlg,IDC_AVATAR_SIZE_SPIN,UDM_GETPOS,0,0));
-							ModernWriteSettingWord(NULL,"CList","AvatarsWidth",(WORD)SendDlgItemMessage(hwndDlg,IDC_AVATAR_WIDTH_SPIN,UDM_GETPOS,0,0));
+							db_set_b(NULL,"CList","AvatarsShow", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW_AVATARS));
+							db_set_b(NULL,"CList","AvatarsAnimated", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW_ANIAVATARS));
+							db_set_b(NULL,"CList","AvatarsInSeparateWnd", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_AVATAR_FASTDRAW));
+
+							db_set_b(NULL,"CList","AvatarsDrawBorders", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_AVATAR_DRAW_BORDER));
+							db_set_dw(NULL,"CList","AvatarsBorderColor", (DWORD)SendDlgItemMessage(hwndDlg, IDC_AVATAR_BORDER_COLOR, CPM_GETCOLOUR, 0, 0));
+							db_set_b(NULL,"CList","AvatarsRoundCorners", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_AVATAR_ROUND_CORNERS));
+							db_set_b(NULL,"CList","AvatarsIgnoreSizeForRow", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_AVATAR_IGNORE_SIZE));
+							db_set_b(NULL,"CList","AvatarsUseCustomCornerSize", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK));
+							db_set_w(NULL,"CList","AvatarsCustomCornerSize",(WORD)SendDlgItemMessage(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN,UDM_GETPOS,0,0));
+							db_set_b(NULL,"CList","AvatarsDrawOverlay", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_AVATAR_OVERLAY_ICONS));
+							db_set_w(NULL,"CList","AvatarsSize",(WORD)SendDlgItemMessage(hwndDlg,IDC_AVATAR_SIZE_SPIN,UDM_GETPOS,0,0));
+							db_set_w(NULL,"CList","AvatarsWidth",(WORD)SendDlgItemMessage(hwndDlg,IDC_AVATAR_WIDTH_SPIN,UDM_GETPOS,0,0));
 
 							if (IsDlgButtonChecked(hwndDlg,IDC_AVATAR_OVERLAY_ICON_NORMAL))
-								ModernWriteSettingByte(NULL,"CList","AvatarsOverlayType",SETTING_AVATAR_OVERLAY_TYPE_NORMAL);
+								db_set_b(NULL,"CList","AvatarsOverlayType",SETTING_AVATAR_OVERLAY_TYPE_NORMAL);
 							else if (IsDlgButtonChecked(hwndDlg,IDC_AVATAR_OVERLAY_ICON_PROTOCOL))
-								ModernWriteSettingByte(NULL,"CList","AvatarsOverlayType",SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL);
+								db_set_b(NULL,"CList","AvatarsOverlayType",SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL);
 							else if (IsDlgButtonChecked(hwndDlg,IDC_AVATAR_OVERLAY_ICON_CONTACT))
-								ModernWriteSettingByte(NULL,"CList","AvatarsOverlayType",SETTING_AVATAR_OVERLAY_TYPE_CONTACT);
+								db_set_b(NULL,"CList","AvatarsOverlayType",SETTING_AVATAR_OVERLAY_TYPE_CONTACT);
 							ClcOptionsChanged();
 							AniAva_UpdateOptions();
 							return TRUE;
@@ -584,14 +584,14 @@ static INT_PTR CALLBACK DlgProcItemIconOpts(HWND hwndDlg, UINT msg, WPARAM wPara
 	case WM_INITDIALOG:
 		{
             TranslateDialogDefault(hwndDlg);
-			CheckDlgButton(hwndDlg, IDC_HIDE_ICON_ON_AVATAR, ModernGetSettingByte(NULL,"CList","IconHideOnAvatar",SETTING_HIDEICONONAVATAR_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_DRAW_ON_AVATAR_SPACE, ModernGetSettingByte(NULL,"CList","IconDrawOnAvatarSpace",SETTING_ICONONAVATARPLACE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_ICONBLINK, ModernGetSettingByte(NULL,"CList","NoIconBlink",SETTING_NOICONBLINF_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_HIDE_GROUPSICON, ModernGetSettingByte(NULL,"CList","HideGroupsIcon",SETTING_HIDEGROUPSICON_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_NOTCHECKICONSIZE, ModernGetSettingByte(NULL,"CList","IconIgnoreSizeForRownHeight",SETTING_ICONIGNORESIZE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_ALWAYS_VISIBLEICON, ModernGetSettingByte(NULL,"CList","AlwaysShowAlwaysVisIcon",SETTING_ALWAYSVISICON_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_USEXSTATUS, (ModernGetSettingByte(NULL,"CLC","DrawOverlayedStatus",SETTING_DRAWOVERLAYEDSTATUS_DEFAULT)&1) ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_DRAWSTATUSOVERLAY, (ModernGetSettingByte(NULL,"CLC","DrawOverlayedStatus",SETTING_DRAWOVERLAYEDSTATUS_DEFAULT)&2) ? BST_CHECKED : BST_UNCHECKED );			
+			CheckDlgButton(hwndDlg, IDC_HIDE_ICON_ON_AVATAR, db_get_b(NULL,"CList","IconHideOnAvatar",SETTING_HIDEICONONAVATAR_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_DRAW_ON_AVATAR_SPACE, db_get_b(NULL,"CList","IconDrawOnAvatarSpace",SETTING_ICONONAVATARPLACE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_ICONBLINK, db_get_b(NULL,"CList","NoIconBlink",SETTING_NOICONBLINF_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_HIDE_GROUPSICON, db_get_b(NULL,"CList","HideGroupsIcon",SETTING_HIDEGROUPSICON_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_NOTCHECKICONSIZE, db_get_b(NULL,"CList","IconIgnoreSizeForRownHeight",SETTING_ICONIGNORESIZE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_ALWAYS_VISIBLEICON, db_get_b(NULL,"CList","AlwaysShowAlwaysVisIcon",SETTING_ALWAYSVISICON_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_USEXSTATUS, (db_get_b(NULL,"CLC","DrawOverlayedStatus",SETTING_DRAWOVERLAYEDSTATUS_DEFAULT)&1) ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_DRAWSTATUSOVERLAY, (db_get_b(NULL,"CLC","DrawOverlayedStatus",SETTING_DRAWOVERLAYEDSTATUS_DEFAULT)&2) ? BST_CHECKED : BST_UNCHECKED );			
 			EnableWindow(GetDlgItem(hwndDlg,IDC_DRAWSTATUSOVERLAY),IsDlgButtonChecked(hwndDlg,IDC_USEXSTATUS));
 
 			if (!IsDlgButtonChecked(hwndDlg,IDC_HIDE_ICON_ON_AVATAR))
@@ -629,17 +629,17 @@ static INT_PTR CALLBACK DlgProcItemIconOpts(HWND hwndDlg, UINT msg, WPARAM wPara
 					{
 					case PSN_APPLY:
 						{
-							ModernWriteSettingByte(NULL,"CList","IconHideOnAvatar", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDE_ICON_ON_AVATAR));
-							ModernWriteSettingByte(NULL,"CList","IconDrawOnAvatarSpace", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_DRAW_ON_AVATAR_SPACE));
-							ModernWriteSettingByte(NULL,"CList","HideGroupsIcon", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDE_GROUPSICON));						
-							ModernWriteSettingByte(NULL,"CList","NoIconBlink", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ICONBLINK));
-							ModernWriteSettingByte(NULL,"CList","IconIgnoreSizeForRownHeight", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_NOTCHECKICONSIZE));
-							ModernWriteSettingByte(NULL,"CList","AlwaysShowAlwaysVisIcon", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALWAYS_VISIBLEICON));
+							db_set_b(NULL,"CList","IconHideOnAvatar", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDE_ICON_ON_AVATAR));
+							db_set_b(NULL,"CList","IconDrawOnAvatarSpace", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_DRAW_ON_AVATAR_SPACE));
+							db_set_b(NULL,"CList","HideGroupsIcon", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDE_GROUPSICON));						
+							db_set_b(NULL,"CList","NoIconBlink", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ICONBLINK));
+							db_set_b(NULL,"CList","IconIgnoreSizeForRownHeight", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_NOTCHECKICONSIZE));
+							db_set_b(NULL,"CList","AlwaysShowAlwaysVisIcon", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALWAYS_VISIBLEICON));
 						
 							{
 								BYTE ovr=IsDlgButtonChecked(hwndDlg,IDC_USEXSTATUS)?1:0;
 								if (ovr) ovr+=IsDlgButtonChecked(hwndDlg,IDC_DRAWSTATUSOVERLAY)?2:0;
-								ModernWriteSettingByte(NULL,"CLC","DrawOverlayedStatus", ovr );
+								db_set_b(NULL,"CLC","DrawOverlayedStatus", ovr );
 							}
 							ClcOptionsChanged();
 							return TRUE;
@@ -663,8 +663,8 @@ static INT_PTR CALLBACK DlgProcItemContactTimeOpts(HWND hwndDlg, UINT msg, WPARA
 	case WM_INITDIALOG:
 		{
             TranslateDialogDefault(hwndDlg);
-			CheckDlgButton(hwndDlg, IDC_SHOW, ModernGetSettingByte(NULL,"CList","ContactTimeShow",SETTING_SHOWTIME_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_SHOW_ONLY_IF_DIFFERENT, ModernGetSettingByte(NULL,"CList","ContactTimeShowOnlyIfDifferent",SETTING_SHOWTIMEIFDIFF_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_SHOW, db_get_b(NULL,"CList","ContactTimeShow",SETTING_SHOWTIME_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_SHOW_ONLY_IF_DIFFERENT, db_get_b(NULL,"CList","ContactTimeShowOnlyIfDifferent",SETTING_SHOWTIMEIFDIFF_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
 
 			break;
 		}
@@ -683,8 +683,8 @@ static INT_PTR CALLBACK DlgProcItemContactTimeOpts(HWND hwndDlg, UINT msg, WPARA
 					{
 					case PSN_APPLY:
 						{
-							ModernWriteSettingByte(NULL,"CList","ContactTimeShow", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW));
-							ModernWriteSettingByte(NULL,"CList","ContactTimeShowOnlyIfDifferent", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW_ONLY_IF_DIFFERENT));
+							db_set_b(NULL,"CList","ContactTimeShow", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW));
+							db_set_b(NULL,"CList","ContactTimeShowOnlyIfDifferent", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW_ONLY_IF_DIFFERENT));
 							ClcOptionsChanged();
 							return TRUE;
 						}
@@ -707,24 +707,24 @@ static INT_PTR CALLBACK DlgProcItemTextOpts(HWND hwndDlg, UINT msg, WPARAM wPara
 	case WM_INITDIALOG:
 		{
             TranslateDialogDefault(hwndDlg);
-			CheckDlgButton(hwndDlg, IDC_RTL, ModernGetSettingByte(NULL,"CList","TextRTL",SETTING_TEXT_RTL_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_RTL, db_get_b(NULL,"CList","TextRTL",SETTING_TEXT_RTL_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
 			//TODO: init IDC_ALIGNGROUPCOMBO from DBGetContactSettingByte(NULL,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT);
 			{
 				int i, item;
 				TCHAR *align[]={_T("Left align group names"), _T("Center group names"), _T("Right align group names")};
 				for (i=0; i<sizeof(align)/sizeof(char*); i++) 
 					item=SendDlgItemMessage(hwndDlg,IDC_ALIGNGROUPCOMBO,CB_ADDSTRING,0,(LPARAM)TranslateTS(align[i]));
-				SendDlgItemMessage(hwndDlg,IDC_ALIGNGROUPCOMBO,CB_SETCURSEL,ModernGetSettingByte(NULL,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT),0);
+				SendDlgItemMessage(hwndDlg,IDC_ALIGNGROUPCOMBO,CB_SETCURSEL,db_get_b(NULL,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT),0);
 			}
-			CheckDlgButton(hwndDlg, IDC_ALIGN_RIGHT, ModernGetSettingByte(NULL,"CList","TextAlignToRight",SETTING_TEXT_RIGHTALIGN_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_REPLACE_SMILEYS, ModernGetSettingByte(NULL,"CList","TextReplaceSmileys",SETTING_TEXT_SMILEY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_RESIZE_SMILEYS, ModernGetSettingByte(NULL,"CList","TextResizeSmileys",SETTING_TEXT_RESIZESMILEY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_USE_PROTOCOL_SMILEYS, ModernGetSettingByte(NULL,"CList","TextUseProtocolSmileys",SETTING_TEXT_PROTOSMILEY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_IGNORE_SIZE, ModernGetSettingByte(NULL,"CList","TextIgnoreSizeForRownHeight",SETTING_TEXT_IGNORESIZE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_ALIGN_RIGHT, db_get_b(NULL,"CList","TextAlignToRight",SETTING_TEXT_RIGHTALIGN_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_REPLACE_SMILEYS, db_get_b(NULL,"CList","TextReplaceSmileys",SETTING_TEXT_SMILEY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_RESIZE_SMILEYS, db_get_b(NULL,"CList","TextResizeSmileys",SETTING_TEXT_RESIZESMILEY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_USE_PROTOCOL_SMILEYS, db_get_b(NULL,"CList","TextUseProtocolSmileys",SETTING_TEXT_PROTOSMILEY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_IGNORE_SIZE, db_get_b(NULL,"CList","TextIgnoreSizeForRownHeight",SETTING_TEXT_IGNORESIZE_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
 
-			CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS_ON_FIRST_LINE, ModernGetSettingByte(NULL,"CList","FirstLineDrawSmileys",SETTING_FIRSTLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_APPEND_NICK, ModernGetSettingByte(NULL,"CList","FirstLineAppendNick",SETTING_FIRSTLINE_APPENDNICK_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
-			CheckDlgButton(hwndDlg, IDC_TRIM_TEXT, ModernGetSettingByte(NULL,"CList","TrimText",SETTING_FIRSTLINE_TRIMTEXT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS_ON_FIRST_LINE, db_get_b(NULL,"CList","FirstLineDrawSmileys",SETTING_FIRSTLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_APPEND_NICK, db_get_b(NULL,"CList","FirstLineAppendNick",SETTING_FIRSTLINE_APPENDNICK_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_TRIM_TEXT, db_get_b(NULL,"CList","TrimText",SETTING_FIRSTLINE_TRIMTEXT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
 
 			bool smileAddPresent = ServiceExists(MS_SMILEYADD_BATCHPARSE) != 0; 
 			CLUI_ShowWindowMod(GetDlgItem(hwndDlg,IDC_REPLACE_SMILEYS), smileAddPresent ? SW_SHOW : SW_HIDE);
@@ -762,17 +762,17 @@ static INT_PTR CALLBACK DlgProcItemTextOpts(HWND hwndDlg, UINT msg, WPARAM wPara
 					{
 					case PSN_APPLY:
 						{
-							ModernWriteSettingByte(NULL,"CList","TextRTL", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_RTL));
+							db_set_b(NULL,"CList","TextRTL", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_RTL));
 							//TODO: Store IDC_ALIGNGROUPCOMBO at DBGetContactSettingByte(NULL,"CList","AlignGroupCaptions",SETTING_ALIGNGROPCAPTION_DEFAULT);
-							ModernWriteSettingByte(NULL,"CList","AlignGroupCaptions",(BYTE)SendDlgItemMessage(hwndDlg,IDC_ALIGNGROUPCOMBO,CB_GETCURSEL,0,0));
-							ModernWriteSettingByte(NULL,"CList","TextAlignToRight", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALIGN_RIGHT));
-							ModernWriteSettingByte(NULL,"CList","TextReplaceSmileys", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_REPLACE_SMILEYS));
-							ModernWriteSettingByte(NULL,"CList","TextResizeSmileys", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_RESIZE_SMILEYS));
-							ModernWriteSettingByte(NULL,"CList","TextUseProtocolSmileys", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_USE_PROTOCOL_SMILEYS));
-							ModernWriteSettingByte(NULL,"CList","TextIgnoreSizeForRownHeight", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_IGNORE_SIZE));
-							ModernWriteSettingByte(NULL,"CList","FirstLineDrawSmileys", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_DRAW_SMILEYS_ON_FIRST_LINE));
-							ModernWriteSettingByte(NULL,"CList","FirstLineAppendNick", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_APPEND_NICK));
-							ModernWriteSettingByte(NULL,"CList","TrimText", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_TRIM_TEXT));
+							db_set_b(NULL,"CList","AlignGroupCaptions",(BYTE)SendDlgItemMessage(hwndDlg,IDC_ALIGNGROUPCOMBO,CB_GETCURSEL,0,0));
+							db_set_b(NULL,"CList","TextAlignToRight", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_ALIGN_RIGHT));
+							db_set_b(NULL,"CList","TextReplaceSmileys", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_REPLACE_SMILEYS));
+							db_set_b(NULL,"CList","TextResizeSmileys", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_RESIZE_SMILEYS));
+							db_set_b(NULL,"CList","TextUseProtocolSmileys", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_USE_PROTOCOL_SMILEYS));
+							db_set_b(NULL,"CList","TextIgnoreSizeForRownHeight", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_IGNORE_SIZE));
+							db_set_b(NULL,"CList","FirstLineDrawSmileys", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_DRAW_SMILEYS_ON_FIRST_LINE));
+							db_set_b(NULL,"CList","FirstLineAppendNick", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_APPEND_NICK));
+							db_set_b(NULL,"CList","TrimText", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_TRIM_TEXT));
 							ClcOptionsChanged();						
 							return TRUE;
 						}
@@ -796,26 +796,26 @@ static INT_PTR CALLBACK DlgProcItemSecondLineOpts(HWND hwndDlg, UINT msg, WPARAM
 		{
 			int radio;
             TranslateDialogDefault(hwndDlg);
-			CheckDlgButton(hwndDlg, IDC_SHOW, ModernGetSettingByte(NULL,"CList","SecondLineShow",SETTING_SECONDLINE_SHOW_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_SHOW, db_get_b(NULL,"CList","SecondLineShow",SETTING_SECONDLINE_SHOW_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
 
 			SendDlgItemMessage(hwndDlg,IDC_TOP_SPACE_SPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_TOP_SPACE),0);		// set buddy			
 			SendDlgItemMessage(hwndDlg,IDC_TOP_SPACE_SPIN,UDM_SETRANGE,0,MAKELONG(255,0));
-			SendDlgItemMessage(hwndDlg,IDC_TOP_SPACE_SPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"CList","SecondLineTopSpace",SETTING_SECONDLINE_TOPSPACE_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_TOP_SPACE_SPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","SecondLineTopSpace",SETTING_SECONDLINE_TOPSPACE_DEFAULT),0));
 
-			CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS, ModernGetSettingByte(NULL,"CList","SecondLineDrawSmileys",SETTING_SECONDLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS, db_get_b(NULL,"CList","SecondLineDrawSmileys",SETTING_SECONDLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
 
 			{
 				DBVARIANT dbv={0};
 
-				if (!ModernGetSettingTString(NULL, "CList","SecondLineText", &dbv))
+				if (!DBGetContactSettingTString(NULL, "CList","SecondLineText", &dbv))
 				{
 					SetWindowText(GetDlgItem(hwndDlg,IDC_VARIABLE_TEXT), dbv.ptszVal);
-					ModernDBFreeVariant(&dbv);
+					db_free(&dbv);
 				}
 			}
 			SendMessage(GetDlgItem(hwndDlg,IDC_VARIABLE_TEXT), EM_SETLIMITTEXT, TEXT_TEXT_MAX_LENGTH, 0);
 
-			radio = ModernGetSettingWord(NULL,"CList","SecondLineType",TEXT_STATUS_MESSAGE);
+			radio = db_get_w(NULL,"CList","SecondLineType",TEXT_STATUS_MESSAGE);
 
 			CheckDlgButton(hwndDlg, IDC_STATUS, radio == TEXT_STATUS ? BST_CHECKED : BST_UNCHECKED );
 			CheckDlgButton(hwndDlg, IDC_NICKNAME, radio == TEXT_NICKNAME ? BST_CHECKED : BST_UNCHECKED );
@@ -824,10 +824,10 @@ static INT_PTR CALLBACK DlgProcItemSecondLineOpts(HWND hwndDlg, UINT msg, WPARAM
 			CheckDlgButton(hwndDlg, IDC_CONTACT_TIME, radio == TEXT_CONTACT_TIME ? BST_CHECKED : BST_UNCHECKED );
 			CheckDlgButton(hwndDlg, IDC_TEXT, radio == TEXT_TEXT ? BST_CHECKED : BST_UNCHECKED );
 
-			CheckDlgButton(hwndDlg, IDC_XSTATUS_HAS_PRIORITY, ModernGetSettingByte(NULL,"CList","SecondLineXStatusHasPriority",SETTING_SECONDLINE_XSTATUS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
-			CheckDlgButton(hwndDlg, IDC_SHOW_STATUS_IF_NOAWAY, ModernGetSettingByte(NULL,"CList","SecondLineShowStatusIfNoAway",SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
-			CheckDlgButton(hwndDlg, IDC_SHOW_LISTENING_IF_NOAWAY, ModernGetSettingByte(NULL,"CList","SecondLineShowListeningIfNoAway",SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
-			CheckDlgButton(hwndDlg, IDC_USE_NAME_AND_MESSAGE, ModernGetSettingByte(NULL,"CList","SecondLineUseNameAndMessageForXStatus",SETTING_SECONDLINE_XSTATUSNAMETEXT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_XSTATUS_HAS_PRIORITY, db_get_b(NULL,"CList","SecondLineXStatusHasPriority",SETTING_SECONDLINE_XSTATUS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_SHOW_STATUS_IF_NOAWAY, db_get_b(NULL,"CList","SecondLineShowStatusIfNoAway",SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_SHOW_LISTENING_IF_NOAWAY, db_get_b(NULL,"CList","SecondLineShowListeningIfNoAway",SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_USE_NAME_AND_MESSAGE, db_get_b(NULL,"CList","SecondLineUseNameAndMessageForXStatus",SETTING_SECONDLINE_XSTATUSNAMETEXT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
 
 			if (!IsDlgButtonChecked(hwndDlg,IDC_SHOW))
 			{
@@ -940,9 +940,9 @@ static INT_PTR CALLBACK DlgProcItemSecondLineOpts(HWND hwndDlg, UINT msg, WPARAM
 						{
 							int radio;
 
-							ModernWriteSettingByte(NULL,"CList","SecondLineShow", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW));
-							ModernWriteSettingWord(NULL,"CList","SecondLineTopSpace", (WORD)SendDlgItemMessage(hwndDlg,IDC_TOP_SPACE_SPIN,UDM_GETPOS,0,0));
-							ModernWriteSettingByte(NULL,"CList","SecondLineDrawSmileys", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_DRAW_SMILEYS));
+							db_set_b(NULL,"CList","SecondLineShow", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW));
+							db_set_w(NULL,"CList","SecondLineTopSpace", (WORD)SendDlgItemMessage(hwndDlg,IDC_TOP_SPACE_SPIN,UDM_GETPOS,0,0));
+							db_set_b(NULL,"CList","SecondLineDrawSmileys", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_DRAW_SMILEYS));
 
 							if (IsDlgButtonChecked(hwndDlg,IDC_STATUS))
 								radio = TEXT_STATUS;
@@ -956,7 +956,7 @@ static INT_PTR CALLBACK DlgProcItemSecondLineOpts(HWND hwndDlg, UINT msg, WPARAM
 								radio = TEXT_LISTENING_TO;
 							else
 								radio = TEXT_STATUS_MESSAGE;
-							ModernWriteSettingWord(NULL,"CList","SecondLineType", (WORD)radio);
+							db_set_w(NULL,"CList","SecondLineType", (WORD)radio);
 
 							{
 								TCHAR t[TEXT_TEXT_MAX_LENGTH];
@@ -964,13 +964,13 @@ static INT_PTR CALLBACK DlgProcItemSecondLineOpts(HWND hwndDlg, UINT msg, WPARAM
 								GetWindowText(GetDlgItem(hwndDlg,IDC_VARIABLE_TEXT), t, SIZEOF(t));
 								t[TEXT_TEXT_MAX_LENGTH - 1] = '\0';
 
-								ModernWriteSettingTString(NULL, "CList", "SecondLineText", t);
+								db_set_ws(NULL, "CList", "SecondLineText", t);
 							}
 
-							ModernWriteSettingByte(NULL,"CList","SecondLineXStatusHasPriority", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_XSTATUS_HAS_PRIORITY));
-							ModernWriteSettingByte(NULL,"CList","SecondLineShowStatusIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW_STATUS_IF_NOAWAY));
-							ModernWriteSettingByte(NULL,"CList","SecondLineShowListeningIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW_LISTENING_IF_NOAWAY));
-							ModernWriteSettingByte(NULL,"CList","SecondLineUseNameAndMessageForXStatus", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_USE_NAME_AND_MESSAGE));
+							db_set_b(NULL,"CList","SecondLineXStatusHasPriority", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_XSTATUS_HAS_PRIORITY));
+							db_set_b(NULL,"CList","SecondLineShowStatusIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW_STATUS_IF_NOAWAY));
+							db_set_b(NULL,"CList","SecondLineShowListeningIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW_LISTENING_IF_NOAWAY));
+							db_set_b(NULL,"CList","SecondLineUseNameAndMessageForXStatus", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_USE_NAME_AND_MESSAGE));
 							ClcOptionsChanged();
 							return TRUE;
 						}
@@ -993,26 +993,26 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM
 		{
 			int radio;
             TranslateDialogDefault(hwndDlg);
-			CheckDlgButton(hwndDlg, IDC_SHOW, ModernGetSettingByte(NULL,"CList","ThirdLineShow",SETTING_THIRDLINE_SHOW_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_SHOW, db_get_b(NULL,"CList","ThirdLineShow",SETTING_THIRDLINE_SHOW_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
 
 			SendDlgItemMessage(hwndDlg,IDC_TOP_SPACE_SPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_TOP_SPACE),0);		// set buddy			
 			SendDlgItemMessage(hwndDlg,IDC_TOP_SPACE_SPIN,UDM_SETRANGE,0,MAKELONG(255,0));
-			SendDlgItemMessage(hwndDlg,IDC_TOP_SPACE_SPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"CList","ThirdLineTopSpace",SETTING_THIRDLINE_TOPSPACE_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_TOP_SPACE_SPIN,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,"CList","ThirdLineTopSpace",SETTING_THIRDLINE_TOPSPACE_DEFAULT),0));
 
-			CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS, ModernGetSettingByte(NULL,"CList","ThirdLineDrawSmileys",SETTING_THIRDLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
+			CheckDlgButton(hwndDlg, IDC_DRAW_SMILEYS, db_get_b(NULL,"CList","ThirdLineDrawSmileys",SETTING_THIRDLINE_SMILEYS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED );
 
 			{
 				DBVARIANT dbv={0};
 
-				if (!ModernGetSettingTString(NULL, "CList","ThirdLineText", &dbv))
+				if (!DBGetContactSettingTString(NULL, "CList","ThirdLineText", &dbv))
 				{
 					SetWindowText(GetDlgItem(hwndDlg,IDC_VARIABLE_TEXT), dbv.ptszVal);
-					ModernDBFreeVariant(&dbv);
+					db_free(&dbv);
 				}
 			}
 			SendMessage(GetDlgItem(hwndDlg,IDC_VARIABLE_TEXT), EM_SETLIMITTEXT, TEXT_TEXT_MAX_LENGTH, 0);
 
-			radio = ModernGetSettingWord(NULL,"CList","ThirdLineType",SETTING_THIRDLINE_TYPE_DEFAULT);
+			radio = db_get_w(NULL,"CList","ThirdLineType",SETTING_THIRDLINE_TYPE_DEFAULT);
 
 			CheckDlgButton(hwndDlg, IDC_STATUS, radio == TEXT_STATUS ? BST_CHECKED : BST_UNCHECKED );
 			CheckDlgButton(hwndDlg, IDC_NICKNAME, radio == TEXT_NICKNAME ? BST_CHECKED : BST_UNCHECKED );
@@ -1021,10 +1021,10 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM
 			CheckDlgButton(hwndDlg, IDC_CONTACT_TIME, radio == TEXT_CONTACT_TIME ? BST_CHECKED : BST_UNCHECKED );
 			CheckDlgButton(hwndDlg, IDC_TEXT, radio == TEXT_TEXT ? BST_CHECKED : BST_UNCHECKED );
 
-			CheckDlgButton(hwndDlg, IDC_XSTATUS_HAS_PRIORITY, ModernGetSettingByte(NULL,"CList","ThirdLineXStatusHasPriority",SETTING_THIRDLINE_XSTATUS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
-			CheckDlgButton(hwndDlg, IDC_SHOW_STATUS_IF_NOAWAY, ModernGetSettingByte(NULL,"CList","ThirdLineShowStatusIfNoAway",SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
-			CheckDlgButton(hwndDlg, IDC_SHOW_LISTENING_IF_NOAWAY, ModernGetSettingByte(NULL,"CList","ThirdLineShowListeningIfNoAway",SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
-			CheckDlgButton(hwndDlg, IDC_USE_NAME_AND_MESSAGE, ModernGetSettingByte(NULL,"CList","ThirdLineUseNameAndMessageForXStatus",SETTING_THIRDLINE_XSTATUSNAMETEXT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_XSTATUS_HAS_PRIORITY, db_get_b(NULL,"CList","ThirdLineXStatusHasPriority",SETTING_THIRDLINE_XSTATUS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_SHOW_STATUS_IF_NOAWAY, db_get_b(NULL,"CList","ThirdLineShowStatusIfNoAway",SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_SHOW_LISTENING_IF_NOAWAY, db_get_b(NULL,"CList","ThirdLineShowListeningIfNoAway",SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_USE_NAME_AND_MESSAGE, db_get_b(NULL,"CList","ThirdLineUseNameAndMessageForXStatus",SETTING_THIRDLINE_XSTATUSNAMETEXT_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
 
 			if (!IsDlgButtonChecked(hwndDlg,IDC_SHOW))
 			{
@@ -1133,9 +1133,9 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM
 						{
 							int radio;
 
-							ModernWriteSettingByte(NULL,"CList","ThirdLineShow", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW));
-							ModernWriteSettingWord(NULL,"CList","ThirdLineTopSpace", (WORD)SendDlgItemMessage(hwndDlg,IDC_TOP_SPACE_SPIN,UDM_GETPOS,0,0));
-							ModernWriteSettingByte(NULL,"CList","ThirdLineDrawSmileys", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_DRAW_SMILEYS));
+							db_set_b(NULL,"CList","ThirdLineShow", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW));
+							db_set_w(NULL,"CList","ThirdLineTopSpace", (WORD)SendDlgItemMessage(hwndDlg,IDC_TOP_SPACE_SPIN,UDM_GETPOS,0,0));
+							db_set_b(NULL,"CList","ThirdLineDrawSmileys", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_DRAW_SMILEYS));
 
 							if (IsDlgButtonChecked(hwndDlg,IDC_STATUS))
 								radio = TEXT_STATUS;
@@ -1149,7 +1149,7 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM
 								radio = TEXT_LISTENING_TO;
 							else
 								radio = TEXT_STATUS_MESSAGE;
-							ModernWriteSettingWord(NULL,"CList","ThirdLineType", (WORD)radio);
+							db_set_w(NULL,"CList","ThirdLineType", (WORD)radio);
 
 							{
 								TCHAR t[TEXT_TEXT_MAX_LENGTH];
@@ -1157,13 +1157,13 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM
 								GetWindowText(GetDlgItem(hwndDlg,IDC_VARIABLE_TEXT), t, SIZEOF(t));
 								t[TEXT_TEXT_MAX_LENGTH - 1] = '\0';
 
-								ModernWriteSettingTString(NULL, "CList", "ThirdLineText", t);
+								db_set_ws(NULL, "CList", "ThirdLineText", t);
 							}
 
-							ModernWriteSettingByte(NULL,"CList","ThirdLineXStatusHasPriority", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_XSTATUS_HAS_PRIORITY));
-							ModernWriteSettingByte(NULL,"CList","ThirdLineUseNameAndMessageForXStatus", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_USE_NAME_AND_MESSAGE));
-							ModernWriteSettingByte(NULL,"CList","ThirdLineShowStatusIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW_STATUS_IF_NOAWAY));
-							ModernWriteSettingByte(NULL,"CList","ThirdLineShowListeningIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW_LISTENING_IF_NOAWAY));
+							db_set_b(NULL,"CList","ThirdLineXStatusHasPriority", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_XSTATUS_HAS_PRIORITY));
+							db_set_b(NULL,"CList","ThirdLineUseNameAndMessageForXStatus", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_USE_NAME_AND_MESSAGE));
+							db_set_b(NULL,"CList","ThirdLineShowStatusIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW_STATUS_IF_NOAWAY));
+							db_set_b(NULL,"CList","ThirdLineShowListeningIfNoAway", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOW_LISTENING_IF_NOAWAY));
 							ClcOptionsChanged();
 							return TRUE;
 						}
@@ -1272,7 +1272,7 @@ static int  DeleteAllSettingInOrder()
 		int i;
 		for (i=0;i<nArrayLen;i++)
 		{
-			ModernDeleteSetting(0,CLUIFrameModule,settingname[i]);
+			db_unset(0,CLUIFrameModule,settingname[i]);
 			free(settingname[i]);
 		};
 		free(settingname);
@@ -1295,17 +1295,17 @@ static int FillOrderTree(HWND hwndDlg, HWND Tree)
 	tvis.hParent=NULL;
 	tvis.hInsertAfter=TVI_LAST;
 	tvis.item.mask=TVIF_PARAM|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;	
-	if (ModernGetSettingByte(NULL,CLUIFrameModule,"ExtraCountStored",0)!=SIZEOF(OrderTreeData))
+	if (db_get_b(NULL,CLUIFrameModule,"ExtraCountStored",0)!=SIZEOF(OrderTreeData))
 	{
 		DeleteAllSettingInOrder();
-		ModernWriteSettingByte(NULL,CLUIFrameModule,"ExtraCountStored",SIZEOF(OrderTreeData));
+		db_set_b(NULL,CLUIFrameModule,"ExtraCountStored",SIZEOF(OrderTreeData));
 	}
 	for (i=0; i<SIZEOF(OrderTreeData); i++)
 	{
 		char buf[256];
 		sprintf(buf,"ORDER_%s",OrderTreeData[i].KeyName);
-		OrderTreeData[i].Position=(BYTE)ModernGetSettingByte(NULL,CLUIFrameModule,buf,i);
-		OrderTreeData[i].Visible =(BOOL)ModernGetSettingByte(NULL,CLUIFrameModule,OrderTreeData[i].KeyName,1);
+		OrderTreeData[i].Position=(BYTE)db_get_b(NULL,CLUIFrameModule,buf,i);
+		OrderTreeData[i].Visible =(BOOL)db_get_b(NULL,CLUIFrameModule,OrderTreeData[i].KeyName,1);
 		tvis.hInsertAfter=TVI_LAST;
 		tvis.item.lParam=(LPARAM)(&(OrderTreeData[i]));
 		tvis.item.pszText=TranslateTS(OrderTreeData[i].Name);
@@ -1337,8 +1337,8 @@ static int SaveOrderTree(HWND hwndDlg, HWND Tree)
 		{
 			char buf[250];
 			sprintf(buf,"ORDER_%s",it->KeyName);
-			ModernWriteSettingByte(NULL,CLUIFrameModule,buf,pos);
-			ModernWriteSettingByte(NULL,CLUIFrameModule,it->KeyName, it->Visible);	
+			db_set_b(NULL,CLUIFrameModule,buf,pos);
+			db_set_b(NULL,CLUIFrameModule,it->KeyName, it->Visible);	
 		}
 		ht=TreeView_GetNextSibling(Tree,ht);
 		pos++;
@@ -1350,17 +1350,17 @@ static int SaveOrderTree(HWND hwndDlg, HWND Tree)
 int LoadPositionsFromDB(BYTE * OrderPos)
 {
 	int i=0;
-	if (ModernGetSettingByte(NULL,CLUIFrameModule,"ExtraCountStored",0)!=SIZEOF(OrderTreeData))
+	if (db_get_b(NULL,CLUIFrameModule,"ExtraCountStored",0)!=SIZEOF(OrderTreeData))
 	{
 		DeleteAllSettingInOrder();
-		ModernWriteSettingByte(NULL,CLUIFrameModule,"ExtraCountStored",SIZEOF(OrderTreeData));
+		db_set_b(NULL,CLUIFrameModule,"ExtraCountStored",SIZEOF(OrderTreeData));
 	}
 
 	for (i=0; i<SIZEOF(OrderTreeData); i++)
 	{
 		char buf[256];
 		sprintf(buf,"ORDER_%s",OrderTreeData[i].KeyName);
-		OrderPos[OrderTreeData[i].ID-1]=(BYTE)ModernGetSettingByte(NULL,CLUIFrameModule,buf,i);
+		OrderPos[OrderTreeData[i].ID-1]=(BYTE)db_get_b(NULL,CLUIFrameModule,buf,i);
 	}
 	return 0;
 }
diff --git a/plugins/Clist_modern/modern_clistsettings.cpp b/plugins/Clist_modern/modern_clistsettings.cpp
index 9a7bacff7a..8eafbeb06d 100644
--- a/plugins/Clist_modern/modern_clistsettings.cpp
+++ b/plugins/Clist_modern/modern_clistsettings.cpp
@@ -321,11 +321,11 @@ void cliCheckCacheItem(pdisplayNameCacheEntry pdnce)
 		{
 			DBVARIANT dbv={0};
 
-			if (!ModernGetSettingTString(pdnce->m_cache_hContact,"CList","Group",&dbv))
+			if (!DBGetContactSettingTString(pdnce->m_cache_hContact,"CList","Group",&dbv))
 			{
 				pdnce->m_cache_tcsGroup=mir_tstrdup(dbv.ptszVal);
 				//mir_free_and_nill(dbv.ptszVal);
-				ModernDBFreeVariant(&dbv);
+				db_free(&dbv);
 			}else
 			{
 				pdnce->m_cache_tcsGroup=mir_tstrdup(TEXT(""));
@@ -334,40 +334,40 @@ void cliCheckCacheItem(pdisplayNameCacheEntry pdnce)
 		}
 		if (pdnce->m_cache_nHidden==-1)
 		{
-			pdnce->m_cache_nHidden=ModernGetSettingByte(pdnce->m_cache_hContact,"CList","Hidden",0);
+			pdnce->m_cache_nHidden=db_get_b(pdnce->m_cache_hContact,"CList","Hidden",0);
 		}
 		//if (pdnce->HiddenSubcontact==-1)
 		//{
-		pdnce->m_cache_nHiddenSubcontact=g_szMetaModuleName && ModernGetSettingByte(pdnce->m_cache_hContact,g_szMetaModuleName,"IsSubcontact",0);
+		pdnce->m_cache_nHiddenSubcontact=g_szMetaModuleName && db_get_b(pdnce->m_cache_hContact,g_szMetaModuleName,"IsSubcontact",0);
 		//pdnce->HiddenSubcontact=ServiceExists(MS_MC_GETMETACONTACT) && CallService(MS_MC_GETMETACONTACT, (WPARAM)pdnce->hContact, 0) != 0;
 		//};
 
 		if (pdnce->m_cache_nNoHiddenOffline==-1)
 		{
-			pdnce->m_cache_nNoHiddenOffline=ModernGetSettingByte(pdnce->m_cache_hContact,"CList","noOffline",0);
+			pdnce->m_cache_nNoHiddenOffline=db_get_b(pdnce->m_cache_hContact,"CList","noOffline",0);
 		}
 
 		if (pdnce->IdleTS==-1)
 		{
-			pdnce->IdleTS=ModernGetSettingDword(pdnce->m_cache_hContact,pdnce->m_cache_cszProto,"IdleTS",0);
+			pdnce->IdleTS=db_get_dw(pdnce->m_cache_hContact,pdnce->m_cache_cszProto,"IdleTS",0);
 		};
 
 		if (pdnce->ApparentMode==-1)
 		{
-			pdnce->ApparentMode=ModernGetSettingWord(pdnce->m_cache_hContact,pdnce->m_cache_cszProto,"ApparentMode",0);
+			pdnce->ApparentMode=db_get_w(pdnce->m_cache_hContact,pdnce->m_cache_cszProto,"ApparentMode",0);
 		};				
 		if (pdnce->NotOnList==-1)
 		{
-			pdnce->NotOnList=ModernGetSettingByte(pdnce->m_cache_hContact,"CList","NotOnList",0);
+			pdnce->NotOnList=db_get_b(pdnce->m_cache_hContact,"CList","NotOnList",0);
 		};		
 
 		if (pdnce->IsExpanded==-1)
 		{
-			pdnce->IsExpanded=ModernGetSettingByte(pdnce->m_cache_hContact,"CList","Expanded",0);
+			pdnce->IsExpanded=db_get_b(pdnce->m_cache_hContact,"CList","Expanded",0);
 		}
 		if (pdnce->dwLastMsgTime==0)
 		{
-			pdnce->dwLastMsgTime=ModernGetSettingDword(pdnce->m_cache_hContact, "CList", "mf_lastmsg", 0);
+			pdnce->dwLastMsgTime=db_get_dw(pdnce->m_cache_hContact, "CList", "mf_lastmsg", 0);
 			if (pdnce->dwLastMsgTime==0) pdnce->dwLastMsgTime=CompareContacts2_getLMTime(pdnce->m_cache_hContact);
 		}
 		if (!pdnce->m_cache_szName) pdnce->m_cache_szName=mir_t2a(pdnce->m_cache_tcsName);
@@ -474,7 +474,7 @@ char* GetProtoForContact(HANDLE hContact)
 int GetStatusForContact(HANDLE hContact,char *szProto)
 {
 	if (szProto)
-		return (int)(ModernGetSettingWord((HANDLE)hContact,szProto,"Status",ID_STATUS_OFFLINE));
+		return (int)(db_get_w((HANDLE)hContact,szProto,"Status",ID_STATUS_OFFLINE));
 	else 
 		return (ID_STATUS_OFFLINE);
 }
@@ -562,12 +562,12 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam)
 					//InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type);
 					if (pcli->hwndContactTree && g_flag_bOnModulesLoadedCalled) 
 						res=PostAutoRebuidMessage(pcli->hwndContactTree);
-					if ((ModernGetSettingWord(NULL,"CList","SecondLineType",SETTING_SECONDLINE_TYPE_DEFAULT)==TEXT_STATUS_MESSAGE||ModernGetSettingWord(NULL,"CList","ThirdLineType",SETTING_THIRDLINE_TYPE_DEFAULT)==TEXT_STATUS_MESSAGE) &&pdnce->m_cache_hContact && pdnce->m_cache_cszProto)
+					if ((db_get_w(NULL,"CList","SecondLineType",SETTING_SECONDLINE_TYPE_DEFAULT)==TEXT_STATUS_MESSAGE||db_get_w(NULL,"CList","ThirdLineType",SETTING_THIRDLINE_TYPE_DEFAULT)==TEXT_STATUS_MESSAGE) &&pdnce->m_cache_hContact && pdnce->m_cache_cszProto)
 					{
 						//	if (pdnce->status!=ID_STATUS_OFFLINE)  
 						amRequestAwayMsg((HANDLE)wParam);  
 					}
-					ModernDBFreeVariant(&dbv);
+					db_free(&dbv);
 					return 0;
 				}
 				if (!(pdnce->m_cache_nHidden==1)) 
@@ -577,10 +577,10 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam)
 					{
 						if (g_CluiData.bRemoveAwayMessageForOffline)
 						{
-							ModernWriteSettingString((HANDLE)wParam,"CList","StatusMsg","");
+							db_set_s((HANDLE)wParam,"CList","StatusMsg","");
 						}
 					}
-					if ((ModernGetSettingWord(NULL,"CList","SecondLineType",0)==TEXT_STATUS_MESSAGE||ModernGetSettingWord(NULL,"CList","ThirdLineType",0)==TEXT_STATUS_MESSAGE) &&pdnce->m_cache_hContact && pdnce->m_cache_cszProto)
+					if ((db_get_w(NULL,"CList","SecondLineType",0)==TEXT_STATUS_MESSAGE||db_get_w(NULL,"CList","ThirdLineType",0)==TEXT_STATUS_MESSAGE) &&pdnce->m_cache_hContact && pdnce->m_cache_cszProto)
 					{
 						//	if (pdnce->status!=ID_STATUS_OFFLINE)  
 						amRequestAwayMsg((HANDLE)wParam);  
@@ -598,7 +598,7 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam)
 					{
 							pcli->pfnSortContacts();
 					}
-					ModernDBFreeVariant(&dbv);
+					db_free(&dbv);
 					return 0;
 				}
 			}
@@ -626,7 +626,7 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam)
 				{
 					char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0);
 					//				ChangeContactIcon((HANDLE)wParam,IconFromStatusMode(szProto,szProto==NULL?ID_STATUS_OFFLINE:DBGetContactSettingWord((HANDLE)wParam,szProto,"Status",ID_STATUS_OFFLINE)),1);
-					cli_ChangeContactIcon((HANDLE)wParam,ExtIconFromStatusMode((HANDLE)wParam,szProto,szProto==NULL?ID_STATUS_OFFLINE:ModernGetSettingWord((HANDLE)wParam,szProto,"Status",ID_STATUS_OFFLINE)),1);  //by FYR
+					cli_ChangeContactIcon((HANDLE)wParam,ExtIconFromStatusMode((HANDLE)wParam,szProto,szProto==NULL?ID_STATUS_OFFLINE:db_get_w((HANDLE)wParam,szProto,"Status",ID_STATUS_OFFLINE)),1);  //by FYR
 				}
 				pcli->pfnClcBroadcast(CLM_AUTOREBUILD,0, 0);
 			}
@@ -644,11 +644,11 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam)
 				InvalidateDNCEbyPointer((HANDLE)wParam,pdnce,cws->value.type);	
 				if(cws->value.type==DBVT_DELETED) szProto=NULL;
 				else szProto=cws->value.pszVal;
-				cli_ChangeContactIcon((HANDLE)wParam,ExtIconFromStatusMode((HANDLE)wParam,szProto,szProto==NULL?ID_STATUS_OFFLINE:ModernGetSettingWord((HANDLE)wParam,szProto,"Status",ID_STATUS_OFFLINE)),0); //by FYR
+				cli_ChangeContactIcon((HANDLE)wParam,ExtIconFromStatusMode((HANDLE)wParam,szProto,szProto==NULL?ID_STATUS_OFFLINE:db_get_w((HANDLE)wParam,szProto,"Status",ID_STATUS_OFFLINE)),0); //by FYR
 			}
 		}
 		// Clean up
-		ModernDBFreeVariant(&dbv);
+		db_free(&dbv);
 		//if (dbv.pszVal)
 		//	mir_free_and_nill(dbv.pszVal);
 	} 
diff --git a/plugins/Clist_modern/modern_clisttray.cpp b/plugins/Clist_modern/modern_clisttray.cpp
index 15c26506c8..f87ab41007 100644
--- a/plugins/Clist_modern/modern_clisttray.cpp
+++ b/plugins/Clist_modern/modern_clisttray.cpp
@@ -182,8 +182,8 @@ void cliTrayIconUpdateBase(const char *szChangedProto)
 
 	if(netProtoCount>1) {
 		if(averageMode>=ID_STATUS_OFFLINE) {
-			if(ModernGetSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT)==SETTING_TRAYICON_MULTI) {
-				if(ModernGetSettingByte(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT))
+			if(db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT)==SETTING_TRAYICON_MULTI) {
+				if(db_get_b(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT))
 					changed=pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL,szChangedProto,averageMode),szChangedProto);
 				else if(pcli->trayIcon && pcli->trayIcon[0].szProto!=NULL) {
 					pcli->pfnTrayIconDestroy(hwnd);
@@ -194,12 +194,12 @@ void cliTrayIconUpdateBase(const char *szChangedProto)
 			}
 			else
 			{
-				if(ModernGetSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT)==SETTING_TRAYICON_SINGLE
-					&& ModernGetSettingByte(NULL,"CList","AlwaysPrimary",SETTING_ALWAYSPRIMARY_DEFAULT))
+				if(db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT)==SETTING_TRAYICON_SINGLE
+					&& db_get_b(NULL,"CList","AlwaysPrimary",SETTING_ALWAYSPRIMARY_DEFAULT))
 				{
 					DBVARIANT dbv={DBVT_DELETED};
 					char *szProto;
-					if(ModernGetSettingString(NULL,"CList","PrimaryStatus",&dbv)) szProto=NULL;
+					if(DBGetContactSettingString(NULL,"CList","PrimaryStatus",&dbv)) szProto=NULL;
 					else szProto=dbv.pszVal;
 					changed=pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL,szProto,averageMode),NULL);
 					if (szProto) mir_free_and_nill(szProto);
@@ -209,13 +209,13 @@ void cliTrayIconUpdateBase(const char *szChangedProto)
 			}
 		}
 		else {
-			switch(ModernGetSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT)) {
+			switch(db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT)) {
 			case SETTING_TRAYICON_SINGLE:
 				{
 					DBVARIANT dbv={DBVT_DELETED};
 					char *szProto;
 					int status;
-					if(ModernGetSettingString(NULL,"CList","PrimaryStatus",&dbv)) szProto=NULL;
+					if(DBGetContactSettingString(NULL,"CList","PrimaryStatus",&dbv)) szProto=NULL;
 					else szProto=dbv.pszVal;
 					status=CallProtoService(szChangedProto,PS_GETSTATUS,0,0);
 
@@ -233,14 +233,14 @@ void cliTrayIconUpdateBase(const char *szChangedProto)
 							hIcon=(HICON)CLUI_GetConnectingIconService((WPARAM)szChangedProto,0);
 						if (hIcon) {
 							changed=pcli->pfnTrayIconSetBaseInfo(hIcon,NULL);
-							ModernDBFreeVariant(&dbv);
+							db_free(&dbv);
 							break;
 						}
 					}
 					else
 						changed=pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL,szProto,szProto?CallProtoService(szProto,PS_GETSTATUS,0,0):CallService(MS_CLIST_GETSTATUSMODE,0,0)),NULL);
 
-					ModernDBFreeVariant(&dbv);
+					db_free(&dbv);
 				}
 				break;
 
@@ -272,7 +272,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto)
 					}
 					else
 					{
-						pcli->cycleTimerId=CLUI_SafeSetTimer(NULL,0,ModernGetSettingWord(NULL,"CList","CycleTime",SETTING_CYCLETIME_DEFAULT)*1000,pcli->pfnTrayCycleTimerProc);
+						pcli->cycleTimerId=CLUI_SafeSetTimer(NULL,0,db_get_w(NULL,"CList","CycleTime",SETTING_CYCLETIME_DEFAULT)*1000,pcli->pfnTrayCycleTimerProc);
 						changed=pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL,szChangedProto,status),NULL);
 					}
 
@@ -282,7 +282,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto)
 			case SETTING_TRAYICON_MULTI:
 				if (!pcli->trayIcon)
 					pcli->pfnTrayIconRemove(NULL,NULL);
-				else if ( ModernGetSettingByte(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT )) {
+				else if ( db_get_b(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT )) {
 					if (pcli->pfnGetProtocolVisibility(szChangedProto))
 					{
 
@@ -337,7 +337,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto)
 		}
 		else if (status>=ID_STATUS_OFFLINE && status<=ID_STATUS_IDLE)
 		{
-			if(ModernGetSettingString(NULL,"CList","PrimaryStatus",&dbv))
+			if(DBGetContactSettingString(NULL,"CList","PrimaryStatus",&dbv))
 				szProto=NULL;
 			else
 				szProto=dbv.pszVal;
@@ -370,13 +370,13 @@ static VOID CALLBACK TrayIconAutoHideTimer(HWND hwnd,UINT message,UINT_PTR idEve
 
 INT_PTR TrayIconPauseAutoHide(WPARAM wParam,LPARAM lParam)
 {
-	if (ModernGetSettingByte(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT))
+	if (db_get_b(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT))
 	{
 		if (GetActiveWindow() != pcli->hwndContactList
 			&& GetWindow(GetParent(GetActiveWindow()),GW_OWNER) != pcli->hwndContactList)
 		{
 			KillTimer(NULL,autoHideTimerId);
-			autoHideTimerId=CLUI_SafeSetTimer(NULL,0,1000*ModernGetSettingWord(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),TrayIconAutoHideTimer);
+			autoHideTimerId=CLUI_SafeSetTimer(NULL,0,1000*db_get_w(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),TrayIconAutoHideTimer);
 	}	}
 
 	return 0;
@@ -417,9 +417,9 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam,LPARAM lParam)
 			h1=(HWND)msg->lParam;
 			h2=h1?GetParent(h1):NULL;
 			h4=pcli->hwndContactList;
-			if(ModernGetSettingByte(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT)) {
+			if(db_get_b(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT)) {
 				if (LOWORD(msg->wParam)==WA_INACTIVE && h2!=h4)
-					autoHideTimerId=CLUI_SafeSetTimer(NULL,0,1000*ModernGetSettingWord(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),TrayIconAutoHideTimer);
+					autoHideTimerId=CLUI_SafeSetTimer(NULL,0,1000*db_get_w(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),TrayIconAutoHideTimer);
 				else {
 					KillTimer(NULL,autoHideTimerId);
 					autoHideTimerId = 0;
@@ -433,7 +433,7 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam,LPARAM lParam)
 		return FALSE; //to avoid autohideTimer in core
 
 	case TIM_CALLBACK:
-		if ((GetAsyncKeyState(VK_CONTROL)&0x8000) && msg->lParam == WM_LBUTTONDOWN && !ModernGetSettingByte(NULL,"CList","Tray1Click",SETTING_TRAY1CLICK_DEFAULT)) {
+		if ((GetAsyncKeyState(VK_CONTROL)&0x8000) && msg->lParam == WM_LBUTTONDOWN && !db_get_b(NULL,"CList","Tray1Click",SETTING_TRAY1CLICK_DEFAULT)) {
 			POINT pt;
 			HMENU hMenu;
 			hMenu=(HMENU)CallService(MS_CLIST_MENUGETSTATUS,(WPARAM)0,(LPARAM)0);
diff --git a/plugins/Clist_modern/modern_clui.cpp b/plugins/Clist_modern/modern_clui.cpp
index 80c9937763..c0942e0bce 100644
--- a/plugins/Clist_modern/modern_clui.cpp
+++ b/plugins/Clist_modern/modern_clui.cpp
@@ -95,7 +95,7 @@ int CLUI::OnEvent_FontReload(WPARAM wParam,LPARAM lParam)
     
     pcli->pfnClcBroadcast( INTM_RELOADOPTIONS, wParam, lParam );
 
-	g_CluiData.dwKeyColor=ModernGetSettingDword(NULL,"ModernSettings","KeyColor",(DWORD)SETTING_KEYCOLOR_DEFAULT);
+	g_CluiData.dwKeyColor=db_get_dw(NULL,"ModernSettings","KeyColor",(DWORD)SETTING_KEYCOLOR_DEFAULT);
 
 	CLUI__cliInvalidateRect( pcli->hwndContactList, 0, 0 );
 	
@@ -120,7 +120,7 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM wParam, LPARAM lParam)
 	}
 	CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hRenameMenuItem, (LPARAM)&mi);
 
-	if (!hItem || !IsHContactContact(hItem) || !ModernGetSettingByte(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT))
+	if (!hItem || !IsHContactContact(hItem) || !db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT))
 	{
 		mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
 		CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowAvatarMenuItem, (LPARAM)&mi);
@@ -137,18 +137,18 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM wParam, LPARAM lParam)
 		else
 		{
 			DBVARIANT dbv={0};
-			if (ModernGetSettingTString(hItem, "ContactPhoto", "File", &dbv))
+			if (DBGetContactSettingTString(hItem, "ContactPhoto", "File", &dbv))
 			{
 				has_avatar = 0;
 			}
 			else
 			{
 				has_avatar = 1;
-				ModernDBFreeVariant(&dbv);
+				db_free(&dbv);
 			}
 		}
 
-		if (ModernGetSettingByte(hItem, "CList", "HideContactAvatar", 0))
+		if (db_get_b(hItem, "CList", "HideContactAvatar", 0))
 		{
 			mi.flags = CMIM_FLAGS | (has_avatar ? 0 : CMIF_GRAYED);
 			CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowAvatarMenuItem, (LPARAM)&mi);
@@ -210,7 +210,7 @@ INT_PTR CLUI::Service_Menu_ShowContactAvatar(WPARAM wParam,LPARAM lParam)
 {
 	HANDLE hContact = (HANDLE) wParam;
 
-	ModernWriteSettingByte(hContact, "CList", "HideContactAvatar", 0);
+	db_set_b(hContact, "CList", "HideContactAvatar", 0);
 
 	pcli->pfnClcBroadcast( INTM_AVATARCHANGED,wParam,0);
 	return 0;
@@ -220,7 +220,7 @@ INT_PTR CLUI::Service_Menu_HideContactAvatar(WPARAM wParam,LPARAM lParam)
 {
 	HANDLE hContact = (HANDLE) wParam;
 
-	ModernWriteSettingByte(hContact, "CList", "HideContactAvatar", 1);
+	db_set_b(hContact, "CList", "HideContactAvatar", 1);
 
 	pcli->pfnClcBroadcast( INTM_AVATARCHANGED,wParam,0);
 	return 0;
@@ -282,10 +282,10 @@ m_hDwmapiDll( NULL )
 	ExtraImage_LoadModule();	
 
 	g_CluiData.boldHideOffline=-1;
-	bOldHideOffline=ModernGetSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT);
+	bOldHideOffline=db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT);
 
 	g_CluiData.bOldUseGroups=-1;
-	bOldUseGroups = ModernGetSettingByte( NULL,"CList","UseGroups", SETTING_USEGROUPS_DEFAULT );
+	bOldUseGroups = db_get_b( NULL,"CList","UseGroups", SETTING_USEGROUPS_DEFAULT );
 }
 
 CLUI::~CLUI()
@@ -304,9 +304,9 @@ HRESULT CLUI::LoadDllsRuntime()
 		g_proc_SetLayeredWindowAttributesNew = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(m_hUserDll, "SetLayeredWindowAttributes");
 		g_proc_AnimateWindow=(BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(m_hUserDll,"AnimateWindow");
 
-		g_CluiData.fLayered=(g_proc_UpdateLayeredWindow!=NULL) && !ModernGetSettingByte(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
-		g_CluiData.fSmoothAnimation=IsWinVer2000Plus()&&ModernGetSettingByte(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT);
-		g_CluiData.fLayered=(g_CluiData.fLayered*ModernGetSettingByte(NULL, "ModernData", "EnableLayering", g_CluiData.fLayered))&&!ModernGetSettingByte(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
+		g_CluiData.fLayered=(g_proc_UpdateLayeredWindow!=NULL) && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
+		g_CluiData.fSmoothAnimation=IsWinVer2000Plus()&&db_get_b(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT);
+		g_CluiData.fLayered=(g_CluiData.fLayered*db_get_b(NULL, "ModernData", "EnableLayering", g_CluiData.fLayered))&&!db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
 	}
 
     if (IsWinVerVistaPlus())
@@ -353,9 +353,9 @@ HRESULT CLUI::CreateCLCWindow(const HWND hwndClui)
 {    
 	ClcWnd() = CreateWindow(CLISTCONTROL_CLASS,TEXT(""),
 		WS_CHILD|WS_CLIPCHILDREN|CLS_CONTACTLIST
-		|(ModernGetSettingByte(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT)?CLS_USEGROUPS:0)
-		|(ModernGetSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CLS_HIDEOFFLINE:0)
-		|(ModernGetSettingByte(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT)?CLS_HIDEEMPTYGROUPS:0
+		|(db_get_b(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT)?CLS_USEGROUPS:0)
+		|(db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CLS_HIDEOFFLINE:0)
+		|(db_get_b(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT)?CLS_HIDEEMPTYGROUPS:0
 		|CLS_MULTICOLUMN
 		),
 		0,0,0,0,hwndClui,NULL,g_hInst,NULL);
@@ -458,7 +458,7 @@ HRESULT CLUI::SnappingToEdge( WINDOWPOS * lpWindowPos )
 	if ( MyMonitorFromWindow == NULL || MyGetMonitorInfo == NULL )
 		return S_FALSE;
 
-	if (ModernGetSettingByte(NULL,"CLUI","SnapToEdges",SETTING_SNAPTOEDGES_DEFAULT))
+	if (db_get_b(NULL,"CLUI","SnapToEdges",SETTING_SNAPTOEDGES_DEFAULT))
 	{
 		RECT* dr;
 		MONITORINFO monInfo;
@@ -539,7 +539,7 @@ int CLUI_ShowWindowMod(HWND hWnd, int nCmd)
 		&& nCmd==SW_HIDE 
 		&& !g_CluiData.fLayered 
 		&& IsWinVerXPPlus()
-		&& ModernGetSettingByte(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT))
+		&& db_get_b(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT))
 	{
 		ShowWindow(hWnd,SW_MINIMIZE); //removing of shadow
 		return ShowWindow(hWnd,nCmd);
@@ -553,7 +553,7 @@ int CLUI_ShowWindowMod(HWND hWnd, int nCmd)
 		&& !g_bTransparentFlag 
 		)	
 	{	
-		if(ModernGetSettingByte(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT))
+		if(db_get_b(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT))
 		{
 			CLUI_SmoothAlphaTransition(hWnd, 255, 1);
 		}
@@ -599,11 +599,11 @@ static BOOL CLUI_WaitThreadsCompletion(HWND hwnd)
 
 void CLUI_UpdateLayeredMode()
 {	
-	g_CluiData.fDisableSkinEngine=ModernGetSettingByte(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
+	g_CluiData.fDisableSkinEngine=db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
 	if (IsWinVer2000Plus())
 	{
 		BOOL tLayeredFlag=TRUE;
-		tLayeredFlag&=(ModernGetSettingByte(NULL, "ModernData", "EnableLayering", tLayeredFlag) && !g_CluiData.fDisableSkinEngine);
+		tLayeredFlag&=(db_get_b(NULL, "ModernData", "EnableLayering", tLayeredFlag) && !g_CluiData.fDisableSkinEngine);
 
 		if (g_CluiData.fLayered != tLayeredFlag)
 		{
@@ -629,7 +629,7 @@ void CLUI_UpdateLayeredMode()
 
 void CLUI_UpdateAeroGlass()
 {
-	BOOL tAeroGlass = ModernGetSettingByte(NULL, "ModernData", "AeroGlass", SETTING_AEROGLASS_DEFAULT) && (g_CluiData.fLayered);
+	BOOL tAeroGlass = db_get_b(NULL, "ModernData", "AeroGlass", SETTING_AEROGLASS_DEFAULT) && (g_CluiData.fLayered);
 	if (g_proc_DWMEnableBlurBehindWindow && (tAeroGlass != g_CluiData.fAeroGlass))
 	{			
 		if (g_CluiData.hAeroGlassRgn)
@@ -667,8 +667,8 @@ void CLUI_ChangeWindowMode()
 	if (!pcli->hwndContactList) return;
 
 	g_mutex_bChangingMode=TRUE;
-	g_bTransparentFlag=IsWinVer2000Plus()&&ModernGetSettingByte( NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT);
-	g_CluiData.fSmoothAnimation=IsWinVer2000Plus()&&ModernGetSettingByte(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT);
+	g_bTransparentFlag=IsWinVer2000Plus()&&db_get_b( NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT);
+	g_CluiData.fSmoothAnimation=IsWinVer2000Plus()&&db_get_b(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT);
 	if (g_bTransparentFlag==0 && g_CluiData.bCurrentAlpha!=0)
 		g_CluiData.bCurrentAlpha=255;
 	//2- Calculate STYLES and STYLESEX
@@ -676,19 +676,19 @@ void CLUI_ChangeWindowMode()
 	{
 		style=0;
 		styleEx=0;
-		if (ModernGetSettingByte(NULL,"CList","ThinBorder",SETTING_THINBORDER_DEFAULT) || (ModernGetSettingByte(NULL,"CList","NoBorder",SETTING_NOBORDER_DEFAULT)))
+		if (db_get_b(NULL,"CList","ThinBorder",SETTING_THINBORDER_DEFAULT) || (db_get_b(NULL,"CList","NoBorder",SETTING_NOBORDER_DEFAULT)))
 		{
-			style=WS_CLIPCHILDREN| (ModernGetSettingByte(NULL,"CList","ThinBorder",SETTING_THINBORDER_DEFAULT)?WS_BORDER:0);
+			style=WS_CLIPCHILDREN| (db_get_b(NULL,"CList","ThinBorder",SETTING_THINBORDER_DEFAULT)?WS_BORDER:0);
 			styleEx=WS_EX_TOOLWINDOW;
 			styleMaskEx |= WS_EX_APPWINDOW;
 		} 
-		else if (ModernGetSettingByte(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT) && ModernGetSettingByte(NULL,"CList","ToolWindow",SETTING_TOOLWINDOW_DEFAULT))
+		else if (db_get_b(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT) && db_get_b(NULL,"CList","ToolWindow",SETTING_TOOLWINDOW_DEFAULT))
 		{
 			styleEx=WS_EX_TOOLWINDOW/*|WS_EX_WINDOWEDGE*/;
 			style=WS_CAPTION|WS_POPUPWINDOW|WS_CLIPCHILDREN|WS_THICKFRAME;
 			styleMaskEx |= WS_EX_APPWINDOW;
 		}
-		else if (ModernGetSettingByte(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT))
+		else if (db_get_b(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT))
 		{
 			style=WS_CAPTION|WS_SYSMENU|WS_POPUPWINDOW|WS_CLIPCHILDREN|WS_THICKFRAME|WS_MINIMIZEBOX;
 		}
@@ -713,19 +713,19 @@ void CLUI_ChangeWindowMode()
 	{
 		TCHAR titleText[255]={0};
 		DBVARIANT dbv={0};
-		if(ModernGetSettingTString(NULL,"CList","TitleText",&dbv))
+		if(DBGetContactSettingTString(NULL,"CList","TitleText",&dbv))
 			lstrcpyn(titleText,TEXT(MIRANDANAME),SIZEOF(titleText));
 		else 
 		{
 			lstrcpyn(titleText,dbv.ptszVal,SIZEOF(titleText));
-			ModernDBFreeVariant(&dbv);
+			db_free(&dbv);
 		}
 		SetWindowText(pcli->hwndContactList,titleText);
 	}
 	//<->
 	//1- If visible store it and hide
 
-	if (g_CluiData.fLayered && (ModernGetSettingByte(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT)))// && !flag_bFirstTimeCall))
+	if (g_CluiData.fLayered && (db_get_b(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT)))// && !flag_bFirstTimeCall))
 	{
 		SetParent(pcli->hwndContactList,NULL);
 		Sync( CLUIFrames_SetParentForContainers, (HWND) NULL );
@@ -753,7 +753,7 @@ void CLUI_ChangeWindowMode()
 
 	CLUI_UpdateAeroGlass();
 
-	if(g_CluiData.fLayered || !ModernGetSettingByte(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT)) 
+	if(g_CluiData.fLayered || !db_get_b(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT)) 
     {
         HMENU m = GetMenu(pcli->hwndContactList);
 		SetMenu(pcli->hwndContactList,NULL);
@@ -761,12 +761,12 @@ void CLUI_ChangeWindowMode()
 	else
 		SetMenu(pcli->hwndContactList,g_hMenuMain);
 
-	if (g_CluiData.fLayered&&(ModernGetSettingByte(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT)))
+	if (g_CluiData.fLayered&&(db_get_b(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT)))
 		ske_UpdateWindowImage();
 
 
 	//6- Pin to desktop mode
-	if (ModernGetSettingByte(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT))
+	if (db_get_b(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT))
 	{
 		HWND hProgMan=FindWindow(TEXT("Progman"),NULL);
 		if (IsWindow(hProgMan)) 
@@ -809,7 +809,7 @@ void CLUI_ChangeWindowMode()
 		v=(r.bottom-r.top)>(w*2)?w:(r.bottom-r.top);
 		h=(h<v)?h:v;
 		hRgn1=CreateRoundRectRgn(0,0,(r.right-r.left+1),(r.bottom-r.top+1),h,h);
-		if ((ModernGetSettingByte(NULL,"CLC","RoundCorners",SETTING_ROUNDCORNERS_DEFAULT)) && (!CallService(MS_CLIST_DOCKINGISDOCKED,0,0)))
+		if ((db_get_b(NULL,"CLC","RoundCorners",SETTING_ROUNDCORNERS_DEFAULT)) && (!CallService(MS_CLIST_DOCKINGISDOCKED,0,0)))
 			SetWindowRgn(pcli->hwndContactList,hRgn1,1); 
 		else 
 		{
@@ -890,7 +890,7 @@ int CLUI_HideBehindEdge()
 			g_CluiData.mutexPreventDockMoving=1;
 
 			//3. store setting
-			ModernWriteSettingByte(NULL, "ModernData", "BehindEdge",method);
+			db_set_b(NULL, "ModernData", "BehindEdge",method);
 			g_CluiData.nBehindEdgeState=method;
 			return 1;
 		}
@@ -937,7 +937,7 @@ int CLUI_ShowFromBehindEdge()
 		g_CluiData.mutexPreventDockMoving=1;
 
 		//3. store setting
-		ModernWriteSettingByte(NULL, "ModernData", "BehindEdge",0);
+		db_set_b(NULL, "ModernData", "BehindEdge",0);
 		g_CluiData.nBehindEdgeState=0;
 	}
 	return 0;
@@ -1246,14 +1246,14 @@ static LRESULT BroadCastMessageToChild(HWND hwnd, int message, WPARAM wParam, LP
 int CLUI_ReloadCLUIOptions()
 {
 	KillTimer(pcli->hwndContactList,TM_UPDATEBRINGTIMER);
-	g_CluiData.bBehindEdgeSettings=ModernGetSettingByte(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT);
-	wBehindEdgeShowDelay=ModernGetSettingWord(NULL,"ModernData","ShowDelay",SETTING_SHOWDELAY_DEFAULT);
-	wBehindEdgeHideDelay=ModernGetSettingWord(NULL,"ModernData","HideDelay",SETTING_HIDEDELAY_DEFAULT);
-	wBehindEdgeBorderSize=ModernGetSettingWord(NULL,"ModernData","HideBehindBorderSize",SETTING_HIDEBEHINDBORDERSIZE_DEFAULT);
-
-	g_CluiData.fAutoSize=ModernGetSettingByte(NULL,"CLUI","AutoSize",SETTING_AUTOSIZE_DEFAULT);
-	g_CluiData.bInternalAwayMsgDiscovery = ModernGetSettingByte(NULL,"ModernData","InternalAwayMsgDiscovery",SETTING_INTERNALAWAYMSGREQUEST_DEFAULT);
-	g_CluiData.bRemoveAwayMessageForOffline =   ModernGetSettingByte(NULL,"ModernData","RemoveAwayMessageForOffline",SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT);
+	g_CluiData.bBehindEdgeSettings=db_get_b(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT);
+	wBehindEdgeShowDelay=db_get_w(NULL,"ModernData","ShowDelay",SETTING_SHOWDELAY_DEFAULT);
+	wBehindEdgeHideDelay=db_get_w(NULL,"ModernData","HideDelay",SETTING_HIDEDELAY_DEFAULT);
+	wBehindEdgeBorderSize=db_get_w(NULL,"ModernData","HideBehindBorderSize",SETTING_HIDEBEHINDBORDERSIZE_DEFAULT);
+
+	g_CluiData.fAutoSize=db_get_b(NULL,"CLUI","AutoSize",SETTING_AUTOSIZE_DEFAULT);
+	g_CluiData.bInternalAwayMsgDiscovery = db_get_b(NULL,"ModernData","InternalAwayMsgDiscovery",SETTING_INTERNALAWAYMSGREQUEST_DEFAULT);
+	g_CluiData.bRemoveAwayMessageForOffline =   db_get_b(NULL,"ModernData","RemoveAwayMessageForOffline",SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT);
 	//window borders
 	if (g_CluiData.fDisableSkinEngine) {
 		g_CluiData.LeftClientMargin=0;
@@ -1262,10 +1262,10 @@ int CLUI_ReloadCLUIOptions()
 		g_CluiData.BottomClientMargin=0;
 	} else {
 		//window borders
-		g_CluiData.LeftClientMargin=(int)ModernGetSettingByte(NULL,"CLUI","LeftClientMargin",SETTING_LEFTCLIENTMARIGN_DEFAULT);
-		g_CluiData.RightClientMargin=(int)ModernGetSettingByte(NULL,"CLUI","RightClientMargin",SETTING_RIGHTCLIENTMARIGN_DEFAULT); 
-		g_CluiData.TopClientMargin=(int)ModernGetSettingByte(NULL,"CLUI","TopClientMargin",SETTING_TOPCLIENTMARIGN_DEFAULT);
-		g_CluiData.BottomClientMargin=(int)ModernGetSettingByte(NULL,"CLUI","BottomClientMargin",SETTING_BOTTOMCLIENTMARIGN_DEFAULT);
+		g_CluiData.LeftClientMargin=(int)db_get_b(NULL,"CLUI","LeftClientMargin",SETTING_LEFTCLIENTMARIGN_DEFAULT);
+		g_CluiData.RightClientMargin=(int)db_get_b(NULL,"CLUI","RightClientMargin",SETTING_RIGHTCLIENTMARIGN_DEFAULT); 
+		g_CluiData.TopClientMargin=(int)db_get_b(NULL,"CLUI","TopClientMargin",SETTING_TOPCLIENTMARIGN_DEFAULT);
+		g_CluiData.BottomClientMargin=(int)db_get_b(NULL,"CLUI","BottomClientMargin",SETTING_BOTTOMCLIENTMARIGN_DEFAULT);
 	}			
 	BroadCastMessageToChild(pcli->hwndContactList, WM_THEMECHANGED, 0, 0);
 
@@ -1304,7 +1304,7 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state)
 		fnGetMenuBarInfo(hwnd,OBJID_MENU, 0, &mbi);
 		if (!(mbi.rcBar.right-mbi.rcBar.left>0 && mbi.rcBar.bottom-mbi.rcBar.top>0)) return 1;
 		r1=mbi.rcBar;  
-		r1.bottom+= !ModernGetSettingByte(NULL,"CLUI","LineUnderMenu",SETTING_LINEUNDERMENU_DEFAULT);
+		r1.bottom+= !db_get_b(NULL,"CLUI","LineUnderMenu",SETTING_LINEUNDERMENU_DEFAULT);
 		if (item<1)
 		{           
 			treg=CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,r1.bottom);
@@ -1324,7 +1324,7 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state)
 		else
 		{
 			fnGetMenuBarInfo(hwnd,OBJID_MENU, item, &mbi);
-			treg=CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,mbi.rcBar.bottom+!ModernGetSettingByte(NULL,"CLUI","LineUnderMenu",SETTING_LINEUNDERMENU_DEFAULT));
+			treg=CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,mbi.rcBar.bottom+!db_get_b(NULL,"CLUI","LineUnderMenu",SETTING_LINEUNDERMENU_DEFAULT));
 		}
 		OffsetRgn(treg,-ra.left,-ra.top);
 		r1.left-=ra.left;
@@ -1503,17 +1503,17 @@ void CLUI_cli_LoadCluiGlobalOpts()
 {
 	BOOL tLayeredFlag=FALSE;
 	tLayeredFlag=IsWinVer2000Plus();
-	tLayeredFlag&=ModernGetSettingByte(NULL, "ModernData", "EnableLayering", tLayeredFlag);
+	tLayeredFlag&=db_get_b(NULL, "ModernData", "EnableLayering", tLayeredFlag);
 
 	if(tLayeredFlag)
 	{
-		if (ModernGetSettingByte(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT)==1)
-			ModernWriteSettingByte(NULL,"CList","WindowShadow",2);    
+		if (db_get_b(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT)==1)
+			db_set_b(NULL,"CList","WindowShadow",2);    
 	}
 	else
 	{
-		if (ModernGetSettingByte(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT)==2)
-			ModernWriteSettingByte(NULL,"CList","WindowShadow",1); 
+		if (db_get_b(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT)==2)
+			db_set_b(NULL,"CList","WindowShadow",1); 
 	}
 	corecli.pfnLoadCluiGlobalOpts();
 }
@@ -1535,7 +1535,7 @@ int CLUI_TestCursorOnBorders()
 	{
 		if(g_bTransparentFlag) {
 			if (!bTransparentFocus && gf!=hwnd) {
-				CLUI_SmoothAlphaTransition(hwnd, ModernGetSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), 1);
+				CLUI_SmoothAlphaTransition(hwnd, db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), 1);
 				//g_proc_SetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA);
 				bTransparentFocus=1;
 				CLUI_SafeSetTimer(hwnd, TM_AUTOALPHA,250,NULL);
@@ -1548,10 +1548,10 @@ int CLUI_TestCursorOnBorders()
 	/*
 	*  Size borders offset (contract)
 	*/
-	r.top+=ModernGetSettingDword(NULL,"ModernSkin","SizeMarginOffset_Top",SKIN_OFFSET_TOP_DEFAULT);
-	r.bottom-=ModernGetSettingDword(NULL,"ModernSkin","SizeMarginOffset_Bottom",SKIN_OFFSET_BOTTOM_DEFAULT);
-	r.left+=ModernGetSettingDword(NULL,"ModernSkin","SizeMarginOffset_Left",SKIN_OFFSET_LEFT_DEFAULT);
-	r.right-=ModernGetSettingDword(NULL,"ModernSkin","SizeMarginOffset_Right",SKIN_OFFSET_RIGHT_DEFAULT);
+	r.top+=db_get_dw(NULL,"ModernSkin","SizeMarginOffset_Top",SKIN_OFFSET_TOP_DEFAULT);
+	r.bottom-=db_get_dw(NULL,"ModernSkin","SizeMarginOffset_Bottom",SKIN_OFFSET_BOTTOM_DEFAULT);
+	r.left+=db_get_dw(NULL,"ModernSkin","SizeMarginOffset_Left",SKIN_OFFSET_LEFT_DEFAULT);
+	r.right-=db_get_dw(NULL,"ModernSkin","SizeMarginOffset_Right",SKIN_OFFSET_RIGHT_DEFAULT);
 
 	if (r.right<r.left) r.right=r.left;
 	if (r.bottom<r.top) r.bottom=r.top;
@@ -1580,7 +1580,7 @@ int CLUI_TestCursorOnBorders()
 		if (!(pt.x>=r.left && pt.x<=r.right && pt.y>=r.top && pt.y<=r.bottom)) k=0;
 		k*=mouse_in_window;
 		hCurs1 = LoadCursor(NULL, IDC_ARROW);
-		if(g_CluiData.nBehindEdgeState<=0 && (!(ModernGetSettingByte(NULL,"CLUI","LockSize",SETTING_LOCKSIZE_DEFAULT))))
+		if(g_CluiData.nBehindEdgeState<=0 && (!(db_get_b(NULL,"CLUI","LockSize",SETTING_LOCKSIZE_DEFAULT))))
 			switch(k)
 		{
 			case 1: 
@@ -1602,7 +1602,7 @@ int CLUI_TestCursorOnBorders()
 
 int CLUI_SizingOnBorder(POINT pt, int PerformSize)
 {
-	if (!(ModernGetSettingByte(NULL,"CLUI","LockSize",SETTING_LOCKSIZE_DEFAULT)))
+	if (!(db_get_b(NULL,"CLUI","LockSize",SETTING_LOCKSIZE_DEFAULT)))
 	{
 		RECT r;
 		HWND hwnd=pcli->hwndContactList;
@@ -1611,10 +1611,10 @@ int CLUI_SizingOnBorder(POINT pt, int PerformSize)
 		/*
 		*  Size borders offset (contract)
 		*/
-		r.top+=ModernGetSettingDword(NULL,"ModernSkin","SizeMarginOffset_Top",SKIN_OFFSET_TOP_DEFAULT);
-		r.bottom-=ModernGetSettingDword(NULL,"ModernSkin","SizeMarginOffset_Bottom",SKIN_OFFSET_BOTTOM_DEFAULT);
-		r.left+=ModernGetSettingDword(NULL,"ModernSkin","SizeMarginOffset_Left",SKIN_OFFSET_LEFT_DEFAULT);
-		r.right-=ModernGetSettingDword(NULL,"ModernSkin","SizeMarginOffset_Right",SKIN_OFFSET_RIGHT_DEFAULT);
+		r.top+=db_get_dw(NULL,"ModernSkin","SizeMarginOffset_Top",SKIN_OFFSET_TOP_DEFAULT);
+		r.bottom-=db_get_dw(NULL,"ModernSkin","SizeMarginOffset_Bottom",SKIN_OFFSET_BOTTOM_DEFAULT);
+		r.left+=db_get_dw(NULL,"ModernSkin","SizeMarginOffset_Left",SKIN_OFFSET_LEFT_DEFAULT);
+		r.right-=db_get_dw(NULL,"ModernSkin","SizeMarginOffset_Right",SKIN_OFFSET_RIGHT_DEFAULT);
 
 		if (r.right<r.left) r.right=r.left;
 		if (r.bottom<r.top) r.bottom=r.top;
@@ -2046,11 +2046,11 @@ LRESULT CLUI::OnSizingMoving( UINT msg, WPARAM wParam, LPARAM lParam )
 			if (!IsIconic(m_hWnd)) {
 				if (!CallService(MS_CLIST_DOCKINGISDOCKED,0,0))
 				{ //if g_CluiData.fDocked, dont remember pos (except for width)
-					ModernWriteSettingDword(NULL,"CList","Height",(DWORD)(rc.bottom - rc.top));
-					ModernWriteSettingDword(NULL,"CList","x",(DWORD)rc.left);
-					ModernWriteSettingDword(NULL,"CList","y",(DWORD)rc.top);
+					db_set_dw(NULL,"CList","Height",(DWORD)(rc.bottom - rc.top));
+					db_set_dw(NULL,"CList","x",(DWORD)rc.left);
+					db_set_dw(NULL,"CList","y",(DWORD)rc.top);
 				}
-				ModernWriteSettingDword(NULL,"CList","Width",(DWORD)(rc.right - rc.left));
+				db_set_dw(NULL,"CList","Width",(DWORD)(rc.right - rc.left));
 			}
 			return TRUE;
 		}
@@ -2086,12 +2086,12 @@ LRESULT CLUI::OnSizingMoving( UINT msg, WPARAM wParam, LPARAM lParam )
 				//       ske_RedrawCompleteWindow();
 				if (!CallService(MS_CLIST_DOCKINGISDOCKED,0,0))
 				{ //if g_CluiData.fDocked, dont remember pos (except for width)
-					ModernWriteSettingDword(NULL,"CList","Height",(DWORD)(rc.bottom - rc.top));
-					ModernWriteSettingDword(NULL,"CList","x",(DWORD)rc.left);
-					ModernWriteSettingDword(NULL,"CList","y",(DWORD)rc.top);
+					db_set_dw(NULL,"CList","Height",(DWORD)(rc.bottom - rc.top));
+					db_set_dw(NULL,"CList","x",(DWORD)rc.left);
+					db_set_dw(NULL,"CList","y",(DWORD)rc.top);
 				}
 				else SetWindowRgn(m_hWnd,NULL,0);
-				ModernWriteSettingDword(NULL,"CList","Width",(DWORD)(rc.right - rc.left));	                               
+				db_set_dw(NULL,"CList","Width",(DWORD)(rc.right - rc.left));	                               
 
 				if (!g_CluiData.fLayered)
 				{
@@ -2104,7 +2104,7 @@ LRESULT CLUI::OnSizingMoving( UINT msg, WPARAM wParam, LPARAM lParam )
 					v=(r.bottom-r.top)>(w*2)?w:(r.bottom-r.top);
 					h=(h<v)?h:v;
 					hRgn1=CreateRoundRectRgn(0,0,(r.right-r.left+1),(r.bottom-r.top+1),h,h);
-					if ((ModernGetSettingByte(NULL,"CLC","RoundCorners",SETTING_ROUNDCORNERS_DEFAULT)) && (!CallService(MS_CLIST_DOCKINGISDOCKED,0,0)))
+					if ((db_get_b(NULL,"CLC","RoundCorners",SETTING_ROUNDCORNERS_DEFAULT)) && (!CallService(MS_CLIST_DOCKINGISDOCKED,0,0)))
 						SetWindowRgn(m_hWnd,hRgn1,FALSE); 
 					else
 					{
@@ -2115,11 +2115,11 @@ LRESULT CLUI::OnSizingMoving( UINT msg, WPARAM wParam, LPARAM lParam )
 				} 			
 			}
 			else {
-				if(ModernGetSettingByte(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT)) {
+				if(db_get_b(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT)) {
 					CLUI_ShowWindowMod(m_hWnd, SW_HIDE);
-					ModernWriteSettingByte(NULL,"CList","State",SETTING_STATE_HIDDEN);
+					db_set_b(NULL,"CList","State",SETTING_STATE_HIDDEN);
 				}
-				else ModernWriteSettingByte(NULL,"CList","State",SETTING_STATE_MINIMIZED);
+				else db_set_b(NULL,"CList","State",SETTING_STATE_MINIMIZED);
 				if (MySetProcessWorkingSetSize != NULL) 
 					MySetProcessWorkingSetSize(GetCurrentProcess(),-1,-1);
 			}
@@ -2175,7 +2175,7 @@ LRESULT CLUI::OnInitMenu( UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ )
 LRESULT CLUI::OnNcPaint( UINT msg, WPARAM wParam, LPARAM lParam )
 {
 	int lRes = DefWindowProc( m_hWnd, msg, wParam, lParam );
-	if ( !g_CluiData.fLayered && ModernGetSettingByte( NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT ))
+	if ( !g_CluiData.fLayered && db_get_b( NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT ))
 	{
 		HDC hdc = NULL;
 		if ( msg == WM_PRINT ) hdc=(HDC)wParam;
@@ -2234,7 +2234,7 @@ LRESULT CLUI::OnPaint( UINT msg, WPARAM wParam, LPARAM lParam )
 		ValidateRect(m_hWnd,NULL);
 
 	}
-	if (0&&(ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT) || ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT)))
+	if (0&&(db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT) || db_get_dw(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT)))
 	{
 		if (IsWindowVisible(m_hWnd))
 			if (g_CluiData.fLayered)
@@ -2297,7 +2297,7 @@ LRESULT CLUI::OnSetAllExtraIcons( UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lPar
 LRESULT CLUI::OnCreateClc( UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ )
 {
 	CreateCLC();
-	if ( ModernGetSettingByte( NULL, "CList", "ShowOnStart", SETTING_SHOWONSTART_DEFAULT )) 
+	if ( db_get_b( NULL, "CList", "ShowOnStart", SETTING_SHOWONSTART_DEFAULT )) 
 		cliShowHide( (WPARAM) m_hWnd, (LPARAM)TRUE );
 	PostMessage( pcli->hwndContactTree, CLM_AUTOREBUILD, 0, 0 );
 
@@ -2422,10 +2422,10 @@ LRESULT CLUI::OnAutoAlphaTimer( UINT msg, WPARAM wParam, LPARAM lParam )
 		HWND hwn=GetCapture();
 		hwn=hwn;
 		bTransparentFocus=inwnd;
-		if(bTransparentFocus) CLUI_SmoothAlphaTransition(m_hWnd, (BYTE)ModernGetSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), 1);
+		if(bTransparentFocus) CLUI_SmoothAlphaTransition(m_hWnd, (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), 1);
 		else  
 		{
-			CLUI_SmoothAlphaTransition(m_hWnd, (BYTE)(g_bTransparentFlag?ModernGetSettingByte(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT):255), 1);
+			CLUI_SmoothAlphaTransition(m_hWnd, (BYTE)(g_bTransparentFlag?db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT):255), 1);
 		}
 	}
 	if (!bTransparentFocus) KillTimer(m_hWnd,TM_AUTOALPHA);
@@ -2512,7 +2512,7 @@ LRESULT CLUI::OnActivate( UINT msg, WPARAM wParam, LPARAM lParam )
 	BOOL IsOption=FALSE;
 	SetCursor(LoadCursor(NULL, IDC_ARROW));
 	SendMessage(pcli->hwndContactTree, WM_ACTIVATE, wParam, lParam);
-	if (ModernGetSettingByte(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT))
+	if (db_get_b(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT))
 	{
 		if(wParam==WA_INACTIVE && ((HWND)lParam!=m_hWnd) && GetParent((HWND)lParam)!=m_hWnd && !IsOption) 
 		{
@@ -2537,11 +2537,11 @@ LRESULT CLUI::OnActivate( UINT msg, WPARAM wParam, LPARAM lParam )
 
 	}
 	else {
-		if (!ModernGetSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT))
+		if (!db_get_b(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT))
 			Sync(CLUIFrames_ActivateSubContainers,TRUE);
 		if(g_bTransparentFlag) {
 			KillTimer(m_hWnd,TM_AUTOALPHA);
-			CLUI_SmoothAlphaTransition(m_hWnd, ModernGetSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), 1);
+			CLUI_SmoothAlphaTransition(m_hWnd, db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), 1);
 			bTransparentFocus=1;
 		}
 	}
@@ -2549,9 +2549,9 @@ LRESULT CLUI::OnActivate( UINT msg, WPARAM wParam, LPARAM lParam )
 	if(g_bTransparentFlag)
 	{
 		BYTE alpha;
-		if (wParam!=WA_INACTIVE || CLUI_CheckOwnedByClui((HWND)lParam)|| IsOption || ((HWND)lParam==m_hWnd) || GetParent((HWND)lParam)==m_hWnd) alpha=ModernGetSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT);
+		if (wParam!=WA_INACTIVE || CLUI_CheckOwnedByClui((HWND)lParam)|| IsOption || ((HWND)lParam==m_hWnd) || GetParent((HWND)lParam)==m_hWnd) alpha=db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT);
 		else 
-			alpha=g_bTransparentFlag?ModernGetSettingByte(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT):255;
+			alpha=g_bTransparentFlag?db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT):255;
 		CLUI_SmoothAlphaTransition(m_hWnd, alpha, 1);
 		if(IsOption) DefWindowProc(m_hWnd,msg,wParam,lParam);
 		else   return 1; 	
@@ -2566,7 +2566,7 @@ LRESULT CLUI::OnSetCursor( UINT msg, WPARAM wParam, LPARAM lParam )
 	if(g_bTransparentFlag) {
 		if (!bTransparentFocus && gf!=m_hWnd)
 		{
-			CLUI_SmoothAlphaTransition(m_hWnd, ModernGetSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), 1);
+			CLUI_SmoothAlphaTransition(m_hWnd, db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), 1);
 			bTransparentFocus=1;
 			CLUI_SafeSetTimer(m_hWnd, TM_AUTOALPHA,250,NULL);
 		}
@@ -2631,7 +2631,7 @@ LRESULT CLUI::OnNcHitTest( UINT msg, WPARAM wParam, LPARAM lParam )
 		pt.y=(short)HIWORD(lParam);
 		t=MenuItemFromPoint(m_hWnd,g_hMenuMain,pt);
 
-		if (t==-1 && (ModernGetSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)))
+		if (t==-1 && (db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)))
 			return HTCAPTION;
 	}
 
@@ -2642,7 +2642,7 @@ LRESULT CLUI::OnNcHitTest( UINT msg, WPARAM wParam, LPARAM lParam )
 		pt.x=(short)LOWORD(lParam);
 		pt.y=(short)HIWORD(lParam);			
 		k=CLUI_SizingOnBorder(pt,0);
-		if (!k && (ModernGetSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)))
+		if (!k && (db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)))
 			return HTCAPTION;
 		else return k+9;
 	}
@@ -2659,7 +2659,7 @@ LRESULT CLUI::OnShowWindow( UINT msg, WPARAM wParam, LPARAM lParam )
 
 		if (!wParam) gAlpha=0;
 		else 
-			gAlpha=(ModernGetSettingByte(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)?ModernGetSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT):255);
+			gAlpha=(db_get_b(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)?db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT):255);
 		if (wParam) 
 		{
 			g_CluiData.bCurrentAlpha=0;
@@ -2684,7 +2684,7 @@ LRESULT CLUI::OnSysCommand( UINT msg, WPARAM wParam, LPARAM lParam )
 		}
 
 	DefWindowProc(m_hWnd, msg, wParam, lParam);
-	if (ModernGetSettingByte(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT))
+	if (db_get_b(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT))
 		Sync( CLUIFrames_ActivateSubContainers, TRUE );
 	return FALSE;
 }
@@ -2699,7 +2699,7 @@ LRESULT CLUI::OnKeyDown( UINT msg, WPARAM wParam, LPARAM lParam )
 LRESULT CLUI::OnGetMinMaxInfo( UINT msg, WPARAM wParam, LPARAM lParam )
 {
 	DefWindowProc(m_hWnd,msg,wParam,lParam);
-	((LPMINMAXINFO)lParam)->ptMinTrackSize.x=max(ModernGetSettingWord(NULL,"CLUI","MinWidth",SETTING_MINWIDTH_DEFAULT),max(18,ModernGetSettingByte(NULL,"CLUI","LeftClientMargin",SETTING_LEFTCLIENTMARIGN_DEFAULT)+ModernGetSettingByte(NULL,"CLUI","RightClientMargin",SETTING_RIGHTCLIENTMARIGN_DEFAULT)+18));
+	((LPMINMAXINFO)lParam)->ptMinTrackSize.x=max(db_get_w(NULL,"CLUI","MinWidth",SETTING_MINWIDTH_DEFAULT),max(18,db_get_b(NULL,"CLUI","LeftClientMargin",SETTING_LEFTCLIENTMARIGN_DEFAULT)+db_get_b(NULL,"CLUI","RightClientMargin",SETTING_RIGHTCLIENTMARIGN_DEFAULT)+18));
 	if (nRequiredHeight==0)
 	{
 		((LPMINMAXINFO)lParam)->ptMinTrackSize.y=CLUIFramesGetMinHeight();
@@ -2744,8 +2744,8 @@ LRESULT CLUI::OnListSizeChangeNotify( NMCLISTCONTROL * pnmc )
 	if ( !g_CluiData.fAutoSize || pcli->hwndContactTree==0 || CallService(MS_CLIST_DOCKINGISDOCKED,0,0))
 		return FALSE;
 
-	maxHeight=ModernGetSettingByte(NULL,"CLUI","MaxSizeHeight",SETTING_MAXSIZEHEIGHT_DEFAULT);
-	minHeight=ModernGetSettingByte(NULL,"CLUI","MinSizeHeight",SETTING_MINSIZEHEIGHT_DEFAULT);
+	maxHeight=db_get_b(NULL,"CLUI","MaxSizeHeight",SETTING_MAXSIZEHEIGHT_DEFAULT);
+	minHeight=db_get_b(NULL,"CLUI","MinSizeHeight",SETTING_MINSIZEHEIGHT_DEFAULT);
 	rcOld=rcWindow;
 	GetWindowRect(pcli->hwndContactTree,&rcTree);
 
@@ -2786,7 +2786,7 @@ LRESULT CLUI::OnListSizeChangeNotify( NMCLISTCONTROL * pnmc )
 
 	if (newHeight==(rcWindow.bottom-rcWindow.top)) return 0;
 
-	if(ModernGetSettingByte(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT)) {
+	if(db_get_b(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT)) {
 		rcWindow.top=rcWindow.bottom-newHeight;
 		if(rcWindow.top<rcWorkArea.top) rcWindow.top=rcWorkArea.top;
 	}
@@ -2847,9 +2847,9 @@ LRESULT CLUI::OnClickNotify( NMCLISTCONTROL * pnmc )
 				if(pnmc->iColumn==e) 
 				{
 					char *email,buf[4096];
-					email= ModernGetStringA(pnmc->hItem,"UserInfo", "Mye-mail0");
+					email= db_get_sa(pnmc->hItem,"UserInfo", "Mye-mail0");
 					if (!email)
-						email= ModernGetStringA(pnmc->hItem, pdnce->m_cache_cszProto, "e-mail");																						
+						email= db_get_sa(pnmc->hItem, pdnce->m_cache_cszProto, "e-mail");																						
 					if (email)
 					{
 						sprintf(buf,"mailto:%s",email);
@@ -2859,9 +2859,9 @@ LRESULT CLUI::OnClickNotify( NMCLISTCONTROL * pnmc )
 				};	
 				if(pnmc->iColumn==w) {
 					char *homepage;
-					homepage= ModernGetStringA(pdnce->m_cache_hContact,"UserInfo", "Homepage");
+					homepage= db_get_sa(pdnce->m_cache_hContact,"UserInfo", "Homepage");
 					if (!homepage)
-						homepage= ModernGetStringA(pdnce->m_cache_hContact,pdnce->m_cache_cszProto, "Homepage");
+						homepage= db_get_sa(pdnce->m_cache_hContact,pdnce->m_cache_cszProto, "Homepage");
 					if (homepage!=NULL)
 					{
 						CallService(MS_UTILS_OPENURL, 1, (LPARAM)homepage);
@@ -2875,7 +2875,7 @@ LRESULT CLUI::OnClickNotify( NMCLISTCONTROL * pnmc )
 		return DefCluiWndProc( WM_NOTIFY, 0, (LPARAM)pnmc );
 	if ((hitFlags&(CLCHT_NOWHERE|CLCHT_INLEFTMARGIN|CLCHT_BELOWITEMS))==0) 
 		return DefCluiWndProc( WM_NOTIFY, 0, (LPARAM)pnmc );
-	if (ModernGetSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) {
+	if (db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) {
 		POINT pt;
 		int res;
 		pt=pnmc->pt;
@@ -2884,7 +2884,7 @@ LRESULT CLUI::OnClickNotify( NMCLISTCONTROL * pnmc )
 		return res;
 	}
 	/*===================*/
-	if (ModernGetSettingByte(NULL,"CLUI","DragToScroll",SETTING_DRAGTOSCROLL_DEFAULT) && !ModernGetSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT))
+	if (db_get_b(NULL,"CLUI","DragToScroll",SETTING_DRAGTOSCROLL_DEFAULT) && !db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT))
 		return ClcEnterDragToScroll(pcli->hwndContactTree,pnmc->pt.y);
 	/*===================*/
 	return 0;
@@ -3041,7 +3041,7 @@ LRESULT CLUI::OnDrawItem( UINT msg, WPARAM wParam, LPARAM lParam )
 
 LRESULT CLUI::OnDestroy( UINT msg, WPARAM wParam, LPARAM lParam )
 {
-	int state=ModernGetSettingByte(NULL,"CList","State",SETTING_STATE_NORMAL);
+	int state=db_get_b(NULL,"CList","State",SETTING_STATE_NORMAL);
 	BOOL wait = FALSE;
 
 	AniAva_UnloadModule();
@@ -3091,18 +3091,18 @@ LRESULT CLUI::OnDestroy( UINT msg, WPARAM wParam, LPARAM lParam )
 		{
 			RECT r;
 			GetWindowRect(pcli->hwndContactList,&r);
-			if(ModernGetSettingByte(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT))
+			if(db_get_b(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT))
 				r.top=r.bottom-CLUIFrames_GetTotalHeight();
 			else 
 				r.bottom=r.top+CLUIFrames_GetTotalHeight();
-			ModernWriteSettingDword(NULL,"CList","y",r.top);
-			ModernWriteSettingDword(NULL,"CList","Height",r.bottom-r.top);
+			db_set_dw(NULL,"CList","y",r.top);
+			db_set_dw(NULL,"CList","Height",r.bottom-r.top);
 		}
 	}
 	UnLoadCLUIFramesModule();
 	//ExtFrames_Uninit();
 	TRACE("CLUI.c: WM_DESTROY - UnLoadCLUIFramesModule DONE\n");
-	ModernWriteSettingByte(NULL,"CList","State",(BYTE)state);
+	db_set_b(NULL,"CList","State",(BYTE)state);
 	ske_UnloadSkin(&g_SkinObjectList);
 
 	delete m_pCLUI;
diff --git a/plugins/Clist_modern/modern_cluiframes.cpp b/plugins/Clist_modern/modern_cluiframes.cpp
index d54c3a715c..7ead50d90f 100644
--- a/plugins/Clist_modern/modern_cluiframes.cpp
+++ b/plugins/Clist_modern/modern_cluiframes.cpp
@@ -204,7 +204,7 @@ int CLUIFrames_ActivateSubContainers( BOOL active)
 		{
 			HWND hwnd=g_pfwFrames[i].OwnerWindow;
 			hwnd=g_pfwFrames[i].hWnd;//OwnerWindow;
-			if (ModernGetSettingByte(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT))
+			if (db_get_b(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT))
 			{
 				SetWindowPos(g_pfwFrames[i].OwnerWindow,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
 				SetWindowPos(g_pfwFrames[i].OwnerWindow,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
@@ -252,7 +252,7 @@ int CLUIFrames_OnShowHide( HWND hwnd, int mode )
 			if (mode!=SW_HIDE)
 			{
 				SetWindowPos(g_pfwFrames[i].OwnerWindow,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
-				if (ModernGetSettingByte(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT))
+				if (db_get_b(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT))
 				{
 					SetWindowPos(g_pfwFrames[i].OwnerWindow,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
 					SetWindowPos(g_pfwFrames[i].OwnerWindow,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
@@ -685,25 +685,25 @@ static int DBLoadFrameSettingsAtPos(int pos,int Frameid)
 
 	//DBWriteContactSettingString(0,CLUIFrameModule,strcat("Name",sadd),Frames[Frameid].name);
 	//boolean
-	g_pfwFrames[Frameid].collapsed=ModernGetSettingByte(0,CLUIFrameModule,AS(buf,"Collapse",sadd),g_pfwFrames[Frameid].collapsed);
+	g_pfwFrames[Frameid].collapsed=db_get_b(0,CLUIFrameModule,AS(buf,"Collapse",sadd),g_pfwFrames[Frameid].collapsed);
 
-	g_pfwFrames[Frameid].Locked					=ModernGetSettingByte(0,CLUIFrameModule,AS(buf,"Locked",sadd),g_pfwFrames[Frameid].Locked);
-	g_pfwFrames[Frameid].visible					=ModernGetSettingByte(0,CLUIFrameModule,AS(buf,"Visible",sadd),g_pfwFrames[Frameid].visible);
-	g_pfwFrames[Frameid].TitleBar.ShowTitleBar	=ModernGetSettingByte(0,CLUIFrameModule,AS(buf,"TBVisile",sadd),g_pfwFrames[Frameid].TitleBar.ShowTitleBar);
+	g_pfwFrames[Frameid].Locked					=db_get_b(0,CLUIFrameModule,AS(buf,"Locked",sadd),g_pfwFrames[Frameid].Locked);
+	g_pfwFrames[Frameid].visible					=db_get_b(0,CLUIFrameModule,AS(buf,"Visible",sadd),g_pfwFrames[Frameid].visible);
+	g_pfwFrames[Frameid].TitleBar.ShowTitleBar	=db_get_b(0,CLUIFrameModule,AS(buf,"TBVisile",sadd),g_pfwFrames[Frameid].TitleBar.ShowTitleBar);
 
-	g_pfwFrames[Frameid].height					=ModernGetSettingWord(0,CLUIFrameModule,AS(buf,"Height",sadd),g_pfwFrames[Frameid].height);
-	g_pfwFrames[Frameid].HeightWhenCollapsed		=ModernGetSettingWord(0,CLUIFrameModule,AS(buf,"HeightCollapsed",sadd),0);
-	g_pfwFrames[Frameid].align					=ModernGetSettingWord(0,CLUIFrameModule,AS(buf,"Align",sadd),g_pfwFrames[Frameid].align);
+	g_pfwFrames[Frameid].height					=db_get_w(0,CLUIFrameModule,AS(buf,"Height",sadd),g_pfwFrames[Frameid].height);
+	g_pfwFrames[Frameid].HeightWhenCollapsed		=db_get_w(0,CLUIFrameModule,AS(buf,"HeightCollapsed",sadd),0);
+	g_pfwFrames[Frameid].align					=db_get_w(0,CLUIFrameModule,AS(buf,"Align",sadd),g_pfwFrames[Frameid].align);
 
-	g_pfwFrames[Frameid].FloatingPos.x		=ModernGetSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatX",sadd),100,0,2048);
-	g_pfwFrames[Frameid].FloatingPos.y		=ModernGetSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatY",sadd),100,0,2048);
-	g_pfwFrames[Frameid].FloatingSize.x		=ModernGetSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatW",sadd),100,0,2048);
-	g_pfwFrames[Frameid].FloatingSize.y		=ModernGetSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatH",sadd),100,0,2048);
+	g_pfwFrames[Frameid].FloatingPos.x		=DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatX",sadd),100,0,2048);
+	g_pfwFrames[Frameid].FloatingPos.y		=DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatY",sadd),100,0,2048);
+	g_pfwFrames[Frameid].FloatingSize.x		=DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatW",sadd),100,0,2048);
+	g_pfwFrames[Frameid].FloatingSize.y		=DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatH",sadd),100,0,2048);
 
-	g_pfwFrames[Frameid].floating			=ModernGetSettingByte(0,CLUIFrameModule,AS(buf,"Floating",sadd),0);
-	g_pfwFrames[Frameid].order				=ModernGetSettingWord(0,CLUIFrameModule,AS(buf,"Order",sadd),0);
+	g_pfwFrames[Frameid].floating			=db_get_b(0,CLUIFrameModule,AS(buf,"Floating",sadd),0);
+	g_pfwFrames[Frameid].order				=db_get_w(0,CLUIFrameModule,AS(buf,"Order",sadd),0);
 
-	g_pfwFrames[Frameid].UseBorder			=ModernGetSettingByte(0,CLUIFrameModule,AS(buf,"UseBorder",sadd),g_pfwFrames[Frameid].UseBorder);
+	g_pfwFrames[Frameid].UseBorder			=db_get_b(0,CLUIFrameModule,AS(buf,"UseBorder",sadd),g_pfwFrames[Frameid].UseBorder);
 
 	return 0;
 }
@@ -715,25 +715,25 @@ static int DBStoreFrameSettingsAtPos(int pos,int Frameid)
 
 	_itoa(pos,sadd,10);
 
-	ModernWriteSettingTString(0,CLUIFrameModule,AS(buf,"Name",sadd),g_pfwFrames[Frameid].Name);
+	db_set_ws(0,CLUIFrameModule,AS(buf,"Name",sadd),g_pfwFrames[Frameid].Name);
 	//boolean
-	ModernWriteSettingByte(0,CLUIFrameModule,AS(buf,"Collapse",sadd),(BYTE)btoint(g_pfwFrames[Frameid].collapsed));
-	ModernWriteSettingByte(0,CLUIFrameModule,AS(buf,"Locked",sadd),(BYTE)btoint(g_pfwFrames[Frameid].Locked));
-	ModernWriteSettingByte(0,CLUIFrameModule,AS(buf,"Visible",sadd),(BYTE)btoint(g_pfwFrames[Frameid].visible));
-	ModernWriteSettingByte(0,CLUIFrameModule,AS(buf,"TBVisile",sadd),(BYTE)btoint(g_pfwFrames[Frameid].TitleBar.ShowTitleBar));
-
-	ModernWriteSettingWord(0,CLUIFrameModule,AS(buf,"Height",sadd),(WORD)g_pfwFrames[Frameid].height);
-	ModernWriteSettingWord(0,CLUIFrameModule,AS(buf,"HeightCollapsed",sadd),(WORD)g_pfwFrames[Frameid].HeightWhenCollapsed);
-	ModernWriteSettingWord(0,CLUIFrameModule,AS(buf,"Align",sadd),(WORD)g_pfwFrames[Frameid].align);
+	db_set_b(0,CLUIFrameModule,AS(buf,"Collapse",sadd),(BYTE)btoint(g_pfwFrames[Frameid].collapsed));
+	db_set_b(0,CLUIFrameModule,AS(buf,"Locked",sadd),(BYTE)btoint(g_pfwFrames[Frameid].Locked));
+	db_set_b(0,CLUIFrameModule,AS(buf,"Visible",sadd),(BYTE)btoint(g_pfwFrames[Frameid].visible));
+	db_set_b(0,CLUIFrameModule,AS(buf,"TBVisile",sadd),(BYTE)btoint(g_pfwFrames[Frameid].TitleBar.ShowTitleBar));
+
+	db_set_w(0,CLUIFrameModule,AS(buf,"Height",sadd),(WORD)g_pfwFrames[Frameid].height);
+	db_set_w(0,CLUIFrameModule,AS(buf,"HeightCollapsed",sadd),(WORD)g_pfwFrames[Frameid].HeightWhenCollapsed);
+	db_set_w(0,CLUIFrameModule,AS(buf,"Align",sadd),(WORD)g_pfwFrames[Frameid].align);
 	//FloatingPos
-	ModernWriteSettingWord(0,CLUIFrameModule,AS(buf,"FloatX",sadd),(WORD)g_pfwFrames[Frameid].FloatingPos.x);
-	ModernWriteSettingWord(0,CLUIFrameModule,AS(buf,"FloatY",sadd),(WORD)g_pfwFrames[Frameid].FloatingPos.y);
-	ModernWriteSettingWord(0,CLUIFrameModule,AS(buf,"FloatW",sadd),(WORD)g_pfwFrames[Frameid].FloatingSize.x);
-	ModernWriteSettingWord(0,CLUIFrameModule,AS(buf,"FloatH",sadd),(WORD)g_pfwFrames[Frameid].FloatingSize.y);
-
-	ModernWriteSettingByte(0,CLUIFrameModule,AS(buf,"Floating",sadd),(BYTE)btoint(g_pfwFrames[Frameid].floating));
-	ModernWriteSettingByte(0,CLUIFrameModule,AS(buf,"UseBorder",sadd),(BYTE)btoint(g_pfwFrames[Frameid].UseBorder));
-	ModernWriteSettingWord(0,CLUIFrameModule,AS(buf,"Order",sadd),(WORD)g_pfwFrames[Frameid].order);
+	db_set_w(0,CLUIFrameModule,AS(buf,"FloatX",sadd),(WORD)g_pfwFrames[Frameid].FloatingPos.x);
+	db_set_w(0,CLUIFrameModule,AS(buf,"FloatY",sadd),(WORD)g_pfwFrames[Frameid].FloatingPos.y);
+	db_set_w(0,CLUIFrameModule,AS(buf,"FloatW",sadd),(WORD)g_pfwFrames[Frameid].FloatingSize.x);
+	db_set_w(0,CLUIFrameModule,AS(buf,"FloatH",sadd),(WORD)g_pfwFrames[Frameid].FloatingSize.y);
+
+	db_set_b(0,CLUIFrameModule,AS(buf,"Floating",sadd),(BYTE)btoint(g_pfwFrames[Frameid].floating));
+	db_set_b(0,CLUIFrameModule,AS(buf,"UseBorder",sadd),(BYTE)btoint(g_pfwFrames[Frameid].UseBorder));
+	db_set_w(0,CLUIFrameModule,AS(buf,"Order",sadd),(WORD)g_pfwFrames[Frameid].order);
 	return 0;
 }
 
@@ -748,15 +748,15 @@ static int LocateStorePosition(int Frameid,int maxstored)
 
         mir_snprintf(settingname,SIZEOF(settingname),"Name%d",i);
         DBVARIANT dbv={0};
-        if ( ModernGetSettingTString( NULL, CLUIFrameModule, settingname, &dbv ))
+        if ( DBGetContactSettingTString( NULL, CLUIFrameModule, settingname, &dbv ))
             continue;
 
 		if ( lstrcmpi( dbv.ptszVal, g_pfwFrames[Frameid].Name ) ==0 )
         {
-			ModernDBFreeVariant( &dbv );
+			db_free( &dbv );
 			return i;
 		}
-        ModernDBFreeVariant( &dbv );
+        db_free( &dbv );
 	}
 	return -1;
 }
@@ -769,7 +769,7 @@ static int CLUIFramesLoadFrameSettings(int Frameid)
 
 	if(Frameid<0||Frameid>=g_nFramesCount) return -1;
 
-	maxstored=ModernGetSettingWord(0,CLUIFrameModule,"StoredFrames",-1);
+	maxstored=db_get_w(0,CLUIFrameModule,"StoredFrames",-1);
 	if(maxstored==-1) return 0;
 
 	storpos=LocateStorePosition(Frameid,maxstored);
@@ -787,14 +787,14 @@ static int CLUIFramesStoreFrameSettings(int Frameid)
 
 	if(Frameid<0||Frameid>=g_nFramesCount) return -1;
 
-	maxstored=ModernGetSettingWord(0,CLUIFrameModule,"StoredFrames",-1);
+	maxstored=db_get_w(0,CLUIFrameModule,"StoredFrames",-1);
 	if(maxstored==-1) maxstored=0;
 
 	storpos=LocateStorePosition(Frameid,maxstored);
 	if(storpos==-1) {storpos=maxstored; maxstored++;}
 
 	DBStoreFrameSettingsAtPos(storpos,Frameid);
-	ModernWriteSettingWord(0,CLUIFrameModule,"StoredFrames",(WORD)maxstored);
+	db_set_w(0,CLUIFrameModule,"StoredFrames",(WORD)maxstored);
 
 	return 0;
 }
@@ -1924,7 +1924,7 @@ static int _us_DoAddFrame(WPARAM wParam,LPARAM lParam)
 	//override tbbtip
 	//clfrm->Flags|=F_SHOWTBTIP;
 	//
-	if (ModernGetSettingByte(0,CLUIFrameModule,"RemoveAllBorders",0)==1)
+	if (db_get_b(0,CLUIFrameModule,"RemoveAllBorders",0)==1)
 	{
 		clfrm->Flags|=F_NOBORDER;
 	};
@@ -1963,7 +1963,7 @@ static int _us_DoAddFrame(WPARAM wParam,LPARAM lParam)
 
 	g_pfwFrames[g_nFramesCount].TitleBar.hwnd
 		=CreateWindow(CLUIFrameTitleBarClassName,g_pfwFrames[g_nFramesCount].Name,
-		(ModernGetSettingByte(0,CLUIFrameModule,"RemoveAllTitleBarBorders",1)?0:WS_BORDER)
+		(db_get_b(0,CLUIFrameModule,"RemoveAllTitleBarBorders",1)?0:WS_BORDER)
 
 		|WS_CHILD|WS_CLIPCHILDREN|
 		(g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBar?WS_VISIBLE:0)|
@@ -2037,7 +2037,7 @@ static int _us_DoAddFrame(WPARAM wParam,LPARAM lParam)
 		if (mainHeight<minHeight)
 		{
 			BOOL Upward=FALSE;
-			Upward=!g_CluiData.fDocked&&g_CluiData.fAutoSize&&ModernGetSettingByte(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT);
+			Upward=!g_CluiData.fDocked&&g_CluiData.fAutoSize&&db_get_b(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT);
 
 			if (Upward)
 				mainRect.top=mainRect.bottom-minHeight;
@@ -2258,7 +2258,7 @@ int CLUIFrames_GetTotalHeight()
 	//TODO minsize
 	sumheight+=g_CluiData.TopClientMargin;
 	sumheight+=g_CluiData.BottomClientMargin;
-	return  max(ModernGetSettingWord(NULL,"CLUI","MinHeight",SETTING_MINHEIGTH_DEFAULT),
+	return  max(db_get_w(NULL,"CLUI","MinHeight",SETTING_MINHEIGTH_DEFAULT),
 		(sumheight+border.top+border.bottom));
 }
 
@@ -2298,7 +2298,7 @@ int CLUIFramesGetMinHeight()
 	//TODO minsize
 	sumheight+=g_CluiData.TopClientMargin;
 	sumheight+=g_CluiData.BottomClientMargin;
-	return  max(ModernGetSettingWord(NULL,"CLUI","MinHeight",SETTING_MINHEIGTH_DEFAULT),
+	return  max(db_get_w(NULL,"CLUI","MinHeight",SETTING_MINHEIGTH_DEFAULT),
 		(sumheight+border.top+border.bottom+allbord+tbh)       );
 }
 
@@ -2319,8 +2319,8 @@ static int CLUIFramesResizeFrames(const RECT newsize)
 	SortData *sdarray;
 
 
-	g_CluiData.nGapBetweenTitlebar=(int)ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT);
-	GapBetweenFrames=ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT);
+	g_CluiData.nGapBetweenTitlebar=(int)db_get_dw(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT);
+	GapBetweenFrames=db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT);
 	sepw=GapBetweenFrames;
 
 	if(g_nFramesCount<1) return 0;
@@ -2509,8 +2509,8 @@ int CLUIFrames_OnClistResize_mod(WPARAM wParam,LPARAM mode)
 {
 	RECT nRect;
 	int tick;
-	GapBetweenFrames=ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT);
-	g_CluiData.nGapBetweenTitlebar=ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT);
+	GapBetweenFrames=db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT);
+	g_CluiData.nGapBetweenTitlebar=db_get_dw(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT);
 	if (_fCluiFramesModuleNotStarted) return -1;
 
 	GetClientRect(pcli->hwndContactList,&nRect);
@@ -2539,8 +2539,8 @@ int SizeFramesByWindowRect(RECT *r, HDWP * PosBatch, int mode)
 	RECT nRect;
 	if (_fCluiFramesModuleNotStarted) return -1;
 
-	g_CluiData.nGapBetweenTitlebar=(int)ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT);
-	GapBetweenFrames=ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT);
+	g_CluiData.nGapBetweenTitlebar=(int)db_get_dw(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT);
+	GapBetweenFrames=db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT);
 	nRect.left=0;
 	nRect.top=0;
 	nRect.right=r->right-r->left;
@@ -2626,8 +2626,8 @@ int CheckFramesPos(RECT *wr)
 	//CALLED only FROM MainWindow procedure at CLUI.c
 	int i;
 	if (_fCluiFramesModuleNotStarted) return -1;
-	g_CluiData.nGapBetweenTitlebar=(int)ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT);
-	GapBetweenFrames=ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT);
+	g_CluiData.nGapBetweenTitlebar=(int)db_get_dw(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT);
+	GapBetweenFrames=db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT);
 
 	for(i=0;i<g_nFramesCount;i++)
 	{
@@ -2665,8 +2665,8 @@ int CLUIFramesOnClistResize(WPARAM wParam,LPARAM lParam)
 {
 	RECT nRect;
 	int tick;
-	GapBetweenFrames=ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT);
-	g_CluiData.nGapBetweenTitlebar=ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT);
+	GapBetweenFrames=db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT);
+	g_CluiData.nGapBetweenTitlebar=db_get_dw(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT);
 
 	if (_fCluiFramesModuleNotStarted) return -1;
 
@@ -2680,7 +2680,7 @@ int CLUIFramesOnClistResize(WPARAM wParam,LPARAM lParam)
 		if (mainHeight<minHeight)
 		{
 			BOOL Upward=FALSE;
-			Upward=!g_CluiData.fDocked && g_CluiData.fAutoSize&&ModernGetSettingByte(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT);
+			Upward=!g_CluiData.fDocked && g_CluiData.fAutoSize&&db_get_b(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT);
 
 			if (Upward)
 				mainRect.top=mainRect.bottom-minHeight;
@@ -2770,22 +2770,22 @@ int OnFrameTitleBarBackgroundChange(WPARAM wParam,LPARAM lParam)
 	{
 		DBVARIANT dbv={0};
 
-		AlignCOLLIconToLeft=ModernGetSettingByte(NULL,"FrameTitleBar","AlignCOLLIconToLeft",CLCDEFAULT_COLLICONTOLEFT);
+		AlignCOLLIconToLeft=db_get_b(NULL,"FrameTitleBar","AlignCOLLIconToLeft",CLCDEFAULT_COLLICONTOLEFT);
 
 		bkColour=sttGetColor("FrameTitleBar","BkColour",CLCDEFAULT_BKCOLOUR);
-		bkUseWinColours=ModernGetSettingByte(NULL,"FrameTitleBar","UseWinColours",CLCDEFAULT_USEWINDOWSCOLOURS);
+		bkUseWinColours=db_get_b(NULL,"FrameTitleBar","UseWinColours",CLCDEFAULT_USEWINDOWSCOLOURS);
 		SelBkColour=sttGetColor("FrameTitleBar","TextColour",CLCDEFAULT_TEXTCOLOUR);
 		if(hBmpBackground) {DeleteObject(hBmpBackground); hBmpBackground=NULL;}
 		if (g_CluiData.fDisableSkinEngine)
 		{
-			if(ModernGetSettingByte(NULL,"FrameTitleBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
-				if (!ModernGetSettingString(NULL,"FrameTitleBar","BkBitmap",&dbv)) {
+			if(db_get_b(NULL,"FrameTitleBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
+				if (!DBGetContactSettingString(NULL,"FrameTitleBar","BkBitmap",&dbv)) {
 					hBmpBackground=(HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
 					//mir_free_and_nill(dbv.pszVal);
-					ModernDBFreeVariant(&dbv);
+					db_free(&dbv);
 				}
 			}
-			backgroundBmpUse=ModernGetSettingWord(NULL,"FrameTitleBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
+			backgroundBmpUse=db_get_w(NULL,"FrameTitleBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
 		}
 	};
 
@@ -3199,7 +3199,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam
 
 			if ((!(wParam&MK_CONTROL))&&g_pfwFrames[framepos].Locked&&(!(g_pfwFrames[framepos].floating)))
 			{
-				if (ModernGetSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) {
+				if (db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) {
 					POINT pt;
 					int res;
 					//pt=nm->pt;
@@ -3600,7 +3600,7 @@ static LRESULT CALLBACK CLUIFrameSubContainerProc(HWND hwnd, UINT msg, WPARAM wP
 			  if ((wParam!=WA_INACTIVE || ((HWND)lParam==hwnd) || GetParent((HWND)lParam)==hwnd))
 			  {
 				  HWND hw=lParam?GetParent((HWND)lParam):0;
-				  alpha=ModernGetSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT);
+				  alpha=db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT);
 				  if (hw) SetWindowPos(hw,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE);
 				  CLUI_SmoothAlphaTransition(hwnd, alpha, 1);
 			  }
@@ -3856,7 +3856,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP
 		};
 	case WM_LBUTTONDOWN:
 		{
-			if (ModernGetSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) {
+			if (db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) {
 				POINT pt;
 				GetCursorPos(&pt);
 				return SendMessage( hwnd, WM_SYSCOMMAND, SC_MOVE|HTCAPTION,MAKELPARAM(pt.x,pt.y));
@@ -4097,7 +4097,7 @@ int LoadCLUIFramesModule(void)
 	RegisterClass(&cntclass);
 	//end container helper
 
-	GapBetweenFrames=ModernGetSettingDword(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT);
+	GapBetweenFrames=db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT);
 
 	g_nFramesCount=0;
 
diff --git a/plugins/Clist_modern/modern_cluiservices.cpp b/plugins/Clist_modern/modern_cluiservices.cpp
index e237c2a125..f88e4554c7 100644
--- a/plugins/Clist_modern/modern_cluiservices.cpp
+++ b/plugins/Clist_modern/modern_cluiservices.cpp
@@ -120,22 +120,22 @@ static INT_PTR ListEndRebuild(WPARAM wParam, LPARAM lParam)
 {
 	int rebuild = 0;
 	//CLC does this automatically, but we need to force it if hideoffline or hideempty has changed
-	if ((ModernGetSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) == 0) != ((GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEOFFLINE) == 0)) {
-		if (ModernGetSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT))
+	if ((db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) == 0) != ((GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEOFFLINE) == 0)) {
+		if (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT))
 			SetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE, GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) | CLS_HIDEOFFLINE);
 		else
 			SetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE, GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & ~CLS_HIDEOFFLINE);
 		rebuild = 1;
 	}
-	if ((ModernGetSettingByte(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) == 0) != ((GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) == 0)) {
-		if (ModernGetSettingByte(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT))
+	if ((db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) == 0) != ((GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) == 0)) {
+		if (db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT))
 			SetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE, GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) | CLS_HIDEEMPTYGROUPS);
 		else
 			SetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE, GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & ~CLS_HIDEEMPTYGROUPS);
 		rebuild = 1;
 	}
-	if ((ModernGetSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) == 0) != ((GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS) == 0)) {
-		if (ModernGetSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
+	if ((db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) == 0) != ((GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS) == 0)) {
+		if (db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
 			SetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE, GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) | CLS_USEGROUPS);
 		else
 			SetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE, GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & ~CLS_USEGROUPS);
diff --git a/plugins/Clist_modern/modern_commonheaders.cpp b/plugins/Clist_modern/modern_commonheaders.cpp
index 4cf9009138..4b4fe7f9be 100644
--- a/plugins/Clist_modern/modern_commonheaders.cpp
+++ b/plugins/Clist_modern/modern_commonheaders.cpp
@@ -1,113 +1,6 @@
 #define DB_USEHELPERFUNCTIONS
 #include "hdr/modern_commonheaders.h"
 
-int __cdecl ModernGetSettingByte_Helper(HANDLE hContact,	const char *szModule, const char *szSetting, int errorValue, const char *szFile, const int nLine)
-{
-	#if defined( _DEBUG )
-		return DBGetContactSettingByte_Helper( hContact, szModule, szSetting, errorValue, szFile, nLine );
-	#else
-		return DBGetContactSettingByte_Helper( hContact, szModule, szSetting, errorValue );
-	#endif
-}
-
-int __cdecl ModernGetSettingWord_Helper(HANDLE hContact,	const char *szModule, const char *szSetting, int errorValue, const char *szFile, const int nLine)
-{
-	#if defined( _DEBUG )
-		return DBGetContactSettingWord_Helper( hContact, szModule, szSetting, errorValue, szFile, nLine );
-	#else
-		return DBGetContactSettingWord_Helper( hContact, szModule, szSetting, errorValue );
-	#endif
-}
-
-int __cdecl ModernGetSettingDword_Helper(HANDLE hContact, const char *szModule, const char *szSetting, int errorValue, const char *szFile, const int nLine)
-{
-	#if defined( _DEBUG )
-		return DBGetContactSettingDword_Helper( hContact, szModule, szSetting, errorValue, szFile, nLine );
-	#else
-		return DBGetContactSettingDword_Helper( hContact, szModule, szSetting, errorValue );
-	#endif
-}
-
-int __cdecl ModernGetSettingString_Helper(HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv, const char *szFile, const int nLine, const int nType)
-{
-	#if defined( _DEBUG )
-		return DBGetContactSettingString_Helper( hContact, szModule, szSetting, dbv, szFile, nLine, nType );
-	#else
-		return DBGetContactSettingString_Helper( hContact, szModule, szSetting, dbv, nType );
-	#endif
-}
-
-int __cdecl ModernGetSetting_Helper(HANDLE hContact,const char *szModule,const char *szSetting,DBVARIANT *dbv, const char *szFile, const int nLine)
-{
-	#if defined( _DEBUG )
-		return DBGetContactSetting_Helper(hContact, szModule, szSetting, dbv, szFile, nLine);
-	#else
-		return DBGetContactSetting_Helper(hContact, szModule, szSetting, dbv);
-	#endif
-}
-
-int __cdecl ModernWriteSettingByte(HANDLE hContact,const char *szModule,const char *szSetting,BYTE val)
-{
-    return DBWriteContactSettingByte( hContact, szModule, szSetting, val);
-}
-
-int __cdecl ModernWriteSettingWord(HANDLE hContact,const char *szModule,const char *szSetting,WORD val)
-{
-    return DBWriteContactSettingWord( hContact, szModule, szSetting, val);
-}
-
-int __cdecl ModernWriteSettingDword(HANDLE hContact,const char *szModule,const char *szSetting,DWORD val)
-{
-    return DBWriteContactSettingDword( hContact, szModule, szSetting, val);
-}
-
-int __cdecl ModernWriteSettingString(HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
-{
-    return DBWriteContactSettingString( hContact, szModule, szSetting, val );
-}
-
-int __cdecl ModernWriteSettingWString(HANDLE hContact,const char *szModule,const char *szSetting,const WCHAR *val)
-{
-    return DBWriteContactSettingWString( hContact, szModule, szSetting, val );
-}
-
-int __cdecl ModernDBFreeVariant(DBVARIANT *dbv)
-{
-    return DBFreeVariant( dbv );
-}
-
-int __cdecl ModernDeleteSetting(HANDLE hContact,const char *szModule,const char *szSetting)
-{
-    return DBDeleteContactSetting( hContact, szModule, szSetting );
-}
-
-char*  __cdecl ModernGetStringA( HANDLE hContact, const char *szModule, const char *szSetting )
-{
-    char *str=NULL;
-    DBVARIANT dbv={0};
-    ModernGetSettingString(hContact,szModule,szSetting,&dbv);
-    if(dbv.type==DBVT_ASCIIZ)
-        str=mir_strdup(dbv.pszVal);
-    ModernDBFreeVariant(&dbv);
-    return str;
-}
-
-wchar_t*  __cdecl ModernGetStringW( HANDLE hContact, const char *szModule, const char *szSetting )
-{
-	wchar_t *str=NULL;
-	DBVARIANT dbv={0};
-	DBGetContactSettingWString(hContact,szModule,szSetting,&dbv);
-	if(dbv.type==DBVT_WCHAR)
-		str=mir_wstrdup(dbv.pwszVal);
-	DBFreeVariant(&dbv);
-	return str;
-}
-
-WORD   __cdecl ModernGetSettingRangedWord(HANDLE hContact, const char *szModule, const char *szSetting, WORD errorValue, WORD minValue, WORD maxValue) 
-{
-	return DBGetContactSettingRangedWord( hContact, szModule, szSetting, errorValue, minValue, maxValue);
-}
-
 BYTE gl_TrimText=1;
 
 char * __cdecl strstri( char *a, const char *b)
diff --git a/plugins/Clist_modern/modern_contact.cpp b/plugins/Clist_modern/modern_contact.cpp
index d8613d9a06..1b43db4610 100644
--- a/plugins/Clist_modern/modern_contact.cpp
+++ b/plugins/Clist_modern/modern_contact.cpp
@@ -177,9 +177,9 @@ INT_PTR ContactChangeGroup(WPARAM wParam,LPARAM lParam)
 {
 	CallService(MS_CLUI_CONTACTDELETED,wParam,0);
 	if ((HANDLE)lParam==NULL)
-		ModernDeleteSetting((HANDLE)wParam,"CList","Group");
+		db_unset((HANDLE)wParam,"CList","Group");
 	else
-		ModernWriteSettingTString((HANDLE)wParam,"CList","Group",pcli->pfnGetGroupName(lParam, NULL));
+		db_set_ws((HANDLE)wParam,"CList","Group",pcli->pfnGetGroupName(lParam, NULL));
 	CallService(MS_CLUI_CONTACTADDED,wParam,ExtIconFromStatusMode((HANDLE)wParam,(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0),GetContactStatus((HANDLE)wParam)));
 	return 0;
 }
@@ -192,8 +192,8 @@ INT_PTR ToggleHideOffline(WPARAM wParam,LPARAM lParam)
 INT_PTR ToggleGroups(WPARAM wParam,LPARAM lParam)
 {
 
-	ModernWriteSettingByte(NULL, "CList", "UseGroups",
-				(BYTE) !ModernGetSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
+	db_set_b(NULL, "CList", "UseGroups",
+				(BYTE) !db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
 	pcli->pfnLoadContactTree();
 	return 0;
 }
@@ -206,14 +206,14 @@ INT_PTR SetUseGroups(WPARAM wParam, LPARAM lParam)
 		if ( !newVal == wParam ) return 0;
 		newVal = wParam;
 	}
-	ModernWriteSettingByte(NULL,"CList","UseGroups",(BYTE)newVal);
+	db_set_b(NULL,"CList","UseGroups",(BYTE)newVal);
 	SendMessage(pcli->hwndContactTree,CLM_SETUSEGROUPS,newVal,0);
 	return 0;
 }
 
 INT_PTR ToggleSounds(WPARAM wParam,LPARAM lParam)
 {
-	ModernWriteSettingByte(NULL, "Skin", "UseSound",
-		(BYTE) !ModernGetSettingByte(NULL, "Skin", "UseSound", SETTING_ENABLESOUNDS_DEFAULT ));
+	db_set_b(NULL, "Skin", "UseSound",
+		(BYTE) !db_get_b(NULL, "Skin", "UseSound", SETTING_ENABLESOUNDS_DEFAULT ));
 	return 0;
 }
diff --git a/plugins/Clist_modern/modern_docking.cpp b/plugins/Clist_modern/modern_docking.cpp
index a7ffe8e506..d9d4c717da 100644
--- a/plugins/Clist_modern/modern_docking.cpp
+++ b/plugins/Clist_modern/modern_docking.cpp
@@ -109,13 +109,13 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam)
 	MSG *msg=(MSG*)wParam;
 
 	if(msg->message==WM_DESTROY) 
-		ModernWriteSettingByte(NULL,"CList","Docked",(BYTE)g_CluiData.fDocked);
+		db_set_b(NULL,"CList","Docked",(BYTE)g_CluiData.fDocked);
 
 	if (!g_CluiData.fDocked && msg->message!=WM_CREATE && msg->message!=WM_MOVING && msg->message!=WM_CREATEDOCKED && msg->message != WM_MOVE && msg->message != WM_SIZE) return 0;
 	switch(msg->message) {
 		case WM_CREATE:
 			//if(GetSystemMetrics(SM_CMONITORS)>1) return 0;
-			if(ModernGetSettingByte(NULL,"CList","Docked",0) && ModernGetSettingByte(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT)) 
+			if(db_get_b(NULL,"CList","Docked",0) && db_get_b(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT)) 
 			{
 				PostMessage(msg->hwnd,WM_CREATEDOCKED,0,0);
 			}
@@ -124,7 +124,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam)
 
 		case WM_CREATEDOCKED:
 			//we need to post a message just after creation to let main message function do some work
-			g_CluiData.fDocked=(BOOL)ModernGetSettingByte(NULL,"CList","Docked",0);
+			g_CluiData.fDocked=(BOOL)db_get_b(NULL,"CList","Docked",0);
 			if(IsWindowVisible(msg->hwnd) && !IsIconic(msg->hwnd)) {
 				RECT rc, rcMonitor;
 				ZeroMemory(&abd,sizeof(abd));
@@ -187,7 +187,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam)
 
 				if (((ptCursor.x<rcMonitor.left+EDGESENSITIVITY) 
 					|| (ptCursor.x>=rcMonitor.right-EDGESENSITIVITY))
-					&& ModernGetSettingByte(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT))
+					&& db_get_b(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT))
 				{
 					ZeroMemory(&abd,sizeof(abd));
 					abd.cbSize=sizeof(abd);
@@ -211,7 +211,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam)
 					Sync(CLUIFrames_OnMoving,msg->hwnd,(LPRECT)msg->lParam);
 					g_CluiData.mutexPreventDockMoving=1;
 					mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
-					ModernWriteSettingByte(NULL,"CList","Docked",(BYTE)g_CluiData.fDocked);
+					db_set_b(NULL,"CList","Docked",(BYTE)g_CluiData.fDocked);
 					ModernSkinButton_ReposButtons( msg->hwnd, SBRF_DO_NOT_DRAW, NULL );
 					return TRUE;
 				}
@@ -271,7 +271,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam)
 		case WM_SHOWWINDOW:
 			{
 				if(msg->lParam) return 0;
-				BOOL toBeDocked = (BOOL) ModernGetSettingByte(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT);
+				BOOL toBeDocked = (BOOL) db_get_b(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT);
 				if ((msg->wParam && g_CluiData.fDocked<0) || (!msg->wParam && g_CluiData.fDocked>0)) g_CluiData.fDocked=-g_CluiData.fDocked;
 				ZeroMemory(&abd,sizeof(abd));
 				abd.cbSize=sizeof(abd);
@@ -328,8 +328,8 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam)
 					g_CluiData.fDocked=0;
 					GetCursorPos(&pt);
 					PostMessage(msg->hwnd,WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(pt.x,pt.y));
-					SetWindowPos(msg->hwnd,0,pt.x-rc.right/2,pt.y-GetSystemMetrics(SM_CYFRAME)-GetSystemMetrics(SM_CYSMCAPTION)/2,ModernGetSettingDword(NULL,"CList","Width",0),ModernGetSettingDword(NULL,"CList","Height",0),SWP_NOZORDER);
-					ModernWriteSettingByte(NULL,"CList","Docked",(BYTE)g_CluiData.fDocked);
+					SetWindowPos(msg->hwnd,0,pt.x-rc.right/2,pt.y-GetSystemMetrics(SM_CYFRAME)-GetSystemMetrics(SM_CYSMCAPTION)/2,db_get_dw(NULL,"CList","Width",0),db_get_dw(NULL,"CList","Height",0),SWP_NOZORDER);
+					db_set_b(NULL,"CList","Docked",(BYTE)g_CluiData.fDocked);
 					// ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW, NULL);
 				}
 				return 1;
diff --git a/plugins/Clist_modern/modern_extraimage.cpp b/plugins/Clist_modern/modern_extraimage.cpp
index 71433e4123..2fb3a26331 100644
--- a/plugins/Clist_modern/modern_extraimage.cpp
+++ b/plugins/Clist_modern/modern_extraimage.cpp
@@ -48,16 +48,16 @@ boolean isColumnVisible(int extra)
 		{
 			switch(i+1)
 			{
-				case EXTRA_ICON_EMAIL:		return(ModernGetSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_EMAIL",SETTING_EXTRA_ICON_EMAIL_DEFAULT));
-				case EXTRA_ICON_PROTO:		return(ModernGetSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_PROTO",SETTING_EXTRA_ICON_PROTO_DEFAULT));
-				case EXTRA_ICON_SMS:		return(ModernGetSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_SMS",SETTING_EXTRA_ICON_SMS_DEFAULT));
-				case EXTRA_ICON_ADV1:		return(ModernGetSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_ADV1",SETTING_EXTRA_ICON_ADV1_DEFAULT));
-				case EXTRA_ICON_ADV2:		return(ModernGetSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_ADV2",SETTING_EXTRA_ICON_ADV2_DEFAULT));	
-				case EXTRA_ICON_WEB:		return(ModernGetSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_WEB",SETTING_EXTRA_ICON_WEB_DEFAULT));
-				case EXTRA_ICON_CLIENT:		return(ModernGetSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_CLIENT",SETTING_EXTRA_ICON_CLIENT_DEFAULT));
-				case EXTRA_ICON_VISMODE:	return(ModernGetSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_VISMODE",SETTING_EXTRA_ICON_VISMODE_DEFAULT));
-				case EXTRA_ICON_ADV3:		return(ModernGetSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_ADV3",SETTING_EXTRA_ICON_ADV3_DEFAULT));
-				case EXTRA_ICON_ADV4:		return(ModernGetSettingByte(NULL,CLUIFrameModule,"EXTRA_ICON_ADV4",SETTING_EXTRA_ICON_ADV4_DEFAULT));			
+				case EXTRA_ICON_EMAIL:		return(db_get_b(NULL,CLUIFrameModule,"EXTRA_ICON_EMAIL",SETTING_EXTRA_ICON_EMAIL_DEFAULT));
+				case EXTRA_ICON_PROTO:		return(db_get_b(NULL,CLUIFrameModule,"EXTRA_ICON_PROTO",SETTING_EXTRA_ICON_PROTO_DEFAULT));
+				case EXTRA_ICON_SMS:		return(db_get_b(NULL,CLUIFrameModule,"EXTRA_ICON_SMS",SETTING_EXTRA_ICON_SMS_DEFAULT));
+				case EXTRA_ICON_ADV1:		return(db_get_b(NULL,CLUIFrameModule,"EXTRA_ICON_ADV1",SETTING_EXTRA_ICON_ADV1_DEFAULT));
+				case EXTRA_ICON_ADV2:		return(db_get_b(NULL,CLUIFrameModule,"EXTRA_ICON_ADV2",SETTING_EXTRA_ICON_ADV2_DEFAULT));	
+				case EXTRA_ICON_WEB:		return(db_get_b(NULL,CLUIFrameModule,"EXTRA_ICON_WEB",SETTING_EXTRA_ICON_WEB_DEFAULT));
+				case EXTRA_ICON_CLIENT:		return(db_get_b(NULL,CLUIFrameModule,"EXTRA_ICON_CLIENT",SETTING_EXTRA_ICON_CLIENT_DEFAULT));
+				case EXTRA_ICON_VISMODE:	return(db_get_b(NULL,CLUIFrameModule,"EXTRA_ICON_VISMODE",SETTING_EXTRA_ICON_VISMODE_DEFAULT));
+				case EXTRA_ICON_ADV3:		return(db_get_b(NULL,CLUIFrameModule,"EXTRA_ICON_ADV3",SETTING_EXTRA_ICON_ADV3_DEFAULT));
+				case EXTRA_ICON_ADV4:		return(db_get_b(NULL,CLUIFrameModule,"EXTRA_ICON_ADV4",SETTING_EXTRA_ICON_ADV4_DEFAULT));			
 			}
 			break;
 		}
@@ -165,7 +165,7 @@ void SetNewExtraColumnCount()
 	LoadPositionsFromDB(ExtraOrder);
 	GetVisColumns();
 	newcount=colsum(0,EXTRACOLUMNCOUNT-1);
-	ModernWriteSettingByte(NULL,CLUIFrameModule,"EnabledColumnCount",(BYTE)newcount);
+	db_set_b(NULL,CLUIFrameModule,"EnabledColumnCount",(BYTE)newcount);
 	EnabledColumnCount=newcount;
 	SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS,EnabledColumnCount,0);
 };
@@ -177,7 +177,7 @@ void ExtraImage_ReloadExtraIcons()
 	HICON hicon;
 	BOOL needFree;
 
-	SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNSSPACE,ModernGetSettingByte(NULL,"CLUI","ExtraColumnSpace",18),0);					
+	SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNSSPACE,db_get_b(NULL,"CLUI","ExtraColumnSpace",18),0);					
 	SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGELIST,0,(LPARAM)NULL);		
 	if (hExtraImageList){ImageList_Destroy(hExtraImageList);};
 	if (hWideExtraImageList){ImageList_Destroy(hWideExtraImageList);};
@@ -337,9 +337,9 @@ void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact)
 					if (szProto != NULL)
 					{
 						char *homepage;
-						homepage= ModernGetStringA(pdnce->m_cache_hContact,"UserInfo", "Homepage");
+						homepage= db_get_sa(pdnce->m_cache_hContact,"UserInfo", "Homepage");
 						if (!homepage)
-							homepage= ModernGetStringA(pdnce->m_cache_hContact,pdnce->m_cache_cszProto, "Homepage");
+							homepage= db_get_sa(pdnce->m_cache_hContact,pdnce->m_cache_cszProto, "Homepage");
 						if (homepage!=NULL)
 						{											
 							showweb=TRUE;				
@@ -356,14 +356,14 @@ void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact)
 				if (ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_EMAIL)!=-1)
 				{
 
-					if (szProto == NULL || ModernGetSettingString(hContact, szProto, "e-mail",&dbv)) 
+					if (szProto == NULL || DBGetContactSettingString(hContact, szProto, "e-mail",&dbv)) 
 					{
-						ModernDBFreeVariant(&dbv);
-						if (ModernGetSettingString(hContact, "UserInfo", "Mye-mail0", &dbv))
+						db_free(&dbv);
+						if (DBGetContactSettingString(hContact, "UserInfo", "Mye-mail0", &dbv))
 							showemail=FALSE;					
 					}
 					SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_EMAIL),(showemail)?0:0xFF));	
-					ModernDBFreeVariant(&dbv);
+					db_free(&dbv);
 				}
 			}
 
@@ -373,14 +373,14 @@ void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact)
 				showsms=TRUE;
 				if (ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_SMS)!=-1)
 				{
-					if (szProto == NULL || ModernGetSettingString(hContact, szProto, "Cellular",&dbv)) 
+					if (szProto == NULL || DBGetContactSettingString(hContact, szProto, "Cellular",&dbv)) 
 					{
-						ModernDBFreeVariant(&dbv);
-						if (ModernGetSettingString(hContact, "UserInfo", "MyPhone0", &dbv))
+						db_free(&dbv);
+						if (DBGetContactSettingString(hContact, "UserInfo", "MyPhone0", &dbv))
 							showsms=FALSE;
 					}
 					SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(ExtraImage_ExtraIDToColumnNum(EXTRA_ICON_SMS),(showsms)?1:0xFF));	
-					ModernDBFreeVariant(&dbv);
+					db_free(&dbv);
 				}
 			}		
 
@@ -400,7 +400,7 @@ void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact)
 				BYTE iconIndex=0xFF;
 				if (szProto != NULL)
 				{
-					if (!ModernGetSettingByte(hContact, szProto, "ChatRoom", 0))		
+					if (!db_get_b(hContact, szProto, "ChatRoom", 0))		
 					{
 						if (pdnce->ApparentMode==ID_STATUS_OFFLINE)
 							iconIndex=ExtraImageIconsIndex[4];	
@@ -411,7 +411,7 @@ void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact)
 								locApparentModeProto=szProto;
 								locApparentMode=CallProtoService(locApparentModeProto,PS_GETSTATUS,0,0);
 							}
-							if(locApparentMode == ID_STATUS_INVISIBLE || ModernGetSettingByte(NULL,"CList","AlwaysShowAlwaysVisIcon",SETTING_ALWAYSVISICON_DEFAULT) == 1)
+							if(locApparentMode == ID_STATUS_INVISIBLE || db_get_b(NULL,"CList","AlwaysShowAlwaysVisIcon",SETTING_ALWAYSVISICON_DEFAULT) == 1)
  								iconIndex=ExtraImageIconsIndex[3];						}
 					}
 					else 
diff --git a/plugins/Clist_modern/modern_groupmenu.cpp b/plugins/Clist_modern/modern_groupmenu.cpp
index 9d2b3780e6..a19615c861 100644
--- a/plugins/Clist_modern/modern_groupmenu.cpp
+++ b/plugins/Clist_modern/modern_groupmenu.cpp
@@ -180,7 +180,7 @@ return(0);
 INT_PTR HideGroupsHelper(WPARAM wParam,LPARAM lParam)
 {
 	int newVal=!(GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_HIDEEMPTYGROUPS);
-	ModernWriteSettingByte(NULL,"CList","HideEmptyGroups",(BYTE)newVal);
+	db_set_b(NULL,"CList","HideEmptyGroups",(BYTE)newVal);
 	SendMessage(pcli->hwndContactTree,CLM_SETHIDEEMPTYGROUPS,newVal,0);
 	return 0;
 }
@@ -188,7 +188,7 @@ INT_PTR HideGroupsHelper(WPARAM wParam,LPARAM lParam)
 INT_PTR UseGroupsHelper(WPARAM wParam,LPARAM lParam)
 {	
 	int newVal=!(GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS);
-	ModernWriteSettingByte(NULL,"CList","UseGroups",(BYTE)newVal);
+	db_set_b(NULL,"CList","UseGroups",(BYTE)newVal);
 	SendMessage(pcli->hwndContactTree,CLM_SETUSEGROUPS,newVal,0);
 	return 0;
 }
@@ -219,7 +219,7 @@ static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam)
 	
 	ZeroMemory(&mi,sizeof(mi));
 	mi.cbSize = sizeof(mi);
-	mi.flags = CMIM_FLAGS | (ModernGetSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0);
+	mi.flags = CMIM_FLAGS | (db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0);
 	CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersMenuItem, (LPARAM)&mi);	
 
 	ZeroMemory(&mi,sizeof(mi));
diff --git a/plugins/Clist_modern/modern_keyboard.cpp b/plugins/Clist_modern/modern_keyboard.cpp
index ad686a1ec1..56f9ed6d2e 100644
--- a/plugins/Clist_modern/modern_keyboard.cpp
+++ b/plugins/Clist_modern/modern_keyboard.cpp
@@ -33,7 +33,7 @@ INT_PTR hkCloseMiranda(WPARAM wParam,LPARAM lParam)
 
 INT_PTR hkRestoreStatus(WPARAM wParam,LPARAM lParam)
 {
-	int nStatus = ModernGetSettingWord(NULL, "CList", "Status", ID_STATUS_OFFLINE);
+	int nStatus = db_get_w(NULL, "CList", "Status", ID_STATUS_OFFLINE);
 	CallService(MS_CLIST_SETSTATUSMODE, nStatus, 0);
 
 	return 0;
diff --git a/plugins/Clist_modern/modern_row.cpp b/plugins/Clist_modern/modern_row.cpp
index d7e9b51b58..b728b5c516 100644
--- a/plugins/Clist_modern/modern_row.cpp
+++ b/plugins/Clist_modern/modern_row.cpp
@@ -68,10 +68,10 @@ ROWCELL *cppInitModernRow(ROWCELL	** tabAccess)
 	ROWCELL * RowRoot=NULL;
 	FILE * hFile;
 	int i=0;
-	if (!ModernGetSettingByte(NULL,"ModernData","UseAdvancedRowLayout",SETTING_ROW_ADVANCEDLAYOUT_DEFAULT)) return NULL;
+	if (!db_get_b(NULL,"ModernData","UseAdvancedRowLayout",SETTING_ROW_ADVANCEDLAYOUT_DEFAULT)) return NULL;
 	tmplbuf=NULL;
-	if (ModernGetSettingByte(NULL,"ModernData","UseAdvancedRowLayout",SETTING_ROW_ADVANCEDLAYOUT_DEFAULT)==1)
-		tmplbuf= ModernGetStringA(NULL,"ModernData","RowTemplate");
+	if (db_get_b(NULL,"ModernData","UseAdvancedRowLayout",SETTING_ROW_ADVANCEDLAYOUT_DEFAULT)==1)
+		tmplbuf= db_get_sa(NULL,"ModernData","RowTemplate");
 	if (tmplbuf)
 	{
 		rowParse(RowRoot, RowRoot, tmplbuf, i, seq,tabAccess);
@@ -88,7 +88,7 @@ ROWCELL *cppInitModernRow(ROWCELL	** tabAccess)
 		tmplbuf[i] = 0;
 		i = 0;
 		rowParse(RowRoot, RowRoot, tmplbuf, i, seq,tabAccess);
-		ModernWriteSettingString(NULL,"ModernData","RowTemplate",tmplbuf);
+		db_set_s(NULL,"ModernData","RowTemplate",tmplbuf);
 		free(tmplbuf);
 		fclose(hFile);
 		return RowRoot;
diff --git a/plugins/Clist_modern/modern_rowheight_funcs.cpp b/plugins/Clist_modern/modern_rowheight_funcs.cpp
index ac19b80a5c..065f6820c1 100644
--- a/plugins/Clist_modern/modern_rowheight_funcs.cpp
+++ b/plugins/Clist_modern/modern_rowheight_funcs.cpp
@@ -264,7 +264,7 @@ int mod_CalcRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcContact *
           // Draw extra icons
 
           if (contact->type == CLCIT_CONTACT && 
-            (!contact->isSubcontact || ModernGetSettingByte(NULL,"CLC","MetaHideExtra",SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0))
+            (!contact->isSubcontact || db_get_b(NULL,"CLC","MetaHideExtra",SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0))
           {
             BOOL hasExtra=FALSE;
             int k;
@@ -295,7 +295,7 @@ int mod_CalcRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcContact *
 	  case TC_EXTRA9:
 		  {
 			if (contact->type == CLCIT_CONTACT && 
-				(!contact->isSubcontact || ModernGetSettingByte(NULL,"CLC","MetaHideExtra",SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0))
+				(!contact->isSubcontact || db_get_b(NULL,"CLC","MetaHideExtra",SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0))
 			{
 				int eNum=gl_RowTabAccess[i]->type-TC_EXTRA1;
 				if (eNum<dat->extraColumnsCount)
diff --git a/plugins/Clist_modern/modern_rowtemplateopt.cpp b/plugins/Clist_modern/modern_rowtemplateopt.cpp
index fd183b2c64..5d97c201f7 100644
--- a/plugins/Clist_modern/modern_rowtemplateopt.cpp
+++ b/plugins/Clist_modern/modern_rowtemplateopt.cpp
@@ -383,7 +383,7 @@ INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
 			HWND htree = GetDlgItem(hwndDlg,IDC_ROWTREE);
 
 			TranslateDialogDefault(hwndDlg);	
-			rowOptTmplStr =  ModernGetStringA(NULL, "ModernData", "RowTemplate");
+			rowOptTmplStr =  db_get_sa(NULL, "ModernData", "RowTemplate");
 			if (!rowOptTmplStr) rowOptTmplStr=mir_strdup("<TR />");
 			{	
 				//HIMAGELIST himlTreeIcons;
diff --git a/plugins/Clist_modern/modern_skinbutton.cpp b/plugins/Clist_modern/modern_skinbutton.cpp
index 0f74b5a9d2..3d5208f997 100644
--- a/plugins/Clist_modern/modern_skinbutton.cpp
+++ b/plugins/Clist_modern/modern_skinbutton.cpp
@@ -145,21 +145,21 @@ static int ModernSkinButtonPaintWorker(HWND hwnd, HDC whdc)
 				{
 				case 's':
 					{
-						Value= ModernGetStringA(NULL,section,key);
+						Value= db_get_sa(NULL,section,key);
 						if (!Value)
 							Value=mir_strdup(bct->ValueTypeDef+1);
 						break;
 					}         
 				case 'd':
-					defval=ModernGetSettingDword(NULL,section,key,defval);
+					defval=db_get_dw(NULL,section,key,defval);
 					Value=mir_strdup(_ltoa(defval,buf,SIZEOF(buf)));
 					break;
 				case 'w':
-					defval=ModernGetSettingWord(NULL,section,key,defval);
+					defval=db_get_w(NULL,section,key,defval);
 					Value=mir_strdup(_ltoa(defval,buf,SIZEOF(buf)));
 					break;
 				case 'b':
-					defval=ModernGetSettingByte(NULL,section,key,defval);
+					defval=db_get_b(NULL,section,key,defval);
 					Value=mir_strdup(_ltoa(defval,buf,SIZEOF(buf)));
 					break;
 				}
@@ -245,29 +245,29 @@ static int ModernSkinButtonToggleDBValue(char * ValueDBSection,char *ValueTypeDe
 		{
 		case 's':
 			{
-				Value= ModernGetStringA(NULL,section,key);
+				Value= db_get_sa(NULL,section,key);
 				if (!Value ||(Value && mir_bool_strcmpi(Value,val2)))
 					Value=mir_strdup(val);
 				else 
 					Value=mir_strdup(val2);
-				ModernWriteSettingString(NULL,section,key,Value);
+				db_set_s(NULL,section,key,Value);
 				mir_free_and_nill(Value);
 				break;
 			}         
 		case 'd':
-			curval=ModernGetSettingDword(NULL,section,key,l2);
+			curval=db_get_dw(NULL,section,key,l2);
 			curval=(curval==l2)?l1:l2;
-			ModernWriteSettingDword(NULL,section,key,(DWORD)curval);
+			db_set_dw(NULL,section,key,(DWORD)curval);
 			break;
 		case 'w':
-			curval=ModernGetSettingWord(NULL,section,key,l2);
+			curval=db_get_w(NULL,section,key,l2);
 			curval=(curval==l2)?l1:l2;
-			ModernWriteSettingWord(NULL,section,key,(WORD)curval);            
+			db_set_w(NULL,section,key,(WORD)curval);            
 			break;
 		case 'b':
-			curval=ModernGetSettingByte(NULL,section,key,l2);
+			curval=db_get_b(NULL,section,key,l2);
 			curval=(curval==l2)?l1:l2;
-			ModernWriteSettingByte(NULL,section,key,(BYTE)curval);            
+			db_set_b(NULL,section,key,(BYTE)curval);            
 			break;
 		}       
 		mir_free_and_nill(section);
diff --git a/plugins/Clist_modern/modern_skineditor.cpp b/plugins/Clist_modern/modern_skineditor.cpp
index 8684c3d53f..595ed0a835 100644
--- a/plugins/Clist_modern/modern_skineditor.cpp
+++ b/plugins/Clist_modern/modern_skineditor.cpp
@@ -135,8 +135,8 @@ int enumDB_SkinObjectsForEditorProc(const char *szSetting,LPARAM lParam)
 		char *descKey;
 		descKey=mir_strdup(szSetting);
 		descKey[0]='%';
-		value= ModernGetStringA(NULL,SKIN,szSetting);
-		desc= ModernGetStringA(NULL,SKIN,descKey);
+		value= db_get_sa(NULL,SKIN,szSetting);
+		desc= db_get_sa(NULL,SKIN,descKey);
 		if (wildcmp(value,"?lyph*",0))
 		{
 			OPT_OBJECT_DATA * a=(OPT_OBJECT_DATA*)mir_alloc(sizeof(OPT_OBJECT_DATA));
@@ -489,7 +489,7 @@ void StoreTreeNode(HWND hTree, HTREEITEM node, char * section)
 	{
 		OPT_OBJECT_DATA * dat =(OPT_OBJECT_DATA*)(tvi.lParam);
 		if (dat->szName && dat->szValue)
-			ModernWriteSettingString(NULL,section,dat->szName,dat->szValue);
+			db_set_s(NULL,section,dat->szName,dat->szValue);
 	}
 	tmp2=TreeView_GetChild(hTree,tmp);
 	if (tmp2) StoreTreeNode(hTree,tmp2,section);
@@ -503,7 +503,7 @@ void StoreTreeToDB(HWND hTree, char * section)
   HTREEITEM tmp=NULL;
   tmp=TreeView_GetRoot(hTree);
   StoreTreeNode(hTree,tmp,section);
-  ModernWriteSettingByte(NULL,section,"Modified",1);
+  db_set_b(NULL,section,"Modified",1);
   glSkinWasModified=2;
 }
 static BOOL fileChanged=FALSE;
diff --git a/plugins/Clist_modern/modern_skinengine.cpp b/plugins/Clist_modern/modern_skinengine.cpp
index b9b9f8dbaf..ea99b3e76b 100644
--- a/plugins/Clist_modern/modern_skinengine.cpp
+++ b/plugins/Clist_modern/modern_skinengine.cpp
@@ -203,25 +203,25 @@ HRESULT IniParser::WriteStrToDb( const char * szSection, const char * szName, co
 		{
 			BYTE P;
 			P=(BYTE)atoi(szValue+1);
-			ModernWriteSettingByte(NULL,szSection,szName,P);
+			db_set_b(NULL,szSection,szName,P);
 		}
 		break;
 	case 'w':
 		{
 			WORD P;
 			P=(WORD)atoi(szValue+1);
-			ModernWriteSettingWord(NULL,szSection,szName,P);
+			db_set_w(NULL,szSection,szName,P);
 		}
 		break;
 	case 'd':
 		{
 			DWORD P;
 			P=(DWORD)atoi(szValue+1);
-			ModernWriteSettingDword(NULL,szSection,szName,P);
+			db_set_dw(NULL,szSection,szName,P);
 		}
 		break;
 	case 's':
-		ModernWriteSettingString(NULL,szSection,szName,szValue+1);
+		db_set_s(NULL,szSection,szName,szValue+1);
 		break;
 	case 'f':
 		if (szFileName)
@@ -236,7 +236,7 @@ HRESULT IniParser::WriteStrToDb( const char * szSection, const char * szName, co
 				if (i>0) fn[i]='\0';
 			}                      
 			_snprintf(bb,SIZEOF(bb),"%s\\%s",fn,szValue+1);
-			ModernWriteSettingString(NULL,szSection,szName,bb);
+			db_set_s(NULL,szSection,szName,bb);
 		}
 		break;
 	}
@@ -1784,7 +1784,7 @@ void ske_PreMultiplyChanells(HBITMAP hbmp,BYTE Mult)
 int ske_GetFullFilename(char * buf, char *file, char * skinfolder,BOOL madeAbsolute)
 {
 	char b2[MAX_PATH]={0};
-	char *SkinPlace= ModernGetStringA(NULL,SKIN,"SkinFolder");
+	char *SkinPlace= db_get_sa(NULL,SKIN,"SkinFolder");
 	if (!SkinPlace) SkinPlace=mir_strdup("\\Skin\\default");
 	if (file[0]!='\\' && file[1]!=':') 
 		_snprintf(b2, MAX_PATH,"%s\\%s",(skinfolder==NULL)?SkinPlace:((INT_PTR)skinfolder!=-1)?skinfolder:"",file);
@@ -2285,7 +2285,7 @@ static int ske_ProcessLoadindString(const char * szSetting, char *szValue)
 static int ske_enumdb_SkinObjectsProc (const char *szSetting,LPARAM lParam)
 {   
 	char *value;
-	value= ModernGetStringA(NULL,SKIN,szSetting);
+	value= db_get_sa(NULL,SKIN,szSetting);
 	ske_ProcessLoadindString(szSetting,value);
 	mir_free_and_nill(value);
 
@@ -2357,7 +2357,7 @@ static int ske_GetSkinFromDB(char * szSection, SKINOBJECTSLIST * Skin)
 {
 	if (Skin==NULL) return 0;
 	ske_UnloadSkin(Skin);
-	g_CluiData.fDisableSkinEngine=ModernGetSettingByte(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
+	g_CluiData.fDisableSkinEngine=db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
 	//window borders
 	if (g_CluiData.fDisableSkinEngine) {
 		g_CluiData.LeftClientMargin=0;
@@ -2366,18 +2366,18 @@ static int ske_GetSkinFromDB(char * szSection, SKINOBJECTSLIST * Skin)
 		g_CluiData.BottomClientMargin=0;
 	} else {
 		//window borders
-		g_CluiData.LeftClientMargin=(int)ModernGetSettingByte(NULL,"CLUI","LeftClientMargin",SETTING_LEFTCLIENTMARIGN_DEFAULT);
-		g_CluiData.RightClientMargin=(int)ModernGetSettingByte(NULL,"CLUI","RightClientMargin",SETTING_RIGHTCLIENTMARIGN_DEFAULT); 
-		g_CluiData.TopClientMargin=(int)ModernGetSettingByte(NULL,"CLUI","TopClientMargin",SETTING_TOPCLIENTMARIGN_DEFAULT);
-		g_CluiData.BottomClientMargin=(int)ModernGetSettingByte(NULL,"CLUI","BottomClientMargin",SETTING_BOTTOMCLIENTMARIGN_DEFAULT);
+		g_CluiData.LeftClientMargin=(int)db_get_b(NULL,"CLUI","LeftClientMargin",SETTING_LEFTCLIENTMARIGN_DEFAULT);
+		g_CluiData.RightClientMargin=(int)db_get_b(NULL,"CLUI","RightClientMargin",SETTING_RIGHTCLIENTMARIGN_DEFAULT); 
+		g_CluiData.TopClientMargin=(int)db_get_b(NULL,"CLUI","TopClientMargin",SETTING_TOPCLIENTMARIGN_DEFAULT);
+		g_CluiData.BottomClientMargin=(int)db_get_b(NULL,"CLUI","BottomClientMargin",SETTING_BOTTOMCLIENTMARIGN_DEFAULT);
 	}
 
 	if (g_CluiData.fDisableSkinEngine) return 0;
 
 	Skin->pMaskList=(LISTMODERNMASK*)mir_alloc(sizeof(LISTMODERNMASK));
 	memset(Skin->pMaskList,0,sizeof(LISTMODERNMASK));
-	Skin->szSkinPlace= ModernGetStringA(NULL,SKIN,"SkinFolder");
-	if (!Skin->szSkinPlace || (strchr(Skin->szSkinPlace, '%') && !ModernGetSettingByte(NULL,SKIN,"Modified",0))) 
+	Skin->szSkinPlace= db_get_sa(NULL,SKIN,"SkinFolder");
+	if (!Skin->szSkinPlace || (strchr(Skin->szSkinPlace, '%') && !db_get_b(NULL,SKIN,"Modified",0))) 
 	{
 		BOOL bOnlyObjects=FALSE;
 		if (Skin->szSkinPlace && strchr(Skin->szSkinPlace, '%'))
@@ -2406,7 +2406,7 @@ static int ske_GetSkinFromDB(char * szSection, SKINOBJECTSLIST * Skin)
 void ske_LoadSkinFromDB(void) 
 { 
 	ske_GetSkinFromDB(SKIN,&g_SkinObjectList); 
-	g_CluiData.dwKeyColor=ModernGetSettingDword(NULL,"ModernSettings","KeyColor",(DWORD)SETTING_KEYCOLOR_DEFAULT);
+	g_CluiData.dwKeyColor=db_get_dw(NULL,"ModernSettings","KeyColor",(DWORD)SETTING_KEYCOLOR_DEFAULT);
 }
 
 
@@ -2498,9 +2498,9 @@ static BOOL ske_ParseLineOfIniFile(char * Line, BOOL bOnlyObjects)
 //	DWORD retu=GetPrivateProfileSectionNamesA(bsn,MAXSN_BUFF_SIZE,szFileName);
 //	ske_DeleteAllSettingInSection("ModernSkin");
 //	ske_GetSkinFolder(szFileName,t2);
-//	ModernWriteSettingString(NULL,SKIN,"SkinFolder",t2);
+//	db_set_s(NULL,SKIN,"SkinFolder",t2);
 //	CallService(MS_UTILS_PATHTORELATIVE, (WPARAM)szFileName, (LPARAM)t3);
-//	ModernWriteSettingString(NULL,SKIN,"SkinFile",t3);
+//	db_set_s(NULL,SKIN,"SkinFile",t3);
 //	Buff=bsn;
 //	AllowedSection[0]=0;
 //	do         
@@ -2544,7 +2544,7 @@ static BOOL ske_ParseLineOfIniFile(char * Line, BOOL bOnlyObjects)
 //							//                            char ba[255];
 //							s3=s2+1;
 //							P=(BYTE)atoi(s3);
-//							ModernWriteSettingByte(NULL,Buff,s1,P);
+//							db_set_b(NULL,Buff,s1,P);
 //						}
 //						break;
 //					case 'w':
@@ -2553,7 +2553,7 @@ static BOOL ske_ParseLineOfIniFile(char * Line, BOOL bOnlyObjects)
 //							//                           char ba[255];
 //							s3=s2+1;
 //							P=(WORD)atoi(s3);
-//							ModernWriteSettingWord(NULL,Buff,s1,P);
+//							db_set_w(NULL,Buff,s1,P);
 //						}break;
 //					case 'd':
 //						{
@@ -2561,7 +2561,7 @@ static BOOL ske_ParseLineOfIniFile(char * Line, BOOL bOnlyObjects)
 //
 //							s3=s2+1;
 //							P=(DWORD)atoi(s3);
-//							ModernWriteSettingDword(NULL,Buff,s1,P);
+//							db_set_dw(NULL,Buff,s1,P);
 //						}break;
 //					case 's':
 //						{
@@ -2569,7 +2569,7 @@ static BOOL ske_ParseLineOfIniFile(char * Line, BOOL bOnlyObjects)
 //							char bb[255];
 //							s3=s2+1;
 //							strncpy(bb,s3,sizeof(bb));
-//							ModernWriteSettingString(NULL,Buff,s1,s3);
+//							db_set_s(NULL,Buff,s1,s3);
 //						}break;
 //					case 'f': //file
 //						{
@@ -2590,7 +2590,7 @@ static BOOL ske_ParseLineOfIniFile(char * Line, BOOL bOnlyObjects)
 //									}
 //								}                      
 //								sprintf(bb,"%s\\%s",fn,s3);
-//								ModernWriteSettingString(NULL,Buff,s1,bb);
+//								db_set_s(NULL,Buff,s1,bb);
 //							}
 //						}break;
 //					}
@@ -2614,8 +2614,8 @@ static int ske_LoadSkinFromResource(BOOL bOnlyObjects)
 	if ( !parser.CheckOK()) return 0;
 
 	ske_DeleteAllSettingInSection("ModernSkin");
-	ModernWriteSettingString(NULL,SKIN,"SkinFolder","%Default%");
-	ModernWriteSettingString(NULL,SKIN,"SkinFile","%Default%");
+	db_set_s(NULL,SKIN,"SkinFolder","%Default%");
+	db_set_s(NULL,SKIN,"SkinFile","%Default%");
 	parser.Parse( IniParser::WriteStrToDb, 0 );	
 	return 0;
 }
@@ -2635,8 +2635,8 @@ int ske_LoadSkinFromIniFile(TCHAR * szFileName, BOOL bOnlyObjects)
 	IniParser::GetSkinFolder(szFileName,skinFolder);
 	CallService(MS_UTILS_PATHTORELATIVET, (WPARAM)szFileName, (LPARAM)skinFile);
 
-	ModernWriteSettingTString(NULL,SKIN,"SkinFolder", skinFolder);
-	ModernWriteSettingTString(NULL,SKIN,"SkinFile", skinFile);
+	db_set_ws(NULL,SKIN,"SkinFolder", skinFolder);
+	db_set_ws(NULL,SKIN,"SkinFile", skinFile);
 
 	parser.Parse( IniParser::WriteStrToDb, 1 );
 
@@ -2670,7 +2670,7 @@ static int ske_DeleteAllSettingInSection(char * SectionName)
 		int i;
 		for (i=0;i<nArrayLen;i++)
 		{
-			ModernDeleteSetting(0,SectionName,pszSettingName[i]);
+			db_unset(0,SectionName,pszSettingName[i]);
 			free(pszSettingName[i]);
 		};
 		free(pszSettingName);
@@ -2973,10 +2973,10 @@ static int ske_AlphaTextOut (HDC hDC, LPCTSTR lpString, int nCount, RECT * lpRec
 	if ( _tables_empty )
 	{
 		// fill tables
-		double gammaCfPw = 1000 / (double)ModernGetSettingRangedWord(NULL,"ModernData","AlphaTextOutGamma", 700, 1, 5000 );
-		BYTE blueCf    = ModernGetSettingByte(NULL,"ModernData","AlphaTextOutBlueCorrection", 28 );
-		BYTE redCf     = ModernGetSettingByte(NULL,"ModernData","AlphaTextOutRed Correction", 77 );
-		BYTE greenCf   = ModernGetSettingByte(NULL,"ModernData","AlphaTextOutGreen Correction", 151 );
+		double gammaCfPw = 1000 / (double)DBGetContactSettingRangedWord(NULL,"ModernData","AlphaTextOutGamma", 700, 1, 5000 );
+		BYTE blueCf    = db_get_b(NULL,"ModernData","AlphaTextOutBlueCorrection", 28 );
+		BYTE redCf     = db_get_b(NULL,"ModernData","AlphaTextOutRed Correction", 77 );
+		BYTE greenCf   = db_get_b(NULL,"ModernData","AlphaTextOutGreen Correction", 151 );
 
 		for ( int i = 0; i < 256; i++ )
 		{
@@ -4801,13 +4801,13 @@ BOOL SkinDBGetContactSetting(HANDLE hContact, const char* szSection, const char*
 	if (!hContact) {  //only for not contact settings
 		char * szSkinKey;
 		NEWJOINEDSTR(szSkinKey,szSection,"@",szKey);
-		if ( !ModernGetSetting(hContact, SKINSETSECTION, szSkinKey, retdbv))	{
+		if ( !db_get(hContact, SKINSETSECTION, szSkinKey, retdbv))	{
 			if (bSkined) *bSkined=TRUE;
 			return FALSE;
-		}	}
+	}	}
 	// not skinned
 	if (bSkined) bSkined=FALSE;
-	return ModernGetSetting(hContact, szSection, szKey, retdbv);
+	return db_get(hContact, szSection, szKey, retdbv);
 }
 
 BYTE SkinDBGetContactSettingByte(HANDLE hContact, const char* szSection, const char*szKey, BYTE bDefault)
@@ -4818,11 +4818,11 @@ BYTE SkinDBGetContactSettingByte(HANDLE hContact, const char* szSection, const c
 		if (dbv.type==DBVT_BYTE)
 		{
 			BYTE retVal=dbv.bVal;
-			ModernDBFreeVariant(&dbv);
+			db_free(&dbv);
 			return retVal;
 		} else {
-			ModernDBFreeVariant(&dbv);
-			if (!bSkined) return ModernGetSettingByte(hContact, szSection, szKey, bDefault);
+			db_free(&dbv);
+			if (!bSkined) return db_get_b(hContact, szSection, szKey, bDefault);
 		}
 	}
 	return bDefault;
@@ -4835,11 +4835,11 @@ WORD SkinDBGetContactSettingWord(HANDLE hContact, const char* szSection, const c
 	if ( !SkinDBGetContactSetting(hContact, szSection, szKey, &dbv, &bSkined)) {
 		if (dbv.type==DBVT_WORD)	{
 			WORD retVal=dbv.wVal;
-			ModernDBFreeVariant(&dbv);
+			db_free(&dbv);
 			return retVal;
 		} else {
-			ModernDBFreeVariant(&dbv);
-			if (!bSkined) return ModernGetSettingWord(hContact, szSection, szKey, wDefault);
+			db_free(&dbv);
+			if (!bSkined) return db_get_w(hContact, szSection, szKey, wDefault);
 		}	
 	}
 	return wDefault;
@@ -4852,11 +4852,11 @@ DWORD SkinDBGetContactSettingDword(HANDLE hContact, const char* szSection, const
 	if ( !SkinDBGetContactSetting(hContact, szSection, szKey, &dbv, &bSkined)) {
 		if (dbv.type==DBVT_DWORD)	{
 			DWORD retVal=dbv.dVal;
-			ModernDBFreeVariant(&dbv);
+			db_free(&dbv);
 			return retVal;
 		} else {
-			ModernDBFreeVariant(&dbv);
-			if (!bSkined) return ModernGetSettingDword(hContact, szSection, szKey, dwDefault);
+			db_free(&dbv);
+			if (!bSkined) return db_get_dw(hContact, szSection, szKey, dwDefault);
 		}	
 	}
 	return dwDefault;
diff --git a/plugins/Clist_modern/modern_skinopt.cpp b/plugins/Clist_modern/modern_skinopt.cpp
index 3bd9650748..1e02a24d33 100644
--- a/plugins/Clist_modern/modern_skinopt.cpp
+++ b/plugins/Clist_modern/modern_skinopt.cpp
@@ -67,7 +67,7 @@ int SkinOptInit( WPARAM wParam, LPARAM lParam )
 		odp.pszTab = LPGEN( "Load/Save" );
 		Options_AddPage(wParam, &odp);
 
-		if ( ModernGetSettingByte( NULL, "ModernData", "EnableSkinEditor", SETTING_ENABLESKINEDITOR_DEFAULT )) {
+		if ( db_get_b( NULL, "ModernData", "EnableSkinEditor", SETTING_ENABLESKINEDITOR_DEFAULT )) {
 			odp.flags |= ODPF_EXPERTONLY;
 			odp.pfnDlgProc = DlgSkinEditorOpts;
 			odp.pszTemplate = MAKEINTRESOURCEA( IDD_OPT_SKINEDITOR );
@@ -202,10 +202,10 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
 					}
 					if ( g_hCLUIOptionsWnd )
 					{
-						SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, ModernGetSettingByte( NULL, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT ));
-						SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, ModernGetSettingByte( NULL, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT ));
-						SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_TOPMARGINSPIN, UDM_SETPOS, 0, ModernGetSettingByte( NULL, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT ));
-						SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_BOTTOMMARGINSPIN, UDM_SETPOS, 0, ModernGetSettingByte( NULL, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT ));
+						SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, db_get_b( NULL, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT ));
+						SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, db_get_b( NULL, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT ));
+						SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_TOPMARGINSPIN, UDM_SETPOS, 0, db_get_b( NULL, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT ));
+						SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_BOTTOMMARGINSPIN, UDM_SETPOS, 0, db_get_b( NULL, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT ));
 					}
 				}
 				break;
@@ -476,7 +476,7 @@ HTREEITEM FillAvailableSkinList( HWND hwndDlg )
 	HTREEITEM res = (HTREEITEM)-1;
 	TCHAR path[MAX_PATH];//, mask[MAX_PATH];
 	int attrib;
-	TCHAR *SkinsFolder = ModernGetStringT( NULL, "ModernData", "SkinsFolder" );
+	TCHAR *SkinsFolder = DBGetStringT( NULL, "ModernData", "SkinsFolder" );
 	if ( !SkinsFolder ) SkinsFolder = mir_tstrdup( _T("Skins"));
 
 	CallService( MS_UTILS_PATHTOABSOLUTET, ( WPARAM )SkinsFolder, ( LPARAM )path );
@@ -489,7 +489,7 @@ HTREEITEM FillAvailableSkinList( HWND hwndDlg )
 	{
 		TCHAR * skinfile;
 		TCHAR skinfull[MAX_PATH];
-		skinfile = ModernGetStringT( NULL, SKIN, "SkinFile" );
+		skinfile = DBGetStringT( NULL, SKIN, "SkinFile" );
 		if ( skinfile )
 		{
 			CallService( MS_UTILS_PATHTOABSOLUTET, ( WPARAM )skinfile, ( LPARAM )skinfull );
@@ -680,7 +680,7 @@ INT_PTR SvcActiveSkin(WPARAM wParam, LPARAM lParam)
 {
 	TCHAR *skinfile;
 	TCHAR skinfull[MAX_PATH];
-	skinfile = ModernGetStringT( NULL, SKIN, "SkinFile" );
+	skinfile = DBGetStringT( NULL, SKIN, "SkinFile" );
 	if ( skinfile )
 	{
 		CallService( MS_UTILS_PATHTOABSOLUTET, ( WPARAM )skinfile, ( LPARAM )skinfull );
@@ -708,10 +708,10 @@ INT_PTR SvcApplySkin(WPARAM wParam, LPARAM lParam)
 	}
 	if ( g_hCLUIOptionsWnd )
 	{
-		SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, ModernGetSettingByte( NULL, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT ));
-		SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, ModernGetSettingByte( NULL, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT ));
-		SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_TOPMARGINSPIN, UDM_SETPOS, 0, ModernGetSettingByte( NULL, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT ));
-		SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_BOTTOMMARGINSPIN, UDM_SETPOS, 0, ModernGetSettingByte( NULL, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT ));
+		SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_LEFTMARGINSPIN, UDM_SETPOS, 0, db_get_b( NULL, "CLUI", "LeftClientMargin", SETTING_LEFTCLIENTMARIGN_DEFAULT ));
+		SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_RIGHTMARGINSPIN, UDM_SETPOS, 0, db_get_b( NULL, "CLUI", "RightClientMargin", SETTING_RIGHTCLIENTMARIGN_DEFAULT ));
+		SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_TOPMARGINSPIN, UDM_SETPOS, 0, db_get_b( NULL, "CLUI", "TopClientMargin", SETTING_TOPCLIENTMARIGN_DEFAULT ));
+		SendDlgItemMessage( g_hCLUIOptionsWnd, IDC_BOTTOMMARGINSPIN, UDM_SETPOS, 0, db_get_b( NULL, "CLUI", "BottomClientMargin", SETTING_BOTTOMCLIENTMARIGN_DEFAULT ));
 	}
 	return 0;
 }
diff --git a/plugins/Clist_modern/modern_statusbar.cpp b/plugins/Clist_modern/modern_statusbar.cpp
index 1884cf1bd6..487c5d6239 100644
--- a/plugins/Clist_modern/modern_statusbar.cpp
+++ b/plugins/Clist_modern/modern_statusbar.cpp
@@ -67,29 +67,29 @@ char * ApendSubSetting(char * buf, int size, char *first, char *second)
 
 int LoadStatusBarData()
 {
-	g_StatusBarData.perProtoConfig=ModernGetSettingByte(NULL,"CLUI","SBarPerProto",SETTING_SBARPERPROTO_DEFAULT);
-	g_StatusBarData.showProtoIcon=ModernGetSettingByte(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT)&1;
-	g_StatusBarData.showProtoName=ModernGetSettingByte(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT)&2;
-	g_StatusBarData.showStatusName=ModernGetSettingByte(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT)&4;
-	g_StatusBarData.xStatusMode=(BYTE)(ModernGetSettingByte(NULL,"CLUI","ShowXStatus",SETTING_SHOWXSTATUS_DEFAULT));
-	g_StatusBarData.connectingIcon=ModernGetSettingByte(NULL,"CLUI","UseConnectingIcon",SETTING_USECONNECTINGICON_DEFAULT);
-	g_StatusBarData.showProtoEmails=ModernGetSettingByte(NULL,"CLUI","ShowUnreadEmails",SETTING_SHOWUNREADEMAILS_DEFAULT);
-	g_StatusBarData.SBarRightClk=ModernGetSettingByte(NULL,"CLUI","SBarRightClk",SETTING_SBARRIGHTCLK_DEFAULT);
-
-	g_StatusBarData.nProtosPerLine=ModernGetSettingByte(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT);
-	g_StatusBarData.Align=ModernGetSettingByte(NULL,"CLUI","Align",SETTING_ALIGN_DEFAULT);
-	g_StatusBarData.VAlign=ModernGetSettingByte(NULL,"CLUI","VAlign",SETTING_VALIGN_DEFAULT);
-    g_StatusBarData.sameWidth=ModernGetSettingByte(NULL,"CLUI","EqualSections",SETTING_EQUALSECTIONS_DEFAULT);
-    g_StatusBarData.rectBorders.left=ModernGetSettingDword(NULL,"CLUI","LeftOffset",SETTING_LEFTOFFSET_DEFAULT);
-    g_StatusBarData.rectBorders.right=ModernGetSettingDword(NULL,"CLUI","RightOffset",SETTING_RIGHTOFFSET_DEFAULT);
-    g_StatusBarData.rectBorders.top=ModernGetSettingDword(NULL,"CLUI","TopOffset",SETTING_TOPOFFSET_DEFAULT);
-    g_StatusBarData.rectBorders.bottom=ModernGetSettingDword(NULL,"CLUI","BottomOffset",SETTING_BOTTOMOFFSET_DEFAULT);
-    g_StatusBarData.extraspace=(BYTE)ModernGetSettingDword(NULL,"CLUI","SpaceBetween",SETTING_SPACEBETWEEN_DEFAULT);
+	g_StatusBarData.perProtoConfig=db_get_b(NULL,"CLUI","SBarPerProto",SETTING_SBARPERPROTO_DEFAULT);
+	g_StatusBarData.showProtoIcon=db_get_b(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT)&1;
+	g_StatusBarData.showProtoName=db_get_b(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT)&2;
+	g_StatusBarData.showStatusName=db_get_b(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT)&4;
+	g_StatusBarData.xStatusMode=(BYTE)(db_get_b(NULL,"CLUI","ShowXStatus",SETTING_SHOWXSTATUS_DEFAULT));
+	g_StatusBarData.connectingIcon=db_get_b(NULL,"CLUI","UseConnectingIcon",SETTING_USECONNECTINGICON_DEFAULT);
+	g_StatusBarData.showProtoEmails=db_get_b(NULL,"CLUI","ShowUnreadEmails",SETTING_SHOWUNREADEMAILS_DEFAULT);
+	g_StatusBarData.SBarRightClk=db_get_b(NULL,"CLUI","SBarRightClk",SETTING_SBARRIGHTCLK_DEFAULT);
+
+	g_StatusBarData.nProtosPerLine=db_get_b(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT);
+	g_StatusBarData.Align=db_get_b(NULL,"CLUI","Align",SETTING_ALIGN_DEFAULT);
+	g_StatusBarData.VAlign=db_get_b(NULL,"CLUI","VAlign",SETTING_VALIGN_DEFAULT);
+    g_StatusBarData.sameWidth=db_get_b(NULL,"CLUI","EqualSections",SETTING_EQUALSECTIONS_DEFAULT);
+    g_StatusBarData.rectBorders.left=db_get_dw(NULL,"CLUI","LeftOffset",SETTING_LEFTOFFSET_DEFAULT);
+    g_StatusBarData.rectBorders.right=db_get_dw(NULL,"CLUI","RightOffset",SETTING_RIGHTOFFSET_DEFAULT);
+    g_StatusBarData.rectBorders.top=db_get_dw(NULL,"CLUI","TopOffset",SETTING_TOPOFFSET_DEFAULT);
+    g_StatusBarData.rectBorders.bottom=db_get_dw(NULL,"CLUI","BottomOffset",SETTING_BOTTOMOFFSET_DEFAULT);
+    g_StatusBarData.extraspace=(BYTE)db_get_dw(NULL,"CLUI","SpaceBetween",SETTING_SPACEBETWEEN_DEFAULT);
 
 	if (g_StatusBarData.BarFont) DeleteObject(g_StatusBarData.BarFont);
     g_StatusBarData.BarFont=NULL;//LoadFontFromDB("ModernData","StatusBar",&g_StatusBarData.fontColor);
     {
-        int vis=ModernGetSettingByte(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT);
+        int vis=db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT);
         int frameopt;
         int frameID=Sync( FindFrameID, hModernStatusBar );
         frameopt=CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,frameID),0);
@@ -105,9 +105,9 @@ int LoadStatusBarData()
         };
         CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,frameID),frameopt);
     }
-    g_StatusBarData.TextEffectID=ModernGetSettingByte(NULL,"StatusBar","TextEffectID",SETTING_TEXTEFFECTID_DEFAULT);
-    g_StatusBarData.TextEffectColor1=ModernGetSettingDword(NULL,"StatusBar","TextEffectColor1",SETTING_TEXTEFFECTCOLOR1_DEFAULT);
-    g_StatusBarData.TextEffectColor2=ModernGetSettingDword(NULL,"StatusBar","TextEffectColor2",SETTING_TEXTEFFECTCOLOR2_DEFAULT);
+    g_StatusBarData.TextEffectID=db_get_b(NULL,"StatusBar","TextEffectID",SETTING_TEXTEFFECTID_DEFAULT);
+    g_StatusBarData.TextEffectColor1=db_get_dw(NULL,"StatusBar","TextEffectColor1",SETTING_TEXTEFFECTCOLOR1_DEFAULT);
+    g_StatusBarData.TextEffectColor2=db_get_dw(NULL,"StatusBar","TextEffectColor2",SETTING_TEXTEFFECTCOLOR2_DEFAULT);
 
     if(g_StatusBarData.hBmpBackground) {DeleteObject(g_StatusBarData.hBmpBackground); g_StatusBarData.hBmpBackground=NULL;}
 
@@ -115,14 +115,14 @@ int LoadStatusBarData()
     {
         DBVARIANT dbv;
         g_StatusBarData.bkColour=sttGetColor("StatusBar","BkColour",CLCDEFAULT_BKCOLOUR);
-        if(ModernGetSettingByte(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
-            if (!ModernGetSettingString(NULL,"StatusBar","BkBitmap",&dbv)) {
+        if(db_get_b(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
+            if (!DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) {
                 g_StatusBarData.hBmpBackground=(HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
-                ModernDBFreeVariant(&dbv);
+                db_free(&dbv);
             }
         }
-        g_StatusBarData.bkUseWinColors=ModernGetSettingByte(NULL,"StatusBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
-        g_StatusBarData.backgroundBmpUse=ModernGetSettingWord(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
+        g_StatusBarData.bkUseWinColors=db_get_b(NULL,"StatusBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
+        g_StatusBarData.backgroundBmpUse=db_get_w(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
     }
     SendMessage(pcli->hwndContactList,WM_SIZE,0,0);
 	
@@ -190,7 +190,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC)
 	{
 		SkinDrawGlyph(hDC,&rc,&rc,"Main,ID=StatusBar"); //TBD
 	}
-	g_StatusBarData.nProtosPerLine=ModernGetSettingByte(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT);
+	g_StatusBarData.nProtosPerLine=db_get_b(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT);
 	hOldFont=g_clcPainter.ChangeToFont(hDC,NULL,FONTID_STATUSBAR_PROTONAME,NULL);
 
 	//  hOldFont=SelectObject(hDC,g_StatusBarData.BarFont);
@@ -241,37 +241,37 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC)
 				
 			mir_snprintf(buf, SIZEOF(buf), "SBarAccountIsCustom_%s", accs[i]->szModuleName);
 
-			if (g_StatusBarData.perProtoConfig && ModernGetSettingByte(NULL, "CLUI", buf, SETTING_SBARACCOUNTISCUSTOM_DEFAULT))
+			if (g_StatusBarData.perProtoConfig && db_get_b(NULL, "CLUI", buf, SETTING_SBARACCOUNTISCUSTOM_DEFAULT))
 			{
 				mir_snprintf(buf, SIZEOF(buf), "HideAccount_%s", accs[i]->szModuleName);
-				if (ModernGetSettingByte(NULL, "CLUI", buf, SETTING_SBARHIDEACCOUNT_DEFAULT))
+				if (db_get_b(NULL, "CLUI", buf, SETTING_SBARHIDEACCOUNT_DEFAULT))
 					continue;
 
 				mir_snprintf(buf, SIZEOF(buf), "SBarShow_%s", accs[i]->szModuleName);
 				{
-					BYTE showOps = ModernGetSettingByte(NULL,"CLUI", buf, SETTING_SBARSHOW_DEFAULT);
+					BYTE showOps = db_get_b(NULL,"CLUI", buf, SETTING_SBARSHOW_DEFAULT);
 					ProtosData[visProtoCount].showProtoIcon = showOps&1;
 					ProtosData[visProtoCount].showProtoName = showOps&2;
 					ProtosData[visProtoCount].showStatusName = showOps&4;
 				}
 
 				mir_snprintf(buf, SIZEOF(buf), "ShowXStatus_%s", accs[i]->szModuleName);
-				ProtosData[visProtoCount].xStatusMode = ModernGetSettingByte(NULL,"CLUI", buf, SETTING_SBARSHOW_DEFAULT);
+				ProtosData[visProtoCount].xStatusMode = db_get_b(NULL,"CLUI", buf, SETTING_SBARSHOW_DEFAULT);
 
 				mir_snprintf(buf, SIZEOF(buf), "UseConnectingIcon_%s", accs[i]->szModuleName);
-				ProtosData[visProtoCount].connectingIcon = ModernGetSettingByte(NULL,"CLUI", buf, SETTING_USECONNECTINGICON_DEFAULT);
+				ProtosData[visProtoCount].connectingIcon = db_get_b(NULL,"CLUI", buf, SETTING_USECONNECTINGICON_DEFAULT);
 
 				mir_snprintf(buf, SIZEOF(buf), "ShowUnreadEmails_%s", accs[i]->szModuleName);
-				ProtosData[visProtoCount].showProtoEmails = ModernGetSettingByte(NULL,"CLUI", buf, SETTING_SHOWUNREADEMAILS_DEFAULT);
+				ProtosData[visProtoCount].showProtoEmails = db_get_b(NULL,"CLUI", buf, SETTING_SHOWUNREADEMAILS_DEFAULT);
 
 				mir_snprintf(buf, SIZEOF(buf), "SBarRightClk_%s", accs[i]->szModuleName);
-				ProtosData[visProtoCount].SBarRightClk = ModernGetSettingByte(NULL,"CLUI", buf, SETTING_SBARRIGHTCLK_DEFAULT);
+				ProtosData[visProtoCount].SBarRightClk = db_get_b(NULL,"CLUI", buf, SETTING_SBARRIGHTCLK_DEFAULT);
 
 				mir_snprintf(buf, SIZEOF(buf), "PaddingLeft_%s", accs[i]->szModuleName);
-				ProtosData[visProtoCount].PaddingLeft = ModernGetSettingDword(NULL,"CLUI", buf, SETTING_PADDINGLEFT_DEFAULT);
+				ProtosData[visProtoCount].PaddingLeft = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGLEFT_DEFAULT);
 
 				mir_snprintf(buf, SIZEOF(buf), "PaddingRight_%s", accs[i]->szModuleName);
-				ProtosData[visProtoCount].PaddingRight = ModernGetSettingDword(NULL,"CLUI", buf, SETTING_PADDINGRIGHT_DEFAULT);
+				ProtosData[visProtoCount].PaddingRight = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGRIGHT_DEFAULT);
 			}
 			else
 			{
@@ -427,11 +427,11 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC)
 										if (dbTitle && xstatus)
 										{
 											DBVARIANT dbv={0};
-											if (!ModernGetSettingTString(NULL,ProtosData[i].AccountName,dbTitle,&dbv))
+											if (!DBGetContactSettingTString(NULL,ProtosData[i].AccountName,dbTitle,&dbv))
 											{
 												ProtosData[i].ProtoXStatus=mir_tstrdup(dbv.ptszVal);
 												//mir_free_and_nill(dbv.ptszVal);
-												ModernDBFreeVariant(&dbv);
+												db_free(&dbv);
 											}
 										}
 									}
@@ -623,7 +623,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC)
 
 								if ( ( hxIcon || hIcon) && TRUE /* TODO g_StatusBarData.bDrawLockOverlay  options to draw locked proto*/  )
 								{
-									if ( ModernGetSettingByte( NULL,ProtosData[i].AccountName,"LockMainStatus",0 ))
+									if ( db_get_b( NULL,ProtosData[i].AccountName,"LockMainStatus",0 ))
 									{
 										HICON hLockOverlay = LoadSkinnedIcon(SKINICON_OTHER_STATUS_LOCKED);
 										if (hLockOverlay != NULL)
@@ -868,7 +868,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam
             if (ID)
             {
                 res=CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS,ID),0);
-                if (res>=0) ModernWriteSettingByte(0,"CLUI","ShowSBar",(BYTE)(wParam/*(res&F_VISIBLE)*/?1:0));
+                if (res>=0) db_set_b(0,"CLUI","ShowSBar",(BYTE)(wParam/*(res&F_VISIBLE)*/?1:0));
             }
         }
         break;
@@ -900,7 +900,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam
                         if(PtInRect(&rc,pt))
                         {
                             NotifyEventHooks(g_CluiData.hEventStatusBarShowToolTip,(WPARAM)ProtosData[i].AccountName,0);
-                            CLUI_SafeSetTimer(hwnd,TM_STATUSBARHIDE,ModernGetSettingWord(NULL,"CLUIFrames","HideToolTipTime",SETTING_HIDETOOLTIPTIME_DEFAULT),0);
+                            CLUI_SafeSetTimer(hwnd,TM_STATUSBARHIDE,db_get_w(NULL,"CLUIFrames","HideToolTipTime",SETTING_HIDETOOLTIPTIME_DEFAULT),0);
                             tooltipshoing=TRUE;
                             ClientToScreen(hwnd,&pt);
                             ptToolTipShow=pt;
@@ -948,7 +948,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam
                         ReleaseCapture();
                     };
                 KillTimer(hwnd,TM_STATUSBAR);
-                CLUI_SafeSetTimer(hwnd,TM_STATUSBAR,ModernGetSettingWord(NULL,"CLC","InfoTipHoverTime",CLCDEFAULT_INFOTIPTIME),0);
+                CLUI_SafeSetTimer(hwnd,TM_STATUSBAR,db_get_w(NULL,"CLC","InfoTipHoverTime",CLCDEFAULT_INFOTIPTIME),0);
 
                 return(CLUI_TestCursorOnBorders());
             }
@@ -1137,7 +1137,7 @@ HWND StatusBar_Create(HWND parent)
         Frame.hWnd=hModernStatusBar;
         Frame.align=alBottom;
         Frame.hIcon=LoadSkinnedIcon (SKINICON_OTHER_MIRANDA);
-        Frame.Flags=(ModernGetSettingByte(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_NO_SUBCONTAINER|F_TCHAR;
+        Frame.Flags=(db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_NO_SUBCONTAINER|F_TCHAR;
         Frame.height=h;
         Frame.tname=_T("Status Bar");
         Frame.TBtname=TranslateT("Status Bar");
diff --git a/plugins/Clist_modern/modern_statusbar_options.cpp b/plugins/Clist_modern/modern_statusbar_options.cpp
index 7bea01fe57..9a84dda5bb 100644
--- a/plugins/Clist_modern/modern_statusbar_options.cpp
+++ b/plugins/Clist_modern/modern_statusbar_options.cpp
@@ -179,11 +179,11 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg)
 		break;
 	case WM_INITDIALOG:
 		{
-			perProto = (BOOL)ModernGetSettingByte(NULL,"CLUI","SBarPerProto",SETTING_SBARPERPROTO_DEFAULT);
+			perProto = (BOOL)db_get_b(NULL,"CLUI","SBarPerProto",SETTING_SBARPERPROTO_DEFAULT);
 
 			TranslateDialogDefault(hwndDlg);
 
-			CheckDlgButton(hwndDlg, IDC_SHOWSBAR, ModernGetSettingByte(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 			CheckDlgButton(hwndDlg, IDC_STATUSBAR_PER_PROTO, perProto ? BST_CHECKED : BST_UNCHECKED);
 
 
@@ -212,31 +212,31 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg)
 					SendMessage(hwndComboBox, CB_SETITEMDATA, dwNewId, (LPARAM)(i+1));
 
 					mir_snprintf(buf, SIZEOF(buf), "SBarAccountIsCustom_%s", szName);
-					dat[i].AccountIsCustomized = ModernGetSettingByte(NULL,"CLUI", buf, SETTING_SBARACCOUNTISCUSTOM_DEFAULT);
+					dat[i].AccountIsCustomized = db_get_b(NULL,"CLUI", buf, SETTING_SBARACCOUNTISCUSTOM_DEFAULT);
 
 					mir_snprintf(buf, SIZEOF(buf), "HideAccount_%s", szName);
-					dat[i].HideAccount = ModernGetSettingByte(NULL,"CLUI", buf, SETTING_SBARHIDEACCOUNT_DEFAULT);
+					dat[i].HideAccount = db_get_b(NULL,"CLUI", buf, SETTING_SBARHIDEACCOUNT_DEFAULT);
 
 					mir_snprintf(buf, SIZEOF(buf), "SBarShow_%s", szName);
-					dat[i].SBarShow = ModernGetSettingByte(NULL,"CLUI", buf, SETTING_SBARSHOW_DEFAULT);
+					dat[i].SBarShow = db_get_b(NULL,"CLUI", buf, SETTING_SBARSHOW_DEFAULT);
 
 					mir_snprintf(buf, SIZEOF(buf), "SBarRightClk_%s", szName);
-					dat[i].SBarRightClk = ModernGetSettingByte(NULL,"CLUI", buf, SETTING_SBARRIGHTCLK_DEFAULT);
+					dat[i].SBarRightClk = db_get_b(NULL,"CLUI", buf, SETTING_SBARRIGHTCLK_DEFAULT);
 
 					mir_snprintf(buf, SIZEOF(buf), "ShowUnreadEmails_%s", szName);
-					dat[i].ShowUnreadEmails = ModernGetSettingByte(NULL,"CLUI", buf, SETTING_SHOWUNREADEMAILS_DEFAULT);
+					dat[i].ShowUnreadEmails = db_get_b(NULL,"CLUI", buf, SETTING_SHOWUNREADEMAILS_DEFAULT);
 
 					mir_snprintf(buf, SIZEOF(buf), "ShowXStatus_%s", szName);
-					dat[i].ShowXStatus = ModernGetSettingByte(NULL,"CLUI", buf, SETTING_SHOWXSTATUS_DEFAULT);
+					dat[i].ShowXStatus = db_get_b(NULL,"CLUI", buf, SETTING_SHOWXSTATUS_DEFAULT);
 
 					mir_snprintf(buf, SIZEOF(buf), "UseConnectingIcon_%s", szName);
-					dat[i].UseConnectingIcon = ModernGetSettingByte(NULL,"CLUI", buf, SETTING_USECONNECTINGICON_DEFAULT);
+					dat[i].UseConnectingIcon = db_get_b(NULL,"CLUI", buf, SETTING_USECONNECTINGICON_DEFAULT);
 
 					mir_snprintf(buf, SIZEOF(buf), "PaddingLeft_%s", szName);
-					dat[i].PaddingLeft = ModernGetSettingDword(NULL,"CLUI", buf, SETTING_PADDINGLEFT_DEFAULT);
+					dat[i].PaddingLeft = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGLEFT_DEFAULT);
 
 					mir_snprintf(buf, SIZEOF(buf), "PaddingRight_%s", szName);
-					dat[i].PaddingRight = ModernGetSettingDword(NULL,"CLUI", buf, SETTING_PADDINGRIGHT_DEFAULT);
+					dat[i].PaddingRight = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGRIGHT_DEFAULT);
 				}
 
 				if (count)
@@ -246,31 +246,31 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg)
 			}
 
 			_GlobalOptions.AccountIsCustomized = TRUE;
-			_GlobalOptions.SBarRightClk = ModernGetSettingByte(NULL,"CLUI", "SBarRightClk", SETTING_SBARRIGHTCLK_DEFAULT);
-			_GlobalOptions.ShowUnreadEmails = ModernGetSettingByte(NULL,"CLUI", "ShowUnreadEmails", SETTING_SHOWUNREADEMAILS_DEFAULT);
-			_GlobalOptions.ShowXStatus = ModernGetSettingByte(NULL,"CLUI", "ShowXStatus", SETTING_SHOWXSTATUS_DEFAULT);
-			_GlobalOptions.UseConnectingIcon = ModernGetSettingByte(NULL,"CLUI", "UseConnectingIcon", SETTING_USECONNECTINGICON_DEFAULT);
-			_GlobalOptions.SBarShow = ModernGetSettingByte(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT);
+			_GlobalOptions.SBarRightClk = db_get_b(NULL,"CLUI", "SBarRightClk", SETTING_SBARRIGHTCLK_DEFAULT);
+			_GlobalOptions.ShowUnreadEmails = db_get_b(NULL,"CLUI", "ShowUnreadEmails", SETTING_SHOWUNREADEMAILS_DEFAULT);
+			_GlobalOptions.ShowXStatus = db_get_b(NULL,"CLUI", "ShowXStatus", SETTING_SHOWXSTATUS_DEFAULT);
+			_GlobalOptions.UseConnectingIcon = db_get_b(NULL,"CLUI", "UseConnectingIcon", SETTING_USECONNECTINGICON_DEFAULT);
+			_GlobalOptions.SBarShow = db_get_b(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT);
 
-			CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, ModernGetSettingByte(NULL,"CLUI","EqualSections",SETTING_EQUALSECTIONS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, db_get_b(NULL,"CLUI","EqualSections",SETTING_EQUALSECTIONS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 
 			SendDlgItemMessage(hwndDlg,IDC_MULTI_SPIN,UDM_SETRANGE,0,MAKELONG(50,0));
-			SendDlgItemMessage(hwndDlg,IDC_MULTI_SPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingByte(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_MULTI_SPIN,UDM_SETPOS,0,MAKELONG(db_get_b(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT),0));
 
 			SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN,UDM_SETRANGE,0,MAKELONG(50,0));
-			SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingDword(NULL,"CLUI","LeftOffset",SETTING_LEFTOFFSET_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","LeftOffset",SETTING_LEFTOFFSET_DEFAULT),0));
 
 			SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN2,UDM_SETRANGE,0,MAKELONG(50,0));
-			SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN2,UDM_SETPOS,0,MAKELONG(ModernGetSettingDword(NULL,"CLUI","RightOffset",SETTING_RIGHTOFFSET_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN2,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","RightOffset",SETTING_RIGHTOFFSET_DEFAULT),0));
 
 			SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_TOP_SPIN,UDM_SETRANGE,0,MAKELONG(50,0));
-			SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_TOP_SPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingDword(NULL,"CLUI","TopOffset",SETTING_TOPOFFSET_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_TOP_SPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","TopOffset",SETTING_TOPOFFSET_DEFAULT),0));
 
 			SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_BOTTOM_SPIN,UDM_SETRANGE,0,MAKELONG(50,0));
-			SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_BOTTOM_SPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingDword(NULL,"CLUI","BottomOffset",SETTING_BOTTOMOFFSET_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_BOTTOM_SPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","BottomOffset",SETTING_BOTTOMOFFSET_DEFAULT),0));
 
 			SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN3,UDM_SETRANGE,0,MAKELONG(50,0));
-			SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN3,UDM_SETPOS,0,MAKELONG(ModernGetSettingDword(NULL,"CLUI","SpaceBetween",SETTING_SPACEBETWEEN_DEFAULT),2));
+			SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN3,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","SpaceBetween",SETTING_SPACEBETWEEN_DEFAULT),2));
 
 			{
 				int i, item;
@@ -279,7 +279,7 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg)
 					item=SendDlgItemMessage(hwndDlg,IDC_SBAR_HORIZ_ALIGN,CB_ADDSTRING,0,(LPARAM)TranslateTS(align[i]));
 				}
 
-				SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_SETCURSEL, ModernGetSettingByte(NULL, "CLUI", "Align", SETTING_ALIGN_DEFAULT), 0);
+				SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_SETCURSEL, db_get_b(NULL, "CLUI", "Align", SETTING_ALIGN_DEFAULT), 0);
 			}
 
 			{
@@ -289,7 +289,7 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg)
 					item=SendDlgItemMessage(hwndDlg,IDC_SBAR_VERT_ALIGN,CB_ADDSTRING,0,(LPARAM)TranslateTS(align[i]));
 				}
 
-				SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_SETCURSEL, ModernGetSettingByte(NULL, "CLUI", "VAlign", SETTING_VALIGN_DEFAULT), 0);
+				SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_SETCURSEL, db_get_b(NULL, "CLUI", "VAlign", SETTING_VALIGN_DEFAULT), 0);
 			}
 
 			{
@@ -540,8 +540,8 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg)
 		{
 		case PSN_APPLY:
 			{
-				int count = ModernGetSettingDword(0,"Protocols","ProtoCount",-1);
-				ModernWriteSettingByte(NULL, "CLUI", "SBarPerProto", IsDlgButtonChecked(hwndDlg, IDC_STATUSBAR_PER_PROTO));
+				int count = db_get_dw(0,"Protocols","ProtoCount",-1);
+				db_set_b(NULL, "CLUI", "SBarPerProto", IsDlgButtonChecked(hwndDlg, IDC_STATUSBAR_PER_PROTO));
 
 				for (int i = 0; i < count; i++)
 				{
@@ -551,47 +551,47 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg)
 
 					char settingBuf[256];
 					mir_snprintf(settingBuf, SIZEOF(settingBuf), "SBarAccountIsCustom_%s", defProto);
-					ModernWriteSettingByte(NULL,"CLUI",settingBuf,(BYTE)sbpo.AccountIsCustomized);
+					db_set_b(NULL,"CLUI",settingBuf,(BYTE)sbpo.AccountIsCustomized);
 
 					mir_snprintf(settingBuf, SIZEOF(settingBuf), "HideAccount_%s", defProto);
-					ModernWriteSettingByte(NULL,"CLUI",settingBuf,(BYTE)sbpo.HideAccount);
+					db_set_b(NULL,"CLUI",settingBuf,(BYTE)sbpo.HideAccount);
 
 					mir_snprintf(settingBuf, SIZEOF(settingBuf), "SBarShow_%s", defProto);
-					ModernWriteSettingByte(NULL,"CLUI",settingBuf,(BYTE)sbpo.SBarShow);
+					db_set_b(NULL,"CLUI",settingBuf,(BYTE)sbpo.SBarShow);
 					mir_snprintf(settingBuf, SIZEOF(settingBuf), "SBarRightClk_%s", defProto);
-					ModernWriteSettingByte(NULL,"CLUI",settingBuf,(BYTE)sbpo.SBarRightClk);
+					db_set_b(NULL,"CLUI",settingBuf,(BYTE)sbpo.SBarRightClk);
 					mir_snprintf(settingBuf, SIZEOF(settingBuf), "UseConnectingIcon_%s", defProto);
-					ModernWriteSettingByte(NULL,"CLUI",settingBuf,(BYTE)sbpo.UseConnectingIcon);
+					db_set_b(NULL,"CLUI",settingBuf,(BYTE)sbpo.UseConnectingIcon);
 					mir_snprintf(settingBuf, SIZEOF(settingBuf), "ShowUnreadEmails_%s", defProto);
-					ModernWriteSettingByte(NULL,"CLUI",settingBuf,(BYTE)sbpo.ShowUnreadEmails);
+					db_set_b(NULL,"CLUI",settingBuf,(BYTE)sbpo.ShowUnreadEmails);
 					mir_snprintf(settingBuf, SIZEOF(settingBuf), "ShowXStatus_%s", defProto);
-					ModernWriteSettingByte(NULL,"CLUI",settingBuf,sbpo.ShowXStatus);
+					db_set_b(NULL,"CLUI",settingBuf,sbpo.ShowXStatus);
 					mir_snprintf(settingBuf, SIZEOF(settingBuf), "PaddingLeft_%s", defProto);
-					ModernWriteSettingDword(NULL,"CLUI",settingBuf,sbpo.PaddingLeft);
+					db_set_dw(NULL,"CLUI",settingBuf,sbpo.PaddingLeft);
 					mir_snprintf(settingBuf, SIZEOF(settingBuf), "PaddingRight_%s", defProto);
-					ModernWriteSettingDword(NULL,"CLUI",settingBuf,sbpo.PaddingRight);
+					db_set_dw(NULL,"CLUI",settingBuf,sbpo.PaddingRight);
 				}
 
-				ModernWriteSettingByte(NULL,"CLUI","SBarShow",(BYTE)_GlobalOptions.SBarShow);
-				ModernWriteSettingByte(NULL,"CLUI","SBarRightClk",(BYTE)_GlobalOptions.SBarRightClk);
-				ModernWriteSettingByte(NULL,"CLUI","UseConnectingIcon",(BYTE)_GlobalOptions.UseConnectingIcon);
-				ModernWriteSettingByte(NULL,"CLUI","ShowUnreadEmails",(BYTE)_GlobalOptions.ShowUnreadEmails);
-				ModernWriteSettingByte(NULL,"CLUI","ShowXStatus",_GlobalOptions.ShowXStatus);
-				ModernWriteSettingDword(NULL,"CLUI","PaddingLeft",_GlobalOptions.PaddingLeft);
-				ModernWriteSettingDword(NULL,"CLUI","PaddingRight",_GlobalOptions.PaddingRight);
-
-
-				ModernWriteSettingByte(NULL,"CLUI","StatusBarProtosPerLine",(BYTE)SendDlgItemMessage(hwndDlg,IDC_MULTI_SPIN,UDM_GETPOS,0,0));
-				ModernWriteSettingByte(NULL,"CLUI","EqualSections",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EQUALSECTIONS));
-				ModernWriteSettingByte(NULL,"CLUI","Align",(BYTE)SendDlgItemMessage(hwndDlg,IDC_SBAR_HORIZ_ALIGN,CB_GETCURSEL,0,0));
-				ModernWriteSettingByte(NULL,"CLUI","VAlign",(BYTE)SendDlgItemMessage(hwndDlg,IDC_SBAR_VERT_ALIGN,CB_GETCURSEL,0,0));
-				ModernWriteSettingDword(NULL,"CLUI","LeftOffset",(DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN,UDM_GETPOS,0,0));
-				ModernWriteSettingDword(NULL,"CLUI","RightOffset",(DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN2,UDM_GETPOS,0,0));
-				ModernWriteSettingDword(NULL,"CLUI","TopOffset",(DWORD)SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_TOP_SPIN,UDM_GETPOS,0,0));
-				ModernWriteSettingDword(NULL,"CLUI","BottomOffset",(DWORD)SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_BOTTOM_SPIN,UDM_GETPOS,0,0));
-				ModernWriteSettingDword(NULL,"CLUI","SpaceBetween",(DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN3,UDM_GETPOS,0,0));
-				ModernWriteSettingDword(NULL,"ModernData","StatusBarFontCol",SendDlgItemMessage(hwndDlg,IDC_COLOUR,CPM_GETCOLOUR,0,0));
-				ModernWriteSettingByte(NULL,"CLUI","ShowSBar",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR));
+				db_set_b(NULL,"CLUI","SBarShow",(BYTE)_GlobalOptions.SBarShow);
+				db_set_b(NULL,"CLUI","SBarRightClk",(BYTE)_GlobalOptions.SBarRightClk);
+				db_set_b(NULL,"CLUI","UseConnectingIcon",(BYTE)_GlobalOptions.UseConnectingIcon);
+				db_set_b(NULL,"CLUI","ShowUnreadEmails",(BYTE)_GlobalOptions.ShowUnreadEmails);
+				db_set_b(NULL,"CLUI","ShowXStatus",_GlobalOptions.ShowXStatus);
+				db_set_dw(NULL,"CLUI","PaddingLeft",_GlobalOptions.PaddingLeft);
+				db_set_dw(NULL,"CLUI","PaddingRight",_GlobalOptions.PaddingRight);
+
+
+				db_set_b(NULL,"CLUI","StatusBarProtosPerLine",(BYTE)SendDlgItemMessage(hwndDlg,IDC_MULTI_SPIN,UDM_GETPOS,0,0));
+				db_set_b(NULL,"CLUI","EqualSections",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EQUALSECTIONS));
+				db_set_b(NULL,"CLUI","Align",(BYTE)SendDlgItemMessage(hwndDlg,IDC_SBAR_HORIZ_ALIGN,CB_GETCURSEL,0,0));
+				db_set_b(NULL,"CLUI","VAlign",(BYTE)SendDlgItemMessage(hwndDlg,IDC_SBAR_VERT_ALIGN,CB_GETCURSEL,0,0));
+				db_set_dw(NULL,"CLUI","LeftOffset",(DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN,UDM_GETPOS,0,0));
+				db_set_dw(NULL,"CLUI","RightOffset",(DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN2,UDM_GETPOS,0,0));
+				db_set_dw(NULL,"CLUI","TopOffset",(DWORD)SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_TOP_SPIN,UDM_GETPOS,0,0));
+				db_set_dw(NULL,"CLUI","BottomOffset",(DWORD)SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_BOTTOM_SPIN,UDM_GETPOS,0,0));
+				db_set_dw(NULL,"CLUI","SpaceBetween",(DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN3,UDM_GETPOS,0,0));
+				db_set_dw(NULL,"ModernData","StatusBarFontCol",SendDlgItemMessage(hwndDlg,IDC_COLOUR,CPM_GETCOLOUR,0,0));
+				db_set_b(NULL,"CLUI","ShowSBar",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR));
 
 				LoadStatusBarData();
 				CLUIServices_ProtocolStatusChanged(0,0);	
diff --git a/plugins/Clist_modern/modern_toolbar.cpp b/plugins/Clist_modern/modern_toolbar.cpp
index 56078d03cc..60bc90e704 100644
--- a/plugins/Clist_modern/modern_toolbar.cpp
+++ b/plugins/Clist_modern/modern_toolbar.cpp
@@ -250,14 +250,14 @@ static int    ehhToolBarSettingsChanged( WPARAM wParam, LPARAM lParam )
 	if (!mir_strcmp(cws->szModule,"CList"))
 	{
 		if (!mir_strcmp(cws->szSetting,"HideOffline"))
-			sttSetButtonPressed("ShowHideOffline", (BOOL) ModernGetSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT));
+			sttSetButtonPressed("ShowHideOffline", (BOOL) db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT));
 		else if (!mir_strcmp(cws->szSetting,"UseGroups"))
-			sttSetButtonPressed( "UseGroups", (BOOL) ModernGetSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
+			sttSetButtonPressed( "UseGroups", (BOOL) db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
 	}
 	else if (!mir_strcmp(cws->szModule,"Skin"))
 	{
 		if (!mir_strcmp(cws->szSetting,"UseSound"))
-			sttSetButtonPressed( "EnableSounds", (BOOL) ModernGetSettingByte(NULL, "Skin", "UseSound", SETTING_ENABLESOUNDS_DEFAULT ));
+			sttSetButtonPressed( "EnableSounds", (BOOL) db_get_b(NULL, "Skin", "UseSound", SETTING_ENABLESOUNDS_DEFAULT ));
 	}
 	
 	return 0;
@@ -273,14 +273,14 @@ static int    ehhToolBarBackgroundSettingsChanged(WPARAM wParam, LPARAM lParam)
 	{
 		DBVARIANT dbv;
 		tbdat.mtb_bkColour=sttGetColor("ToolBar","BkColour",CLCDEFAULT_BKCOLOUR);
-		if(ModernGetSettingByte(NULL,"ToolBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
-			if (!ModernGetSettingString(NULL,"ToolBar","BkBitmap",&dbv)) {
+		if(db_get_b(NULL,"ToolBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
+			if (!DBGetContactSettingString(NULL,"ToolBar","BkBitmap",&dbv)) {
 				tbdat.mtb_hBmpBackground=(HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
-				ModernDBFreeVariant(&dbv);
+				db_free(&dbv);
 			}
 		}
-		tbdat.mtb_useWinColors = ModernGetSettingByte(NULL, "ToolBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
-		tbdat.mtb_backgroundBmpUse = ModernGetSettingWord(NULL, "ToolBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
+		tbdat.mtb_useWinColors = db_get_b(NULL, "ToolBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
+		tbdat.mtb_backgroundBmpUse = db_get_w(NULL, "ToolBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
 	}	
 	PostMessage(pcli->hwndContactList,WM_SIZE,0,0);
 	return 0;
@@ -610,13 +610,13 @@ static void   sttGetButtonSettings(char * ID, BYTE * pbVisible, DWORD * pdwOrder
 
 	if (pbVisible) vis=*pbVisible;
 	mir_snprintf(key, SIZEOF(key), "visible_%s", ID);
-	vis=ModernGetSettingByte(NULL,"ModernToolBar", key, vis);
+	vis=db_get_b(NULL,"ModernToolBar", key, vis);
 
 	mir_snprintf(key, SIZEOF(key), "order_%s", ID);
-	ord=ModernGetSettingDword(NULL,"ModernToolBar", key, 0);
+	ord=db_get_dw(NULL,"ModernToolBar", key, 0);
 
 	mir_snprintf(key, SIZEOF(key), "panel_%s", ID);
-	panel=ModernGetSettingByte(NULL,"ModernToolBar", key, 0);
+	panel=db_get_b(NULL,"ModernToolBar", key, 0);
 
 	if (pbVisible)	*pbVisible=vis;
 	if (pdwOrder)	*pdwOrder=ord;
@@ -628,8 +628,8 @@ static void   sttReloadButtons()
 	tbcheck ;
 	tblock;
 	{
-		int vis=ModernGetSettingByte(NULL,"CLUI","ShowButtonBar",SETTINGS_SHOWBUTTONBAR_DEFAULT);
-		WindowList_Broadcast(tbdat.hToolBarWindowList,MTBM_UPDATEFRAMEVISIBILITY,(WPARAM)ModernGetSettingByte(NULL,"CLUI","ShowButtonBar",SETTINGS_SHOWBUTTONBAR_DEFAULT),0);
+		int vis=db_get_b(NULL,"CLUI","ShowButtonBar",SETTINGS_SHOWBUTTONBAR_DEFAULT);
+		WindowList_Broadcast(tbdat.hToolBarWindowList,MTBM_UPDATEFRAMEVISIBILITY,(WPARAM)db_get_b(NULL,"CLUI","ShowButtonBar",SETTINGS_SHOWBUTTONBAR_DEFAULT),0);
 	}
 
 	WindowList_Broadcast(tbdat.hToolBarWindowList, MTBM_REMOVE_ALL_BUTTONS, 0,0);
@@ -652,9 +652,9 @@ static void   sttReloadButtons()
 			ToolBar_AddButtonToBars(mtbi);
 	}
 	tbunlock;
-	sttSetButtonPressed( "ShowHideOffline", (BOOL) ModernGetSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT));
-	sttSetButtonPressed( "UseGroups", (BOOL) ModernGetSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
-	sttSetButtonPressed( "EnableSounds", (BOOL) ModernGetSettingByte(NULL, "Skin", "UseSound", SETTING_ENABLESOUNDS_DEFAULT ));
+	sttSetButtonPressed( "ShowHideOffline", (BOOL) db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT));
+	sttSetButtonPressed( "UseGroups", (BOOL) db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
+	sttSetButtonPressed( "EnableSounds", (BOOL) db_get_b(NULL, "Skin", "UseSound", SETTING_ENABLESOUNDS_DEFAULT ));
 
 }
 static int	  sttDBEnumProc (const char *szSetting,LPARAM lParam)
@@ -662,7 +662,7 @@ static int	  sttDBEnumProc (const char *szSetting,LPARAM lParam)
 
 	if (szSetting==NULL) return 0;
 	if (!strncmp(szSetting,"order_",6))
-		ModernDeleteSetting(NULL, "ModernToolBar", szSetting);
+		db_unset(NULL, "ModernToolBar", szSetting);
 	return 0;
 };
 static void   sttDeleteOrderSettings()
@@ -708,7 +708,7 @@ static void	ToolBar_DefaultButtonRegistration()
 	sttRegisterToolBarButton( "ShowHideOffline","Show/Hide offline contacts", MS_CLIST_TOGGLEHIDEOFFLINE,
 					    "Hide offline contacts", "Show offline contacts", 110 /*and 111 */ , IDI_RESETVIEW, IDI_RESETVIEW, TRUE  );
 	
-	sttSetButtonPressed( "ShowHideOffline", (BOOL) ModernGetSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT));
+	sttSetButtonPressed( "ShowHideOffline", (BOOL) db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT));
 
 	sttRegisterToolBarButton( "DatabaseEditor","DBEditor++", "DBEditorpp/MenuCommand",
 		"Database Editor", NULL,  130 , IDI_RESETVIEW, IDI_RESETVIEW, TRUE  );
@@ -722,12 +722,12 @@ static void	ToolBar_DefaultButtonRegistration()
 	sttRegisterToolBarButton( "UseGroups","Use/Disable groups", MS_CLIST_TOGGLEGROUPS,
 		"Use groups", "Disable Groups", 160 /*and 161 */ , IDI_RESETVIEW, IDI_RESETVIEW, FALSE  );
 
-	sttSetButtonPressed( "UseGroups", (BOOL) ModernGetSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
+	sttSetButtonPressed( "UseGroups", (BOOL) db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
 
 	sttRegisterToolBarButton( "EnableSounds","Enable/Disable sounds", MS_CLIST_TOGGLESOUNDS,
 		"Enable sounds", "Disable Sounds", 170 /*and 171 */ , IDI_RESETVIEW, IDI_RESETVIEW, FALSE  );
 	
-	sttSetButtonPressed( "EnableSounds", (BOOL) ModernGetSettingByte(NULL, "Skin", "UseSound", SETTING_ENABLESOUNDS_DEFAULT ));
+	sttSetButtonPressed( "EnableSounds", (BOOL) db_get_b(NULL, "Skin", "UseSound", SETTING_ENABLESOUNDS_DEFAULT ));
 	
 	sttAddDynamicSeparator(FALSE);
 
@@ -781,20 +781,20 @@ static LRESULT CALLBACK ToolBar_WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
 			pMTBInfo->cbSize = sizeof(MTBINFO);
 			SetWindowLongPtr( hwnd, GWLP_USERDATA, (LONG_PTR) pMTBInfo );
 
-			pMTBInfo->nButtonWidth = ModernGetSettingByte(NULL, "ModernToolBar", "option_Bar0_BtnWidth",  SETTINGS_BARBTNWIDTH_DEFAULT);
-			pMTBInfo->nButtonHeight= ModernGetSettingByte(NULL, "ModernToolBar", "option_Bar0_BtnHeight", SETTINGS_BARBTNHEIGHT_DEFAULT);
-			pMTBInfo->nButtonSpace = ModernGetSettingByte(NULL, "ModernToolBar", "option_Bar0_BtnSpace",  SETTINGS_BARBTNSPACE_DEFAULT);
-			pMTBInfo->fAutoSize    = ModernGetSettingByte(NULL, "ModernToolBar", "option_Bar0_Autosize",  SETTINGS_BARAUTOSIZE_DEFAULT);
-			pMTBInfo->fSingleLine  = ModernGetSettingByte(NULL, "ModernToolBar", "option_Bar0_Multiline", SETTINGS_BARMULTILINE_DEFAULT)==0;
+			pMTBInfo->nButtonWidth = db_get_b(NULL, "ModernToolBar", "option_Bar0_BtnWidth",  SETTINGS_BARBTNWIDTH_DEFAULT);
+			pMTBInfo->nButtonHeight= db_get_b(NULL, "ModernToolBar", "option_Bar0_BtnHeight", SETTINGS_BARBTNHEIGHT_DEFAULT);
+			pMTBInfo->nButtonSpace = db_get_b(NULL, "ModernToolBar", "option_Bar0_BtnSpace",  SETTINGS_BARBTNSPACE_DEFAULT);
+			pMTBInfo->fAutoSize    = db_get_b(NULL, "ModernToolBar", "option_Bar0_Autosize",  SETTINGS_BARAUTOSIZE_DEFAULT);
+			pMTBInfo->fSingleLine  = db_get_b(NULL, "ModernToolBar", "option_Bar0_Multiline", SETTINGS_BARMULTILINE_DEFAULT)==0;
 
 			//register self frame
 			Frame.cbSize=sizeof(CLISTFrame);
 			Frame.hWnd=hwnd;
 			Frame.align=alTop;
 			Frame.hIcon=LoadSkinnedIcon (SKINICON_OTHER_MIRANDA);
-			Frame.Flags=(ModernGetSettingByte(NULL,"CLUI","ShowButtonBar",SETTINGS_SHOWBUTTONBAR_DEFAULT)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_NO_SUBCONTAINER;
+			Frame.Flags=(db_get_b(NULL,"CLUI","ShowButtonBar",SETTINGS_SHOWBUTTONBAR_DEFAULT)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_NO_SUBCONTAINER;
 	
-			Frame.height=ModernGetSettingDword(NULL, "ModernToolBar", "option_Bar0_OldHeight", pMTBInfo->nButtonHeight);
+			Frame.height=db_get_dw(NULL, "ModernToolBar", "option_Bar0_OldHeight", pMTBInfo->nButtonHeight);
 			pMTBInfo->wLastHeight=Frame.height;
           
             pMTBInfo->nLineCount   = 1;
@@ -831,7 +831,7 @@ static LRESULT CALLBACK ToolBar_WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
 				if (ID)
 				{
 					res=CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS,ID),0);
-					if (res>=0) ModernWriteSettingByte(0,"CLUI","ShowButtonBar",(BYTE)(wParam/*(res&F_VISIBLE)*/?1:0));
+					if (res>=0) db_set_b(0,"CLUI","ShowButtonBar",(BYTE)(wParam/*(res&F_VISIBLE)*/?1:0));
 					if (wParam) SendMessage(hwnd, MTBM_REPOSBUTTONS, 0, 0);
 				}
 			}
@@ -846,11 +846,11 @@ static LRESULT CALLBACK ToolBar_WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
 			int frameID=Sync( FindFrameID, hwnd );
 			int Height;
 		
-			pMTBInfo->nButtonWidth = ModernGetSettingByte(NULL, "ModernToolBar", "option_Bar0_BtnWidth",  SETTINGS_BARBTNWIDTH_DEFAULT);
-			pMTBInfo->nButtonHeight= ModernGetSettingByte(NULL, "ModernToolBar", "option_Bar0_BtnHeight", SETTINGS_BARBTNHEIGHT_DEFAULT);
-			pMTBInfo->nButtonSpace = ModernGetSettingByte(NULL, "ModernToolBar", "option_Bar0_BtnSpace",  SETTINGS_BARBTNSPACE_DEFAULT);
-			pMTBInfo->fAutoSize    = ModernGetSettingByte(NULL, "ModernToolBar", "option_Bar0_Autosize",  SETTINGS_BARAUTOSIZE_DEFAULT);
-			pMTBInfo->fSingleLine  = ModernGetSettingByte(NULL, "ModernToolBar", "option_Bar0_Multiline", SETTINGS_BARMULTILINE_DEFAULT)==0;
+			pMTBInfo->nButtonWidth = db_get_b(NULL, "ModernToolBar", "option_Bar0_BtnWidth",  SETTINGS_BARBTNWIDTH_DEFAULT);
+			pMTBInfo->nButtonHeight= db_get_b(NULL, "ModernToolBar", "option_Bar0_BtnHeight", SETTINGS_BARBTNHEIGHT_DEFAULT);
+			pMTBInfo->nButtonSpace = db_get_b(NULL, "ModernToolBar", "option_Bar0_BtnSpace",  SETTINGS_BARBTNSPACE_DEFAULT);
+			pMTBInfo->fAutoSize    = db_get_b(NULL, "ModernToolBar", "option_Bar0_Autosize",  SETTINGS_BARAUTOSIZE_DEFAULT);
+			pMTBInfo->fSingleLine  = db_get_b(NULL, "ModernToolBar", "option_Bar0_Multiline", SETTINGS_BARMULTILINE_DEFAULT)==0;
 
 			Height=sttReposButtons( pMTBInfo );
 
@@ -938,7 +938,7 @@ static LRESULT CALLBACK ToolBar_WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
 	case WM_SIZE: 
 		if (pMTBInfo->wLastHeight!=HIWORD(lParam))
 		{
-			ModernWriteSettingDword(NULL, "ModernToolBar", "option_Bar0_OldHeight", HIWORD(lParam));
+			db_set_dw(NULL, "ModernToolBar", "option_Bar0_OldHeight", HIWORD(lParam));
 			pMTBInfo->wLastHeight=HIWORD(lParam);
 		}
 		if (supressRepos)
@@ -1145,18 +1145,18 @@ static LRESULT CALLBACK ToolBar_OptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,L
 			tbunlock;
 
 			SendDlgItemMessage(hwndDlg,IDC_SPIN_W,UDM_SETRANGE,0,MAKELONG(50,10));
-			SendDlgItemMessage(hwndDlg,IDC_SPIN_W,UDM_SETPOS,0,MAKELONG(ModernGetSettingByte(NULL, "ModernToolBar", "option_Bar0_BtnWidth",  SETTINGS_BARBTNWIDTH_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_SPIN_W,UDM_SETPOS,0,MAKELONG(db_get_b(NULL, "ModernToolBar", "option_Bar0_BtnWidth",  SETTINGS_BARBTNWIDTH_DEFAULT),0));
 
 			SendDlgItemMessage(hwndDlg,IDC_SPIN_H,UDM_SETRANGE,0,MAKELONG(50,10));
-			SendDlgItemMessage(hwndDlg,IDC_SPIN_H,UDM_SETPOS,0,MAKELONG(ModernGetSettingByte(NULL, "ModernToolBar", "option_Bar0_BtnHeight", SETTINGS_BARBTNHEIGHT_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_SPIN_H,UDM_SETPOS,0,MAKELONG(db_get_b(NULL, "ModernToolBar", "option_Bar0_BtnHeight", SETTINGS_BARBTNHEIGHT_DEFAULT),0));
 
 			SendDlgItemMessage(hwndDlg,IDC_SPIN_S,UDM_SETRANGE,0,MAKELONG(20,0));
-			SendDlgItemMessage(hwndDlg,IDC_SPIN_S,UDM_SETPOS,0,MAKELONG(ModernGetSettingByte(NULL, "ModernToolBar", "option_Bar0_BtnSpace",  SETTINGS_BARBTNSPACE_DEFAULT),0));
+			SendDlgItemMessage(hwndDlg,IDC_SPIN_S,UDM_SETPOS,0,MAKELONG(db_get_b(NULL, "ModernToolBar", "option_Bar0_BtnSpace",  SETTINGS_BARBTNSPACE_DEFAULT),0));
 
-			CheckDlgButton(hwndDlg, IDC_CHECK_AUTOSIZE, ModernGetSettingByte(NULL, "ModernToolBar", "option_Bar0_Autosize", SETTINGS_BARAUTOSIZE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-			CheckDlgButton(hwndDlg, IDC_CHECK_MULTILINE, ModernGetSettingByte(NULL,"ModernToolBar", "option_Bar0_Multiline", SETTINGS_BARMULTILINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_CHECK_AUTOSIZE, db_get_b(NULL, "ModernToolBar", "option_Bar0_Autosize", SETTINGS_BARAUTOSIZE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_CHECK_MULTILINE, db_get_b(NULL,"ModernToolBar", "option_Bar0_Multiline", SETTINGS_BARMULTILINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 
-			CheckDlgButton(hwndDlg, IDC_TBSHOW, ModernGetSettingByte(NULL,"CLUI","ShowButtonBar",SETTINGS_SHOWBUTTONBAR_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+			CheckDlgButton(hwndDlg, IDC_TBSHOW, db_get_b(NULL,"CLUI","ShowButtonBar",SETTINGS_SHOWBUTTONBAR_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
 			{
 				int i;
 				BOOL en=IsDlgButtonChecked(hwndDlg,IDC_TBSHOW);
@@ -1194,19 +1194,19 @@ static LRESULT CALLBACK ToolBar_OptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,L
 								{
 									char szTempSetting[200];
 									mir_snprintf(szTempSetting, SIZEOF(szTempSetting), "order_%s", mtbi->szButtonID);
-									ModernWriteSettingDword(NULL, "ModernToolBar", szTempSetting, order);
+									db_set_dw(NULL, "ModernToolBar", szTempSetting, order);
 									order+=10;
 									mir_snprintf(szTempSetting, SIZEOF(szTempSetting), "visible_%s", mtbi->szButtonID);
-									ModernWriteSettingByte(NULL, "ModernToolBar", szTempSetting, TreeView_GetCheckState(hTree,hItem));
+									db_set_b(NULL, "ModernToolBar", szTempSetting, TreeView_GetCheckState(hTree,hItem));
 								}
 								hItem=TreeView_GetNextSibling(hTree,hItem);
 							} while (hItem!=NULL);
-							ModernWriteSettingByte(NULL,"CLUI","ShowButtonBar",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TBSHOW));
-							ModernWriteSettingByte(NULL,"ModernToolBar","option_Bar0_BtnWidth", (BYTE)SendDlgItemMessage(hwndDlg,IDC_SPIN_W,UDM_GETPOS,0,0));
-							ModernWriteSettingByte(NULL,"ModernToolBar","option_Bar0_BtnHeight",(BYTE)SendDlgItemMessage(hwndDlg,IDC_SPIN_H,UDM_GETPOS,0,0));
-							ModernWriteSettingByte(NULL,"ModernToolBar","option_Bar0_BtnSpace", (BYTE)SendDlgItemMessage(hwndDlg,IDC_SPIN_S,UDM_GETPOS,0,0));
-							ModernWriteSettingByte(NULL, "ModernToolBar", "option_Bar0_Autosize", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_CHECK_AUTOSIZE));
-							ModernWriteSettingByte(NULL,"ModernToolBar", "option_Bar0_Multiline", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_CHECK_MULTILINE));
+							db_set_b(NULL,"CLUI","ShowButtonBar",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_TBSHOW));
+							db_set_b(NULL,"ModernToolBar","option_Bar0_BtnWidth", (BYTE)SendDlgItemMessage(hwndDlg,IDC_SPIN_W,UDM_GETPOS,0,0));
+							db_set_b(NULL,"ModernToolBar","option_Bar0_BtnHeight",(BYTE)SendDlgItemMessage(hwndDlg,IDC_SPIN_H,UDM_GETPOS,0,0));
+							db_set_b(NULL,"ModernToolBar","option_Bar0_BtnSpace", (BYTE)SendDlgItemMessage(hwndDlg,IDC_SPIN_S,UDM_GETPOS,0,0));
+							db_set_b(NULL, "ModernToolBar", "option_Bar0_Autosize", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_CHECK_AUTOSIZE));
+							db_set_b(NULL,"ModernToolBar", "option_Bar0_Multiline", (BYTE)IsDlgButtonChecked(hwndDlg,IDC_CHECK_MULTILINE));
 							
 							sttReloadButtons();
 							return TRUE;
diff --git a/plugins/Clist_modern/modern_viewmodebar.cpp b/plugins/Clist_modern/modern_viewmodebar.cpp
index 38f7e42f97..d47059d560 100644
--- a/plugins/Clist_modern/modern_viewmodebar.cpp
+++ b/plugins/Clist_modern/modern_viewmodebar.cpp
@@ -200,8 +200,8 @@ static void UpdateStickies()
 	{
         hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
         if(hItem)
-            SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, (BYTE)ModernGetSettingDword(hContact, CLVM_MODULE, g_szModename, 0) ? 1 : 0);
-        localMask = HIWORD(ModernGetSettingDword(hContact, CLVM_MODULE, g_szModename, 0));
+            SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, (BYTE)db_get_dw(hContact, CLVM_MODULE, g_szModename, 0) ? 1 : 0);
+        localMask = HIWORD(db_get_dw(hContact, CLVM_MODULE, g_szModename, 0));
         UpdateClistItem(hItem, (localMask == 0 || localMask == stickyStatusMask) ? stickyStatusMask : localMask);
         hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
     }
@@ -273,12 +273,12 @@ static int FillDialog(HWND hwnd)
 		for(i = 0;;i++)
 		{
 			mir_snprintf(buf, 20, "%d", i);
-			if(ModernGetSettingTString(NULL, "CListGroups", buf, &dbv))
+			if(DBGetContactSettingTString(NULL, "CListGroups", buf, &dbv))
 				break;
 
 			item.pszText = &dbv.ptszVal[1];
 			newItem = SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item);
-			ModernDBFreeVariant(&dbv);
+			db_free(&dbv);
 		}
 		ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);
 		ListView_Arrange(hwndList, LVA_ALIGNLEFT | LVA_ALIGNTOP);
@@ -389,19 +389,19 @@ void SaveViewMode(const char *name, const TCHAR *szGroupFilter, const char *szPr
     char szSetting[512];
 
     mir_snprintf(szSetting, 512, "%c%s_PF", 246, name);
-    ModernWriteSettingString(NULL, CLVM_MODULE, szSetting, szProtoFilter);
+    db_set_s(NULL, CLVM_MODULE, szSetting, szProtoFilter);
     mir_snprintf(szSetting, 512, "%c%s_GF", 246, name);
-    ModernWriteSettingTString(NULL, CLVM_MODULE, szSetting, szGroupFilter);
+    db_set_ws(NULL, CLVM_MODULE, szSetting, szGroupFilter);
     mir_snprintf(szSetting, 512, "%c%s_SM", 246, name);
-    ModernWriteSettingDword(NULL, CLVM_MODULE, szSetting, statusMask);
+    db_set_dw(NULL, CLVM_MODULE, szSetting, statusMask);
     mir_snprintf(szSetting, 512, "%c%s_SSM", 246, name);
-    ModernWriteSettingDword(NULL, CLVM_MODULE, szSetting, stickyStatusMask);
+    db_set_dw(NULL, CLVM_MODULE, szSetting, stickyStatusMask);
     mir_snprintf(szSetting, 512, "%c%s_OPT", 246, name);
-    ModernWriteSettingDword(NULL, CLVM_MODULE, szSetting, options);
+    db_set_dw(NULL, CLVM_MODULE, szSetting, options);
     mir_snprintf(szSetting, 512, "%c%s_LM", 246, name);
-    ModernWriteSettingDword(NULL, CLVM_MODULE, szSetting, lmdat);
+    db_set_dw(NULL, CLVM_MODULE, szSetting, lmdat);
 	
-	ModernWriteSettingDword(NULL, CLVM_MODULE, name, MAKELONG((unsigned short)operators, (unsigned short)stickies));
+	db_set_dw(NULL, CLVM_MODULE, name, MAKELONG((unsigned short)operators, (unsigned short)stickies));
 }
 
 /*
@@ -500,13 +500,13 @@ void SaveState()
                     if(SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) 
 					{
                         dwLocalMask = GetMaskForItem(hItem);
-                        ModernWriteSettingDword(hContact, CLVM_MODULE, szModeName, MAKELONG(1, (unsigned short)dwLocalMask));
+                        db_set_dw(hContact, CLVM_MODULE, szModeName, MAKELONG(1, (unsigned short)dwLocalMask));
                         stickies++;
                     }
                     else 
 					{
-                        if(ModernGetSettingDword(hContact, CLVM_MODULE, szModeName, 0))
-                            ModernWriteSettingDword(hContact, CLVM_MODULE, szModeName, 0);
+                        if(db_get_dw(hContact, CLVM_MODULE, szModeName, 0))
+                            db_set_dw(hContact, CLVM_MODULE, szModeName, 0);
                     }
                 }
                 hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
@@ -574,21 +574,21 @@ static void UpdateFilters()
     mir_sntprintf(szTemp, 100, TranslateT("Configuring view mode: %s"), szTempBuf);
     SetDlgItemText(clvmHwnd, IDC_CURVIEWMODE2, szTemp);
     mir_snprintf(szSetting, 128, "%c%s_PF", 246, szBuf);
-    if(ModernGetSettingString(NULL, CLVM_MODULE, szSetting, &dbv_pf))
+    if(DBGetContactSettingString(NULL, CLVM_MODULE, szSetting, &dbv_pf))
         goto cleanup;
     mir_snprintf(szSetting, 128, "%c%s_GF", 246, szBuf);
-    if(ModernGetSettingTString(NULL, CLVM_MODULE, szSetting, &dbv_gf))
+    if(DBGetContactSettingTString(NULL, CLVM_MODULE, szSetting, &dbv_gf))
         goto cleanup;
     mir_snprintf(szSetting, 128, "%c%s_OPT", 246, szBuf);
-    if ((opt = ModernGetSettingDword(NULL, CLVM_MODULE, szSetting, -1)) != -1) 
+    if ((opt = db_get_dw(NULL, CLVM_MODULE, szSetting, -1)) != -1) 
 	{
         SendDlgItemMessage(clvmHwnd, IDC_AUTOCLEARSPIN, UDM_SETPOS, 0, MAKELONG(LOWORD(opt), 0));
     }
     mir_snprintf(szSetting, 128, "%c%s_SM", 246, szBuf);
-    statusMask = ModernGetSettingDword(NULL, CLVM_MODULE, szSetting, 0);
+    statusMask = db_get_dw(NULL, CLVM_MODULE, szSetting, 0);
     mir_snprintf(szSetting, 128, "%c%s_SSM", 246, szBuf);
-    stickyStatusMask = ModernGetSettingDword(NULL, CLVM_MODULE, szSetting, -1);
-    dwFlags = ModernGetSettingDword(NULL, CLVM_MODULE, szBuf, 0);
+    stickyStatusMask = db_get_dw(NULL, CLVM_MODULE, szSetting, -1);
+    dwFlags = db_get_dw(NULL, CLVM_MODULE, szBuf, 0);
     {
         LVITEMA item = {0};
         char szTemp[256];
@@ -667,7 +667,7 @@ static void UpdateFilters()
 		EnableWindow(GetDlgItem(clvmHwnd, IDC_LASTMESSAGEUNIT), useLastMsg);
 
 	    mir_snprintf(szSetting, 128, "%c%s_LM", 246, szBuf);
-		lmdat = ModernGetSettingDword(NULL, CLVM_MODULE, szSetting, 0);
+		lmdat = db_get_dw(NULL, CLVM_MODULE, szSetting, 0);
 
 		SetDlgItemInt(clvmHwnd, IDC_LASTMSGVALUE, LOWORD(lmdat), FALSE);
 		bTmp = LOBYTE(HIWORD(lmdat));
@@ -678,8 +678,8 @@ static void UpdateFilters()
 
 	ShowPage(clvmHwnd, 0);
 cleanup:
-    ModernDBFreeVariant(&dbv_pf);
-    ModernDBFreeVariant(&dbv_gf);    
+    db_free(&dbv_pf);
+    db_free(&dbv_gf);    
     mir_free(szBuf);
 	mir_free(szTempBuf);
 }
@@ -689,16 +689,16 @@ void DeleteViewMode( char * szName )
 	char szSetting[256];
 
 	mir_snprintf(szSetting, 256, "%c%s_PF", 246, szName);
-	ModernDeleteSetting(NULL, CLVM_MODULE, szSetting);
+	db_unset(NULL, CLVM_MODULE, szSetting);
 	mir_snprintf(szSetting, 256, "%c%s_GF", 246, szName);
-	ModernDeleteSetting(NULL, CLVM_MODULE, szSetting);
+	db_unset(NULL, CLVM_MODULE, szSetting);
 	mir_snprintf(szSetting, 256, "%c%s_SM", 246, szName);
-	ModernDeleteSetting(NULL, CLVM_MODULE, szSetting);
+	db_unset(NULL, CLVM_MODULE, szSetting);
 	mir_snprintf(szSetting, 256, "%c%s_VA", 246, szName);
-	ModernDeleteSetting(NULL, CLVM_MODULE, szSetting);
+	db_unset(NULL, CLVM_MODULE, szSetting);
 	mir_snprintf(szSetting, 256, "%c%s_SSM", 246, szName);
-	ModernDeleteSetting(NULL, CLVM_MODULE, szSetting);
-	ModernDeleteSetting(NULL, CLVM_MODULE, szName);
+	db_unset(NULL, CLVM_MODULE, szSetting);
+	db_unset(NULL, CLVM_MODULE, szName);
 	if (!strcmp(g_CluiData.current_viewmode, szName) && lstrlenA(szName) == lstrlenA(g_CluiData.current_viewmode)) 
 	{
 		g_CluiData.bFilterEffective = 0;
@@ -708,8 +708,8 @@ void DeleteViewMode( char * szName )
 	HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
 	while(hContact) 
 	{
-		if(ModernGetSettingDword(hContact, CLVM_MODULE, szName, -1) != -1)
-			ModernWriteSettingDword(hContact, CLVM_MODULE, szName, 0);
+		if(db_get_dw(hContact, CLVM_MODULE, szName, -1) != -1)
+			db_set_dw(hContact, CLVM_MODULE, szName, 0);
 		hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0);
 	}
 }
@@ -891,7 +891,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP
 						char  *szUTF8Buf=NULL;
 						szUTF8Buf=mir_utf8encodeT(szBuf);
 						
-						if(ModernGetSettingDword(NULL, CLVM_MODULE, szUTF8Buf, -1) != -1)
+						if(db_get_dw(NULL, CLVM_MODULE, szUTF8Buf, -1) != -1)
                             MessageBox(0, TranslateT("A view mode with this name does alredy exist"), TranslateT("Duplicate name"), MB_OK);
                         else 
 						{
@@ -1126,7 +1126,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
 			(LPARAM) RegisterIcolibIconHandle("CLN_CLVM_set", "Contact List",Translate("Setup view modes"), _T("clisticons.dll"), 10, g_hInst, IDI_SETVIEW ));			
 
 		{
-			int bSkinned = ModernGetSettingByte(NULL, "CLCExt", "bskinned", 0);
+			int bSkinned = db_get_b(NULL, "CLCExt", "bskinned", 0);
 			int i = 0;
 
 			while(_buttons[i] != 0) {
@@ -1389,14 +1389,14 @@ static int  ehhViewModeBackgroundSettingsChanged(WPARAM wParam, LPARAM lParam)
 	{
 		DBVARIANT dbv;
 		view_mode.bkColour=sttGetColor("ViewMode","BkColour",CLCDEFAULT_BKCOLOUR);
-		if(ModernGetSettingByte(NULL,"ViewMode","UseBitmap",CLCDEFAULT_USEBITMAP)) {
-			if (!ModernGetSettingString(NULL,"ViewMode","BkBitmap",&dbv)) {
+		if(db_get_b(NULL,"ViewMode","UseBitmap",CLCDEFAULT_USEBITMAP)) {
+			if (!DBGetContactSettingString(NULL,"ViewMode","BkBitmap",&dbv)) {
 				view_mode.hBmpBackground=(HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
-				ModernDBFreeVariant(&dbv);
+				db_free(&dbv);
 			}
 		}
-		view_mode.useWinColors = ModernGetSettingByte(NULL, "ViewMode", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
-		view_mode.backgroundBmpUse = ModernGetSettingWord(NULL, "ViewMode", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
+		view_mode.useWinColors = db_get_b(NULL, "ViewMode", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
+		view_mode.backgroundBmpUse = db_get_w(NULL, "ViewMode", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
 	}	
 	PostMessage(pcli->hwndContactList,WM_SIZE,0,0);
 	return 0;
@@ -1459,7 +1459,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
     
     if (!name)  // Name is null - apply last stored view mode
     {
-        if (!ModernGetSettingString(NULL, CLVM_MODULE, szSetting, &dbv))
+        if (!DBGetContactSettingString(NULL, CLVM_MODULE, szSetting, &dbv))
         {
             name=(char*)_alloca(strlen(dbv.pszVal)+1);
             strcpy(name,dbv.pszVal);
@@ -1476,7 +1476,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
 		{   // remove last applied view mode
 			char szSetting[256];
 			mir_snprintf(szSetting, 256, "%c_LastMode", 246);
-			ModernDeleteSetting(NULL,CLVM_MODULE,szSetting);
+			db_unset(NULL,CLVM_MODULE,szSetting);
 		}
 		if ( g_CluiData.bOldUseGroups != (BYTE) -1 )
 			CallService( MS_CLIST_SETUSEGROUPS, (WPARAM)g_CluiData.bOldUseGroups, 0 );
@@ -1496,7 +1496,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
 	if ( !onlySelector )
 	{
         mir_snprintf(szSetting, 256, "%c%s_PF", 246, name);
-        if (!ModernGetSettingString(NULL, CLVM_MODULE, szSetting, &dbv)) {
+        if (!DBGetContactSettingString(NULL, CLVM_MODULE, szSetting, &dbv)) {
             if(lstrlenA(dbv.pszVal) >= 2) 
             {
                 strncpy(g_CluiData.protoFilter, dbv.pszVal, SIZEOF(g_CluiData.protoFilter));
@@ -1506,7 +1506,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
             mir_free(dbv.pszVal);
         }
         mir_snprintf(szSetting, 256, "%c%s_GF", 246, name);
-        if (!ModernGetSettingTString(NULL, CLVM_MODULE, szSetting, &dbv))
+        if (!DBGetContactSettingTString(NULL, CLVM_MODULE, szSetting, &dbv))
         {
             if(lstrlen(dbv.ptszVal) >= 2) 
             {
@@ -1517,12 +1517,12 @@ void ApplyViewMode(const char *Name, bool onlySelector )
             mir_free(dbv.ptszVal);
         }
         mir_snprintf(szSetting, 256, "%c%s_SM", 246, name);
-        g_CluiData.statusMaskFilter = ModernGetSettingDword(NULL, CLVM_MODULE, szSetting, -1);
+        g_CluiData.statusMaskFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, -1);
         if(g_CluiData.statusMaskFilter >= 1)
             g_CluiData.bFilterEffective |= CLVM_FILTER_STATUS;  
 
         mir_snprintf(szSetting, 256, "%c%s_SSM", 246, name);
-        g_CluiData.stickyMaskFilter = ModernGetSettingDword(NULL, CLVM_MODULE, szSetting, -1);
+        g_CluiData.stickyMaskFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, -1);
         if(g_CluiData.stickyMaskFilter != -1)
             g_CluiData.bFilterEffective |= CLVM_FILTER_STICKYSTATUS;
 
@@ -1573,7 +1573,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
             }
         }*/
 
-        g_CluiData.filterFlags = ModernGetSettingDword(NULL, CLVM_MODULE, name, 0);
+        g_CluiData.filterFlags = db_get_dw(NULL, CLVM_MODULE, name, 0);
 
         KillTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE);
         
@@ -1581,7 +1581,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
         {
             DWORD timerexpire;
             mir_snprintf(szSetting, 256, "%c%s_OPT", 246, name);
-            timerexpire = LOWORD(ModernGetSettingDword(NULL, CLVM_MODULE, szSetting, 0));
+            timerexpire = LOWORD(db_get_dw(NULL, CLVM_MODULE, szSetting, 0));
             strncpy(g_CluiData.old_viewmode, g_CluiData.current_viewmode, 256);
             g_CluiData.old_viewmode[255] = 0;
             CLUI_SafeSetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, NULL);
@@ -1589,7 +1589,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
         else //store last selected view mode only if it is not autoclear
         {
             mir_snprintf(szSetting, 256, "%c_LastMode", 246);
-            ModernWriteSettingString(NULL, CLVM_MODULE, szSetting, name);
+            db_set_s(NULL, CLVM_MODULE, szSetting, name);
         }
         strncpy(g_CluiData.current_viewmode, name, 256);
         g_CluiData.current_viewmode[255] = 0;  
@@ -1610,7 +1610,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
 
             g_CluiData.bFilterEffective |= CLVM_FILTER_LASTMSG;
             mir_snprintf(szSetting, 256, "%c%s_LM", 246, name);
-            g_CluiData.lastMsgFilter = ModernGetSettingDword(NULL, CLVM_MODULE, szSetting, 0);
+            g_CluiData.lastMsgFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, 0);
             if(LOBYTE(HIWORD(g_CluiData.lastMsgFilter)))
                 g_CluiData.bFilterEffective |= CLVM_FILTER_LASTMSG_NEWERTHAN;
             else
@@ -1636,7 +1636,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
         if ( g_CluiData.bFilterEffective & CLVM_FILTER_STATUS )
         {
             if(g_CluiData.boldHideOffline == (BYTE)-1)
-                g_CluiData.boldHideOffline = ModernGetSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT);
+                g_CluiData.boldHideOffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT);
         
             CallService(MS_CLIST_SETHIDEOFFLINE, 0, 0);
         }
@@ -1656,7 +1656,7 @@ void ApplyViewMode(const char *Name, bool onlySelector )
         if ( bUseGroups != -1 )
         {
             if(g_CluiData.bOldUseGroups == (BYTE)-1 )
-                g_CluiData.bOldUseGroups = ModernGetSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT );
+                g_CluiData.bOldUseGroups = db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT );
 
             CallService(MS_CLIST_SETUSEGROUPS, bUseGroups, 0);
         }
diff --git a/plugins/CommonLibs/CString.cpp b/plugins/CommonLibs/CString.cpp
index 2b7441a8e0..c78d9e25b0 100644
--- a/plugins/CommonLibs/CString.cpp
+++ b/plugins/CommonLibs/CString.cpp
@@ -340,9 +340,9 @@ TCString DBGetContactSettingString(HANDLE hContact, const char *szModule, const
 int DBGetContactSettingString(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
 {
 #ifdef _DEBUG
-	return DBGetContactSettingString_Helper(hContact, szModule, szSetting, dbv, __FILE__, __LINE__, DBVT_ASCIIZ);
+	return db_get_s(hContact, szModule, szSetting, dbv, DBVT_ASCIIZ);
 #else
-	return DBGetContactSettingString_Helper(hContact, szModule, szSetting, dbv, DBVT_ASCIIZ);
+	return db_get_s(hContact, szModule, szSetting, dbv, DBVT_ASCIIZ);
 #endif	
 }
 
diff --git a/plugins/Mir_core/db.cpp b/plugins/Mir_core/db.cpp
new file mode 100644
index 0000000000..37b89d8399
--- /dev/null
+++ b/plugins/Mir_core/db.cpp
@@ -0,0 +1,191 @@
+/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2009 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+*/
+
+#include "commonheaders.h"
+
+MIR_CORE_DLL(int) db_get_b(HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
+{
+	DBVARIANT dbv;
+	DBCONTACTGETSETTING cgs;
+	cgs.szModule  =  szModule;
+	cgs.szSetting  =  szSetting;
+	cgs.pValue  =  &dbv;
+	if (CallService(MS_DB_CONTACT_GETSETTING, (WPARAM)hContact, (LPARAM)&cgs))
+		return errorValue;
+	return dbv.bVal;
+}
+
+MIR_CORE_DLL(int) db_get_w(HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
+{
+	DBVARIANT dbv;
+	DBCONTACTGETSETTING cgs;
+	cgs.szModule = szModule;
+	cgs.szSetting = szSetting;
+	cgs.pValue = &dbv;
+	if (CallService(MS_DB_CONTACT_GETSETTING, (WPARAM)hContact, (LPARAM)&cgs))
+		return errorValue;
+	return dbv.wVal;
+}
+
+MIR_CORE_DLL(DWORD) db_get_dw(HANDLE hContact, const char *szModule, const char *szSetting, DWORD errorValue)
+{
+	DBVARIANT dbv;
+	DBCONTACTGETSETTING cgs;
+	cgs.szModule = szModule;
+	cgs.szSetting = szSetting;
+	cgs.pValue = &dbv;
+	if (CallService(MS_DB_CONTACT_GETSETTING, (WPARAM)hContact, (LPARAM)&cgs))
+		return errorValue;
+	return dbv.dVal;
+}
+
+MIR_CORE_DLL(INT_PTR) db_get(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
+{
+	DBCONTACTGETSETTING cgs;
+	cgs.szModule = szModule;
+	cgs.szSetting = szSetting;
+	cgs.pValue = dbv;
+
+	return CallService(MS_DB_CONTACT_GETSETTING, (WPARAM)hContact, (LPARAM)&cgs);
+}
+
+MIR_CORE_DLL(INT_PTR) db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType)
+{
+	DBCONTACTGETSETTING cgs;
+	cgs.szModule = szModule;
+	cgs.szSetting = szSetting;
+	cgs.pValue = dbv;
+	dbv->type = (BYTE)nType;
+	return CallService(MS_DB_CONTACT_GETSETTING_STR, (WPARAM)hContact, (LPARAM)&cgs);
+}
+
+MIR_CORE_DLL(char*) db_get_sa(HANDLE hContact, const char *szModule, const char *szSetting)
+{
+	char *str = NULL;
+	DBVARIANT dbv = {0};
+	db_get_s(hContact, szModule, szSetting, &dbv, DBVT_ASCIIZ);
+	if (dbv.type == DBVT_ASCIIZ)
+		str = mir_strdup(dbv.pszVal);
+	DBFreeVariant(&dbv);
+	return str;
+}
+
+MIR_CORE_DLL(wchar_t*) db_get_wsa(HANDLE hContact, const char *szModule, const char *szSetting)
+{
+	wchar_t *str = NULL;
+	DBVARIANT dbv={0};
+	db_get_s(hContact, szModule, szSetting, &dbv, DBVT_WCHAR);
+	if (dbv.type == DBVT_WCHAR)
+		str = mir_wstrdup(dbv.pwszVal);
+	DBFreeVariant(&dbv);
+	return str;
+}
+
+MIR_CORE_DLL(INT_PTR) db_free(DBVARIANT *dbv)
+{
+	return CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)dbv);
+}
+
+MIR_CORE_DLL(INT_PTR) db_unset(HANDLE hContact, const char *szModule, const char *szSetting)
+{
+	DBCONTACTGETSETTING cgs;
+	cgs.szModule = szModule;
+	cgs.szSetting = szSetting;
+	return CallService(MS_DB_CONTACT_DELETESETTING, (WPARAM)hContact, (LPARAM)&cgs);
+}
+
+MIR_CORE_DLL(INT_PTR) db_set_b(HANDLE hContact, const char *szModule, const char *szSetting, BYTE val)
+{
+	DBCONTACTWRITESETTING cws;
+	cws.szModule = szModule;
+	cws.szSetting = szSetting;
+	cws.value.type = DBVT_BYTE;
+	cws.value.bVal = val;
+	return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
+}
+
+MIR_CORE_DLL(INT_PTR) db_set_w(HANDLE hContact, const char *szModule, const char *szSetting, WORD val)
+{
+	DBCONTACTWRITESETTING cws;
+
+	cws.szModule = szModule;
+	cws.szSetting = szSetting;
+	cws.value.type = DBVT_WORD;
+	cws.value.wVal = val;
+	return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
+}
+
+MIR_CORE_DLL(INT_PTR) db_set_dw(HANDLE hContact, const char *szModule, const char *szSetting, DWORD val)
+{
+	DBCONTACTWRITESETTING cws;
+	cws.szModule = szModule;
+	cws.szSetting = szSetting;
+	cws.value.type = DBVT_DWORD;
+	cws.value.dVal = val;
+	return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
+}
+
+MIR_CORE_DLL(INT_PTR) db_set_s(HANDLE hContact, const char *szModule, const char *szSetting, const char *val)
+{
+	DBCONTACTWRITESETTING cws;
+
+	cws.szModule = szModule;
+	cws.szSetting = szSetting;
+	cws.value.type = DBVT_ASCIIZ;
+	cws.value.pszVal = (char*)val;
+	return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
+}
+
+MIR_CORE_DLL(INT_PTR) db_set_ws(HANDLE hContact, const char *szModule, const char *szSetting, const WCHAR *val)
+{
+	DBCONTACTWRITESETTING cws;
+
+	cws.szModule = szModule;
+	cws.szSetting = szSetting;
+	cws.value.type = DBVT_WCHAR;
+	cws.value.pwszVal = (WCHAR*)val;
+	return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
+}
+
+MIR_CORE_DLL(INT_PTR) db_set_utf(HANDLE hContact, const char *szModule, const char *szSetting, const char *val)
+{
+	DBCONTACTWRITESETTING cws;
+
+	cws.szModule = szModule;
+	cws.szSetting = szSetting;
+	cws.value.type = DBVT_UTF8;
+	cws.value.pszVal = (char*)val;
+	return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
+}
+
+MIR_CORE_DLL(INT_PTR) db_set_blob(HANDLE hContact, const char *szModule, const char *szSetting, void *val, unsigned len)
+{
+	DBCONTACTWRITESETTING cws;
+
+	cws.szModule = szModule;
+	cws.szSetting = szSetting;
+	cws.value.type = DBVT_BLOB;
+    cws.value.cpbVal  =  (WORD)len;
+	cws.value.pbVal = (unsigned char*)val;
+	return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
+}
diff --git a/plugins/Mir_core/mir_core.def b/plugins/Mir_core/mir_core.def
index ac94078de8..323ef00961 100644
--- a/plugins/Mir_core/mir_core.def
+++ b/plugins/Mir_core/mir_core.def
@@ -107,3 +107,19 @@ wildcmp                       @103
 wrtrim                        @104
 mir_snprintf                  @105
 mir_sntprintf                 @106
+db_unset                      @107
+db_free                       @108
+db_get                        @109
+db_get_b                      @110
+db_get_dw                     @111
+db_get_s                      @112
+db_get_sa                     @113
+db_get_w                      @114
+db_get_wsa                    @115
+db_set_b                      @116
+db_set_blob                   @117
+db_set_dw                     @118
+db_set_s                      @119
+db_set_utf                    @120
+db_set_w                      @121
+db_set_ws                     @122
diff --git a/plugins/Mir_core/mir_core_10.vcxproj b/plugins/Mir_core/mir_core_10.vcxproj
index 1e6d7de8d1..68b4adf4d8 100644
--- a/plugins/Mir_core/mir_core_10.vcxproj
+++ b/plugins/Mir_core/mir_core_10.vcxproj
@@ -20,6 +20,7 @@
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\include\m_core.h" />
+    <ClInclude Include="..\..\include\m_database.h" />
     <ClInclude Include="..\..\include\m_system.h" />
     <ClInclude Include="commonheaders.h" />
     <ClInclude Include="forkthread.h" />
@@ -33,6 +34,7 @@
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
     </ClCompile>
+    <ClCompile Include="db.cpp" />
     <ClCompile Include="langpack.cpp" />
     <ClCompile Include="lists.cpp" />
     <ClCompile Include="md5.cpp" />
@@ -149,6 +151,7 @@
       <AdditionalDependencies>miranda64.lib;ws2_32.lib;comctl32.lib;winmm.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>
       </AdditionalLibraryDirectories>
+      <AdditionalOptions>/ignore:4197 %(AdditionalOptions)</AdditionalOptions>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -213,6 +216,7 @@
       <AdditionalDependencies>miranda64.lib;ws2_32.lib;comctl32.lib;winmm.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>
       </AdditionalLibraryDirectories>
+      <AdditionalOptions>/ignore:4197 %(AdditionalOptions)</AdditionalOptions>
     </Link>
   </ItemDefinitionGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
diff --git a/plugins/Mir_core/mir_core_10.vcxproj.filters b/plugins/Mir_core/mir_core_10.vcxproj.filters
index 1a051134b1..1aca9fda03 100644
--- a/plugins/Mir_core/mir_core_10.vcxproj.filters
+++ b/plugins/Mir_core/mir_core_10.vcxproj.filters
@@ -43,6 +43,9 @@
     <ClCompile Include="sha1.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="db.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="commonheaders.h">
@@ -63,5 +66,8 @@
     <ClInclude Include="..\..\include\m_system.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\include\m_database.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
 </Project>
\ No newline at end of file
-- 
cgit v1.2.3