From 3618cbf67d6b02fb52b364a93a836a6b59f06a2f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 14 Nov 2018 16:57:16 +0300 Subject: ShellExt -> g_plugin --- plugins/ShellExt/src/main.cpp | 2 +- plugins/ShellExt/src/options.cpp | 42 ++++++++++++++++++++-------------------- plugins/ShellExt/src/shlcom.cpp | 22 ++++++++++----------- plugins/ShellExt/src/stdafx.h | 1 - 4 files changed, 33 insertions(+), 34 deletions(-) (limited to 'plugins/ShellExt') diff --git a/plugins/ShellExt/src/main.cpp b/plugins/ShellExt/src/main.cpp index 74841af390..dbd3f93c4c 100644 --- a/plugins/ShellExt/src/main.cpp +++ b/plugins/ShellExt/src/main.cpp @@ -31,7 +31,7 @@ PLUGININFOEX pluginInfoEx = { }; CMPlugin::CMPlugin() : - PLUGIN(SHLExt_Name, pluginInfoEx) + PLUGIN("shlext15", pluginInfoEx) {} ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/ShellExt/src/options.cpp b/plugins/ShellExt/src/options.cpp index e6b24c66f8..0933b708fc 100644 --- a/plugins/ShellExt/src/options.cpp +++ b/plugins/ShellExt/src/options.cpp @@ -42,15 +42,15 @@ static void InitControls(HWND hwndDlg) AutoSize(GetDlgItem(hwndDlg, IDC_CAPSHLSTATUS)); // show all the options - int iCheck = db_get_b(0, SHLExt_Name, SHLExt_UseGroups, BST_UNCHECKED); + int iCheck = g_plugin.getByte(SHLExt_UseGroups, BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_USEGROUPS, iCheck ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_CLISTGROUPS), iCheck = BST_CHECKED); - CheckDlgButton(hwndDlg, IDC_CLISTGROUPS, db_get_b(0, SHLExt_Name, SHLExt_UseCListSetting, BST_UNCHECKED)); - CheckDlgButton(hwndDlg, IDC_NOPROF, db_get_b(0, SHLExt_Name, SHLExt_ShowNoProfile, BST_UNCHECKED)); - CheckDlgButton(hwndDlg, IDC_SHOWFULL, db_get_b(0, SHLExt_Name, SHLExt_UseHITContacts, BST_UNCHECKED)); - CheckDlgButton(hwndDlg, IDC_SHOWINVISIBLES, db_get_b(0, SHLExt_Name, SHLExt_UseHIT2Contacts, BST_UNCHECKED)); - CheckDlgButton(hwndDlg, IDC_USEOWNERDRAW, db_get_b(0, SHLExt_Name, SHLExt_ShowNoIcons, BST_UNCHECKED)); - CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, db_get_b(0, SHLExt_Name, SHLExt_ShowNoOffline, BST_UNCHECKED)); + CheckDlgButton(hwndDlg, IDC_CLISTGROUPS, g_plugin.getByte(SHLExt_UseCListSetting, BST_UNCHECKED)); + CheckDlgButton(hwndDlg, IDC_NOPROF, g_plugin.getByte(SHLExt_ShowNoProfile, BST_UNCHECKED)); + CheckDlgButton(hwndDlg, IDC_SHOWFULL, g_plugin.getByte(SHLExt_UseHITContacts, BST_UNCHECKED)); + CheckDlgButton(hwndDlg, IDC_SHOWINVISIBLES, g_plugin.getByte(SHLExt_UseHIT2Contacts, BST_UNCHECKED)); + CheckDlgButton(hwndDlg, IDC_USEOWNERDRAW, g_plugin.getByte(SHLExt_ShowNoIcons, BST_UNCHECKED)); + CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, g_plugin.getByte(SHLExt_ShowNoOffline, BST_UNCHECKED)); // give the Remove button a Vista icon SendDlgItemMessage(hwndDlg, IDC_REMOVE, BCM_SETSHIELD, 0, 1); @@ -66,13 +66,13 @@ static INT_PTR CALLBACK OptDialogProc(HWND hwndDlg, UINT wMsg, WPARAM wParam, LP case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY) { - db_set_b(0, SHLExt_Name, SHLExt_UseGroups, IsDlgButtonChecked(hwndDlg, IDC_USEGROUPS)); - db_set_b(0, SHLExt_Name, SHLExt_UseCListSetting, IsDlgButtonChecked(hwndDlg, IDC_CLISTGROUPS)); - db_set_b(0, SHLExt_Name, SHLExt_ShowNoProfile, IsDlgButtonChecked(hwndDlg, IDC_NOPROF)); - db_set_b(0, SHLExt_Name, SHLExt_UseHITContacts, IsDlgButtonChecked(hwndDlg, IDC_SHOWFULL)); - db_set_b(0, SHLExt_Name, SHLExt_UseHIT2Contacts, IsDlgButtonChecked(hwndDlg, IDC_SHOWINVISIBLES)); - db_set_b(0, SHLExt_Name, SHLExt_ShowNoIcons, IsDlgButtonChecked(hwndDlg, IDC_USEOWNERDRAW)); - db_set_b(0, SHLExt_Name, SHLExt_ShowNoOffline, IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE)); + g_plugin.setByte(SHLExt_UseGroups, IsDlgButtonChecked(hwndDlg, IDC_USEGROUPS)); + g_plugin.setByte(SHLExt_UseCListSetting, IsDlgButtonChecked(hwndDlg, IDC_CLISTGROUPS)); + g_plugin.setByte(SHLExt_ShowNoProfile, IsDlgButtonChecked(hwndDlg, IDC_NOPROF)); + g_plugin.setByte(SHLExt_UseHITContacts, IsDlgButtonChecked(hwndDlg, IDC_SHOWFULL)); + g_plugin.setByte(SHLExt_UseHIT2Contacts, IsDlgButtonChecked(hwndDlg, IDC_SHOWINVISIBLES)); + g_plugin.setByte(SHLExt_ShowNoIcons, IsDlgButtonChecked(hwndDlg, IDC_USEOWNERDRAW)); + g_plugin.setByte(SHLExt_ShowNoOffline, IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE)); } break; @@ -89,13 +89,13 @@ static INT_PTR CALLBACK OptDialogProc(HWND hwndDlg, UINT wMsg, WPARAM wParam, LP if (IDYES == MessageBox(nullptr, TranslateT("Are you sure? This will remove all the settings stored in your database and all registry entries created for shlext to work with Explorer"), TranslateT("Disable/Remove shlext"), MB_YESNO | MB_ICONQUESTION)) { - db_unset(0, SHLExt_Name, SHLExt_UseGroups); - db_unset(0, SHLExt_Name, SHLExt_UseCListSetting); - db_unset(0, SHLExt_Name, SHLExt_UseHITContacts); - db_unset(0, SHLExt_Name, SHLExt_UseHIT2Contacts); - db_unset(0, SHLExt_Name, SHLExt_ShowNoProfile); - db_unset(0, SHLExt_Name, SHLExt_ShowNoIcons); - db_unset(0, SHLExt_Name, SHLExt_ShowNoOffline); + g_plugin.delSetting(SHLExt_UseGroups); + g_plugin.delSetting(SHLExt_UseCListSetting); + g_plugin.delSetting(SHLExt_UseHITContacts); + g_plugin.delSetting(SHLExt_UseHIT2Contacts); + g_plugin.delSetting(SHLExt_ShowNoProfile); + g_plugin.delSetting(SHLExt_ShowNoIcons); + g_plugin.delSetting(SHLExt_ShowNoOffline); CheckUnregisterServer(); InitControls(hwndDlg); diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index c20c5ef069..9ef57c5bb7 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -123,7 +123,7 @@ BOOL AddToList(TAddArgList& args) void NTAPI MainThreadIssueTransfer(ULONG_PTR param) { TAddArgList *p = (TAddArgList *)param; - db_set_b(p->hContact, SHLExt_Name, SHLExt_MRU, 1); + g_plugin.setByte(p->hContact, SHLExt_MRU, 1); CallService(MS_FILE_SENDSPECIFICFILES, (WPARAM)p->hContact, LPARAM(p->files)); SetEvent(p->hEvent); } @@ -237,7 +237,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) // hide offliners? bool bHideOffline = db_get_b(0, "CList", "HideOffline", 0) == 1; // do they wanna hide the offline people anyway? - if (db_get_b(0, SHLExt_Name, SHLExt_ShowNoOffline, 0) == 1) + if (g_plugin.getByte(SHLExt_ShowNoOffline, 0) == 1) // hide offline people bHideOffline = true; @@ -270,7 +270,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) continue; // is HIT on? - if (BST_UNCHECKED == db_get_b(0, SHLExt_Name, SHLExt_UseHITContacts, BST_UNCHECKED)) { + if (BST_UNCHECKED == g_plugin.getByte(SHLExt_UseHITContacts, BST_UNCHECKED)) { // don't show people who are "Hidden" "NotOnList" or Ignored if (db_get_b(hContact, "CList", "Hidden", 0) == 1 || db_get_b(hContact, "CList", "NotOnList", 0) == 1 || @@ -278,7 +278,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) continue; } // is HIT2 off? - if (BST_UNCHECKED == db_get_b(0, SHLExt_Name, SHLExt_UseHIT2Contacts, BST_UNCHECKED)) + if (BST_UNCHECKED == g_plugin.getByte(SHLExt_UseHIT2Contacts, BST_UNCHECKED)) if (db_get_w(hContact, szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE) continue; @@ -319,7 +319,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) pct->hContact = pContacts[i].hContact; pct->Status = pContacts[i].dwStatus; pct->hProto = pContacts[i].hProto; - pct->MRU = db_get_b(pct->hContact, SHLExt_Name, SHLExt_MRU, 0); + pct->MRU = g_plugin.getByte(pct->hContact, SHLExt_MRU); if (ipch->ContactsBegin == nullptr) ipch->ContactsBegin = pct; szSlot += cch + 1; @@ -342,8 +342,8 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) void __cdecl ClearMRUThread(void*) { for (auto &hContact : Contacts()) - if (db_get_b(hContact, SHLExt_Name, SHLExt_MRU, 0) > 0) - db_set_b(hContact, SHLExt_Name, SHLExt_MRU, 0); + if (g_plugin.getBool(hContact, SHLExt_MRU)) + g_plugin.setByte(hContact, SHLExt_MRU, false); } // this function is called from an APC into the main thread @@ -396,7 +396,7 @@ void __stdcall ipcService(ULONG_PTR) // store the address map offset so the caller can retranslate pMMT->pServerBaseAddress = pMMT; // return some options to the client - if (db_get_b(0, SHLExt_Name, SHLExt_ShowNoIcons, 0) != 0) + if (g_plugin.getByte(SHLExt_ShowNoIcons, 0) != 0) pMMT->dwFlags = HIPC_NOICONS; // see if we have a custom string for 'Miranda' @@ -412,14 +412,14 @@ void __stdcall ipcService(ULONG_PTR) lstrcpynA(pMMT->ClearEntries, szBuf, sizeof(pMMT->ClearEntries) - 1); // if the group mode is on, check if they want the CList setting - bool bGroupMode = (BST_CHECKED == db_get_b(0, SHLExt_Name, SHLExt_UseGroups, BST_UNCHECKED)); - if (bGroupMode && BST_CHECKED == db_get_b(0, SHLExt_Name, SHLExt_UseCListSetting, BST_UNCHECKED)) + bool bGroupMode = (BST_CHECKED == g_plugin.getByte(SHLExt_UseGroups, BST_UNCHECKED)); + if (bGroupMode && BST_CHECKED == g_plugin.getByte(SHLExt_UseCListSetting, BST_UNCHECKED)) bGroupMode = db_get_b(0, "CList", "UseGroups", true) != 0; TSlotIPC *pct = nullptr; int iSlot = 0; // return profile if set - if (BST_UNCHECKED == db_get_b(0, SHLExt_Name, SHLExt_ShowNoProfile, BST_UNCHECKED)) { + if (BST_UNCHECKED == g_plugin.getByte(SHLExt_ShowNoProfile, BST_UNCHECKED)) { pct = ipcAlloc(pMMT, 50); if (pct != nullptr) { // will actually return with .dat if there's space for it, not what the docs say diff --git a/plugins/ShellExt/src/stdafx.h b/plugins/ShellExt/src/stdafx.h index aa2f1e1f59..27b3093433 100644 --- a/plugins/ShellExt/src/stdafx.h +++ b/plugins/ShellExt/src/stdafx.h @@ -23,7 +23,6 @@ #include "version.h" -#define SHLExt_Name "shlext15" #define SHLExt_MRU "MRU" #define SHLExt_UseGroups "UseGroups" #define SHLExt_UseCListSetting "UseCLGroups" -- cgit v1.2.3