Index: src/chext/DropMenuExt.cpp =================================================================== diff -u -N -r8068e0c351055554340ac9755d1bc846893bf2b8 -rebc7fabbd2d59f9a0f723ea480b5374cc393ec12 --- src/chext/DropMenuExt.cpp (.../DropMenuExt.cpp) (revision 8068e0c351055554340ac9755d1bc846893bf2b8) +++ src/chext/DropMenuExt.cpp (.../DropMenuExt.cpp) (revision ebc7fabbd2d59f9a0f723ea480b5374cc393ec12) @@ -25,22 +25,20 @@ #include "ShellPathsHelpers.h" #include "../common/TShellExtMenuConfig.h" #include "../libchcore/TSharedMemory.h" -#include "TLogger.h" +#include "Logger.h" #include "ShellExtensionVerifier.h" #include "HResultFormatter.h" ///////////////////////////////////////////////////////////////////////////// // CDropMenuExt CDropMenuExt::CDropMenuExt() : - m_piShellExtControl(nullptr) + m_piShellExtControl(nullptr), + m_spLog(GetLogger(L"CDropMenuExt")) { - BOOST_LOG_FUNC(); - HRESULT hResult = CoCreateInstance(CLSID_CShellExtControl, nullptr, CLSCTX_ALL, IID_IShellExtControl, (void**)&m_piShellExtControl); - TLogger& rLogger = Logger::get(); - BOOST_LOG_HRESULT(rLogger, hResult) << L"CoCreateInstance()"; + LOG_HRESULT(m_spLog, hResult) << L"Create instance of ShellExtControl"; } CDropMenuExt::~CDropMenuExt() @@ -54,28 +52,25 @@ STDMETHODIMP CDropMenuExt::Initialize(LPCITEMIDLIST pidlFolder, IDataObject* piDataObject, HKEY /*hkeyProgID*/) { - BOOST_LOG_FUNC(); + LOG_DEBUG(m_spLog) << L"Initializing"; - TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L""; - // When called: // 1. R-click on a directory // 2. R-click on a directory background // 3. Pressed Ctrl+C, Ctrl+X on a specified file/directory if(!pidlFolder && !piDataObject) { - BOOST_LOG_SEV(rLogger, error) << L"Missing both pointers."; + LOG_ERROR(m_spLog) << L"Missing both pointers."; return E_FAIL; } if(!pidlFolder || !piDataObject) - BOOST_LOG_SEV(rLogger, warning) << L"Missing at least one parameter - it's unexpected."; + LOG_WARNING(m_spLog) << L"Missing at least one parameter - it's unexpected."; if(!piDataObject) { - BOOST_LOG_SEV(rLogger, error) << L"Missing piDataObject."; + LOG_ERROR(m_spLog) << L"Missing piDataObject."; return E_FAIL; } @@ -85,21 +80,20 @@ return E_FAIL; HRESULT hResult = ReadShellConfig(); + LOG_HRESULT(m_spLog, hResult) << L"Read shell config"; if(SUCCEEDED(hResult)) + { hResult = m_tShellExtData.GatherDataFromInitialize(pidlFolder, piDataObject); + LOG_HRESULT(m_spLog, hResult) << L"Gather data from initialize"; + } - BOOST_LOG_HRESULT(rLogger, hResult) << L""; - return hResult; } STDMETHODIMP CDropMenuExt::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT /*idCmdLast*/, UINT /*uFlags*/) { - BOOST_LOG_FUNC(); + LOG_DEBUG(m_spLog) << L"Querying context menu"; - TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L""; - // check options HWND hWnd = ShellExtensionVerifier::VerifyShellExt(m_piShellExtControl); if(!hWnd) @@ -124,11 +118,8 @@ STDMETHODIMP CDropMenuExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpici) { - BOOST_LOG_FUNC(); + LOG_DEBUG(m_spLog) << L"Invoking command"; - TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L""; - HWND hWnd = ShellExtensionVerifier::VerifyShellExt(m_piShellExtControl); if(hWnd == nullptr) return E_FAIL; @@ -176,11 +167,8 @@ STDMETHODIMP CDropMenuExt::GetCommandString(UINT_PTR idCmd, UINT uFlags, UINT* /*pwReserved*/, LPSTR pszName, UINT cchMax) { - BOOST_LOG_FUNC(); + LOG_DEBUG(m_spLog) << L"Retrieving command string for cmd: " << idCmd; - TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L""; - memset(pszName, 0, cchMax); if(uFlags != GCS_HELPTEXTW && uFlags != GCS_HELPTEXTA) @@ -231,10 +219,6 @@ HRESULT CDropMenuExt::ReadShellConfig() { - BOOST_LOG_FUNC(); - - TLogger& rLogger = Logger::get(); - try { HWND hWnd = ShellExtensionVerifier::VerifyShellExt(m_piShellExtControl); @@ -245,7 +229,7 @@ unsigned long ulSHMID = GetTickCount(); if(::SendMessage(hWnd, WM_GETCONFIG, eLocation_DragAndDropMenu, ulSHMID) != TRUE) { - BOOST_LOG_SEV(rLogger, error) << L"Failed to retrieve configuration from Copy Handler"; + LOG_ERROR(m_spLog) << L"Failed to retrieve configuration from Copy Handler"; return E_FAIL; }