Index: src/chext/DropMenuExt.cpp =================================================================== diff -u -rb79aca0d66b1084f230022efe39cc89307482e6d -r3d1de44762647618faf9b5b3a87f89b293899d8d --- src/chext/DropMenuExt.cpp (.../DropMenuExt.cpp) (revision b79aca0d66b1084f230022efe39cc89307482e6d) +++ src/chext/DropMenuExt.cpp (.../DropMenuExt.cpp) (revision 3d1de44762647618faf9b5b3a87f89b293899d8d) @@ -27,17 +27,20 @@ #include "../libchcore/TSharedMemory.h" #include "TLogger.h" #include "ShellExtensionVerifier.h" +#include "HResultFormatter.h" ///////////////////////////////////////////////////////////////////////////// // CDropMenuExt CDropMenuExt::CDropMenuExt() : m_piShellExtControl(NULL) { + BOOST_LOG_FUNC(); + HRESULT hResult = CoCreateInstance(CLSID_CShellExtControl, NULL, CLSCTX_ALL, IID_IShellExtControl, (void**)&m_piShellExtControl); TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"CDropMenuExt::CDropMenuExt(): hResult=" << hResult << ", m_piShellExtControl=" << m_piShellExtControl; + BOOST_LOG_HRESULT(rLogger, hResult) << L"CoCreateInstance()"; } CDropMenuExt::~CDropMenuExt() @@ -51,8 +54,10 @@ STDMETHODIMP CDropMenuExt::Initialize(LPCITEMIDLIST pidlFolder, IDataObject* piDataObject, HKEY /*hkeyProgID*/) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"CDropMenuExt::Initialize()"; + BOOST_LOG_SEV(rLogger, debug) << L""; // When called: // 1. R-click on a directory @@ -61,16 +66,16 @@ if(!pidlFolder && !piDataObject) { - BOOST_LOG_SEV(rLogger, debug) << L"CDropMenuExt::Initialize(): Missing both pointers."; + BOOST_LOG_SEV(rLogger, error) << L"Missing both pointers."; return E_FAIL; } if(!pidlFolder || !piDataObject) - BOOST_LOG_SEV(rLogger, warning) << L"CDropMenuExt::Initialize(): Missing at least one parameter - it's unexpected."; + BOOST_LOG_SEV(rLogger, warning) << L"Missing at least one parameter - it's unexpected."; if(!piDataObject) { - BOOST_LOG_SEV(rLogger, error) << L"CDropMenuExt::Initialize(): Missing piDataObject."; + BOOST_LOG_SEV(rLogger, error) << L"Missing piDataObject."; return E_FAIL; } @@ -83,15 +88,17 @@ if(SUCCEEDED(hResult)) hResult = m_tShellExtData.GatherDataFromInitialize(pidlFolder, piDataObject); - BOOST_LOG_SEV(rLogger, debug) << L"CDropMenuExt::Initialize(): hResult=" << hResult; + BOOST_LOG_HRESULT(rLogger, hResult) << L""; return hResult; } STDMETHODIMP CDropMenuExt::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT /*idCmdLast*/, UINT /*uFlags*/) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"CDropMenuExt::QueryContextMenu()"; + BOOST_LOG_SEV(rLogger, debug) << L""; // check options HWND hWnd = ShellExtensionVerifier::VerifyShellExt(m_piShellExtControl); @@ -113,14 +120,16 @@ m_tContextMenuHandler.Init(spRootMenuItem, hMenu, idCmdFirst, indexMenu, m_tShellExtData, m_tShellExtMenuConfig.GetShowShortcutIcons(), bIntercept); HRESULT hResult = MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, m_tContextMenuHandler.GetLastCommandID() - idCmdFirst + 1); - BOOST_LOG_SEV(rLogger, debug) << L"CDropMenuExt::QueryContextMenu(): hResult=" << hResult; + BOOST_LOG_HRESULT(rLogger, hResult) << L""; return hResult; } STDMETHODIMP CDropMenuExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpici) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"CDropMenuExt::InvokeCommand()"; + BOOST_LOG_SEV(rLogger, debug) << L""; HWND hWnd = ShellExtensionVerifier::VerifyShellExt(m_piShellExtControl); if(hWnd == NULL) @@ -169,8 +178,10 @@ STDMETHODIMP CDropMenuExt::GetCommandString(UINT_PTR idCmd, UINT uFlags, UINT* /*pwReserved*/, LPSTR pszName, UINT cchMax) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"CDropMenuExt::GetCommandString()"; + BOOST_LOG_SEV(rLogger, debug) << L""; memset(pszName, 0, cchMax); @@ -222,6 +233,7 @@ HRESULT CDropMenuExt::ReadShellConfig() { + BOOST_LOG_FUNC(); try { HWND hWnd = ShellExtensionVerifier::VerifyShellExt(m_piShellExtControl); Index: src/chext/HResultFormatter.cpp =================================================================== diff -u --- src/chext/HResultFormatter.cpp (revision 0) +++ src/chext/HResultFormatter.cpp (revision 3d1de44762647618faf9b5b3a87f89b293899d8d) @@ -0,0 +1,46 @@ +// ============================================================================ +// Copyright (C) 2001-2015 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// 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 Library 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 "stdafx.h" +#include "HResultFormatter.h" +#include +#include "..\libchcore\TWin32ErrorFormatter.h" + +std::wstring HResultFormatter::FormatHResult(HRESULT hResult) +{ + std::wstringstream wstr; + wstr << L"hr=0x" << std::hex << hResult; + + switch(hResult) + { + case S_OK: + wstr << L" (S_OK)"; + break; + case S_FALSE: + wstr << L" (S_FALSE)"; + break; + default: + { + chcore::TString strDesc = chcore::TWin32ErrorFormatter::FormatWin32ErrorCodeWithFallback(hResult, nullptr, false); + if(!strDesc.IsEmpty()) + wstr << L" (" << strDesc.c_str() << ")"; + } + } + + return wstr.str(); +} Index: src/chext/HResultFormatter.h =================================================================== diff -u --- src/chext/HResultFormatter.h (revision 0) +++ src/chext/HResultFormatter.h (revision 3d1de44762647618faf9b5b3a87f89b293899d8d) @@ -0,0 +1,28 @@ +// ============================================================================ +// Copyright (C) 2001-2015 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// 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 Library 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. +// ============================================================================ +#ifndef __HRESULTFORMATTER_H__ +#define __HRESULTFORMATTER_H__ + +class HResultFormatter +{ +public: + static std::wstring FormatHResult(HRESULT hResult); +}; + +#endif Index: src/chext/MenuExt.cpp =================================================================== diff -u -rb79aca0d66b1084f230022efe39cc89307482e6d -r3d1de44762647618faf9b5b3a87f89b293899d8d --- src/chext/MenuExt.cpp (.../MenuExt.cpp) (revision b79aca0d66b1084f230022efe39cc89307482e6d) +++ src/chext/MenuExt.cpp (.../MenuExt.cpp) (revision 3d1de44762647618faf9b5b3a87f89b293899d8d) @@ -52,9 +52,11 @@ CMenuExt::CMenuExt() : m_piShellExtControl(NULL) { + BOOST_LOG_FUNC(); + HRESULT hResult = CoCreateInstance(CLSID_CShellExtControl, NULL, CLSCTX_ALL, IID_IShellExtControl, (void**)&m_piShellExtControl); TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"CMenuExt::CMenuExt(): hResult=" << hResult << ", m_piShellExtControl=" << m_piShellExtControl; + BOOST_LOG_HRESULT(rLogger, hResult) << LOG_PARAM(m_piShellExtControl); } CMenuExt::~CMenuExt() @@ -68,12 +70,14 @@ STDMETHODIMP CMenuExt::Initialize(LPCITEMIDLIST pidlFolder, IDataObject* piDataObject, HKEY /*hkeyProgID*/) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"CMenuExt::Initialize()"; + BOOST_LOG_SEV(rLogger, debug) << L""; if(!pidlFolder && !piDataObject) { - BOOST_LOG_SEV(rLogger, debug) << L"CMenuExt::Initialize(): Missing both pointers."; + BOOST_LOG_SEV(rLogger, error) << L"Missing both pointers."; return E_INVALIDARG; } @@ -86,15 +90,17 @@ if(SUCCEEDED(hResult)) hResult = m_tShellExtData.GatherDataFromInitialize(pidlFolder, piDataObject); - BOOST_LOG_SEV(rLogger, debug) << L"CMenuExt::Initialize(): hResult=" << hResult; + BOOST_LOG_HRESULT(rLogger, hResult) << L""; return hResult; } STDMETHODIMP CMenuExt::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT /*idCmdLast*/, UINT /*uFlags*/) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"CMenuExt::QueryContextMenu()"; + BOOST_LOG_SEV(rLogger, debug) << L""; // check options HWND hWnd = ShellExtensionVerifier::VerifyShellExt(m_piShellExtControl); @@ -150,8 +156,10 @@ STDMETHODIMP CMenuExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpici) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"CMenuExt::InvokeCommand()"; + BOOST_LOG_SEV(rLogger, debug) << L""; // textual verbs are not supported by this extension if(HIWORD(lpici->lpVerb) != 0) @@ -210,8 +218,10 @@ HRESULT CMenuExt::HandleMenuMsg2(UINT uMsg, WPARAM /*wParam*/, LPARAM lParam, LRESULT* /*plResult*/) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"CMenuExt::HandleMenuMsg2()"; + BOOST_LOG_SEV(rLogger, debug) << L""; switch(uMsg) { @@ -269,11 +279,16 @@ HRESULT CMenuExt::DrawMenuItem(LPDRAWITEMSTRUCT lpdis) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"CMenuExt::DrawMenuItem()"; + BOOST_LOG_SEV(rLogger, debug) << L""; if(!lpdis) + { + BOOST_LOG_SEV(rLogger, error) << L"Missing argument"; return E_FAIL; + } // check if menu if(lpdis->CtlType != ODT_MENU) @@ -331,8 +346,10 @@ STDMETHODIMP CMenuExt::GetCommandString(UINT_PTR idCmd, UINT uFlags, UINT* /*pwReserved*/, LPSTR pszName, UINT cchMax) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"CMenuExt::GetCommandString()"; + BOOST_LOG_SEV(rLogger, debug) << L""; memset(pszName, 0, cchMax); @@ -371,6 +388,8 @@ HRESULT CMenuExt::ReadShellConfig() { + BOOST_LOG_FUNC(); + try { HWND hWnd = ShellExtensionVerifier::VerifyShellExt(m_piShellExtControl); Index: src/chext/ShellExtControl.cpp =================================================================== diff -u -rb79aca0d66b1084f230022efe39cc89307482e6d -r3d1de44762647618faf9b5b3a87f89b293899d8d --- src/chext/ShellExtControl.cpp (.../ShellExtControl.cpp) (revision b79aca0d66b1084f230022efe39cc89307482e6d) +++ src/chext/ShellExtControl.cpp (.../ShellExtControl.cpp) (revision 3d1de44762647618faf9b5b3a87f89b293899d8d) @@ -28,8 +28,10 @@ m_hMemory(NULL), m_hMutex(NULL) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"CShellExtControl::CShellExtControl()"; + BOOST_LOG_SEV(rLogger, debug) << L""; // create protection mutex m_hMutex = ::CreateMutex(NULL, FALSE, _T("CHShellExtControlDataMutex")); @@ -54,7 +56,7 @@ if(!m_hMemory) { dwLastError = GetLastError(); - BOOST_LOG_SEV(rLogger, error) << L"Cannot create file mapping. Error code=" << dwLastError; + BOOST_LOG_HRESULT(rLogger, dwLastError) << L"Cannot create file mapping."; ReleaseMutex(m_hMutex); CloseHandle(m_hMutex); return; @@ -97,44 +99,48 @@ STDMETHODIMP CShellExtControl::GetVersion(LONG* plVersion, BSTR* pbstrVersion) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << "CShellExtControl::GetVersion()"; + BOOST_LOG_SEV(rLogger, debug) << ""; if(!plVersion || !pbstrVersion || (*pbstrVersion)) { - BOOST_LOG_SEV(rLogger, error) << "CShellExtControl::GetVersion(): Invalid arguments."; + BOOST_LOG_SEV(rLogger, error) << "Invalid arguments."; return E_INVALIDARG; } (*plVersion) = PRODUCT_VERSION1 << 24 | PRODUCT_VERSION2 << 16 | PRODUCT_VERSION3 << 8 | PRODUCT_VERSION4; _bstr_t strVer(SHELLEXT_PRODUCT_FULL_VERSION); *pbstrVersion = strVer.Detach(); - BOOST_LOG_SEV(rLogger, debug) << "CShellExtControl::GetVersion(): *plVersion=" << *plVersion << ", pbstrVersion=" << *pbstrVersion; + BOOST_LOG_SEV(rLogger, debug) << LOG_PARAMS2(*plVersion, *pbstrVersion); return S_OK; } STDMETHODIMP CShellExtControl::SetFlags(LONG lFlags, LONG lMask) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << "CShellExtControl::SetFlags(lFlags=" << lFlags << ", lMask=" << lMask << ")"; + BOOST_LOG_SEV(rLogger, debug) << LOG_PARAMS2(lFlags, lMask); if(!m_hMutex || !m_pShellExtData) { - BOOST_LOG_SEV(rLogger, error) << "CShellExtControl::SetFlags(): Wrong internal state."; + BOOST_LOG_SEV(rLogger, error) << "Wrong internal state."; return E_FAIL; } DWORD dwRes = WaitForSingleObject(m_hMutex, 10000); if(dwRes != WAIT_OBJECT_0) { - BOOST_LOG_SEV(rLogger, error) << "CShellExtControl::SetFlags(): Failed waiting for mutex."; + BOOST_LOG_SEV(rLogger, error) << "Failed waiting for mutex."; return E_FAIL; } m_pShellExtData->m_lFlags = (m_pShellExtData->m_lFlags & ~lMask) | (lFlags & lMask); - BOOST_LOG_SEV(rLogger, debug) << "CShellExtControl::SetFlags(): New flags=" << m_pShellExtData->m_lFlags; + BOOST_LOG_SEV(rLogger, debug) << LOG_PARAM(m_pShellExtData->m_lFlags); ReleaseMutex(m_hMutex); @@ -143,31 +149,33 @@ STDMETHODIMP CShellExtControl::GetFlags(LONG* plFlags) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << "CShellExtControl::GetFlags()"; + BOOST_LOG_SEV(rLogger, debug) << ""; if(!m_hMutex || !m_pShellExtData) { - BOOST_LOG_SEV(rLogger, error) << "CShellExtControl::GetFlags(): wrong internal state."; + BOOST_LOG_SEV(rLogger, error) << "Wrong internal state."; return E_FAIL; } if(!plFlags) { - BOOST_LOG_SEV(rLogger, error) << "CShellExtControl::GetFlags(): invalid argument."; + BOOST_LOG_SEV(rLogger, error) << "Invalid argument."; return E_INVALIDARG; } DWORD dwRes = WaitForSingleObject(m_hMutex, 10000); if(dwRes != WAIT_OBJECT_0) { - BOOST_LOG_SEV(rLogger, error) << "CShellExtControl::GetFlags(): failed waiting for mutex."; + BOOST_LOG_SEV(rLogger, error) << "Failed waiting for mutex."; return E_FAIL; } (*plFlags) = m_pShellExtData->m_lFlags; - BOOST_LOG_SEV(rLogger, debug) << "CShellExtControl::GetFlags(): returning flags=" << m_pShellExtData->m_lFlags; + BOOST_LOG_SEV(rLogger, debug) << "Returning flags. " << LOG_PARAM(m_pShellExtData->m_lFlags); ReleaseMutex(m_hMutex); Index: src/chext/TLogger.cpp =================================================================== diff -u -rb79aca0d66b1084f230022efe39cc89307482e6d -r3d1de44762647618faf9b5b3a87f89b293899d8d --- src/chext/TLogger.cpp (.../TLogger.cpp) (revision b79aca0d66b1084f230022efe39cc89307482e6d) +++ src/chext/TLogger.cpp (.../TLogger.cpp) (revision 3d1de44762647618faf9b5b3a87f89b293899d8d) @@ -29,8 +29,8 @@ #include #include #include -#include #include +#include namespace logging = boost::log; namespace src = boost::log::sources; @@ -100,21 +100,32 @@ logging::add_common_attributes(); logging::core::get()->add_global_attribute("Scope", attrs::named_scope()); - logging::add_file_log( + auto sink = logging::add_file_log( keywords::file_name = li.strLogPath, keywords::rotation_size = 10 * 1024 * 1024, keywords::open_mode = (std::ios::out | std::ios::app), keywords::format = ( expr::stream << expr::format_date_time< boost::posix_time::ptime >("TimeStamp", "[%Y-%m-%d %H:%M:%S]") - << "[" << logging::trivial::severity << "]: " - //<< expr::format_named_scope("Scopes", "%n") - //<< ":" + << "[" << severity << "]: " << expr::wmessage + << expr::if_(expr::has_attr("Scope")) + [ + expr::stream + << " (" + << expr::format_named_scope("Scope", + keywords::format = "%n", + keywords::depth = 1, + keywords::iteration = expr::forward) + << ")" + ] ) ); + std::locale loc = boost::locale::generator()("en_EN.UTF-8"); + sink->imbue(loc); + severity_level eSeverity = (severity_level)li.dwMinLogLevel; logging::core::get()->set_filter( severity >= eSeverity Index: src/chext/TLogger.h =================================================================== diff -u -rb79aca0d66b1084f230022efe39cc89307482e6d -r3d1de44762647618faf9b5b3a87f89b293899d8d --- src/chext/TLogger.h (.../TLogger.h) (revision b79aca0d66b1084f230022efe39cc89307482e6d) +++ src/chext/TLogger.h (.../TLogger.h) (revision 3d1de44762647618faf9b5b3a87f89b293899d8d) @@ -22,6 +22,8 @@ #include #include #include +#include +#include "HResultFormatter.h" // ugly way to include severity_level in the global namespace using namespace boost::log::trivial; @@ -30,4 +32,38 @@ BOOST_LOG_GLOBAL_LOGGER(Logger, TLogger) +// logging helpers +namespace details +{ + constexpr severity_level HRESULT2Severity(HRESULT hResult) + { + return (SUCCEEDED(hResult)) ? debug : error; + } +} + +#define BOOST_LOG_HRESULT(lg, hr)\ + BOOST_LOG_SEV(lg, details::HRESULT2Severity(hr)) << L" <" << HResultFormatter::FormatHResult(hr) << L"> " + +#define LOG_PARAM(param)\ + #param << "=" << param + +#define LOG_PARAMS2(a1, a2)\ + LOG_PARAM(a1) << ", " << LOG_PARAM(a2) +#define LOG_PARAMS3(a1, a2, a3)\ + LOG_PARAMS2(a1, a2) << ", " << LOG_PARAM(a3) +#define LOG_PARAMS4(a1, a2, a3, a4)\ + LOG_PARAMS3(a1, a2, a3) << ", " << LOG_PARAM(a4) +#define LOG_PARAMS5(a1, a2, a3, a4, a5)\ + LOG_PARAMS4(a1, a2, a3, a4) << ", " << LOG_PARAM(a5) +#define LOG_PARAMS6(a1, a2, a3, a4, a5, a6)\ + LOG_PARAMS5(a1, a2, a3, a4, a5) << ", " << LOG_PARAM(a6) +#define LOG_PARAMS7(a1, a2, a3, a4, a5, a6, a7)\ + LOG_PARAMS6(a1, a2, a3, a4, a5, a6) << ", " << LOG_PARAM(a7) +#define LOG_PARAMS8(a1, a2, a3, a4, a5, a6, a7, a8)\ + LOG_PARAMS7(a1, a2, a3, a4, a5, a6, a7) << ", " << LOG_PARAM(a8) +#define LOG_PARAMS9(a1, a2, a3, a4, a5, a6, a7, a8, a9)\ + LOG_PARAMS8(a1, a2, a3, a4, a5, a6, a7, a8) << ", " << LOG_PARAM(a9) +#define LOG_PARAMS10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)\ + LOG_PARAMS9(a1, a2, a3, a4, a5, a6, a7, a8, a9) << ", " << LOG_PARAM(a10) + #endif Index: src/chext/chext.cpp =================================================================== diff -u -rb79aca0d66b1084f230022efe39cc89307482e6d -r3d1de44762647618faf9b5b3a87f89b293899d8d --- src/chext/chext.cpp (.../chext.cpp) (revision b79aca0d66b1084f230022efe39cc89307482e6d) +++ src/chext/chext.cpp (.../chext.cpp) (revision 3d1de44762647618faf9b5b3a87f89b293899d8d) @@ -32,12 +32,14 @@ STDAPI DllCanUnloadNow() { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"DllCanUnloadNow()"; + BOOST_LOG_SEV(rLogger, debug) << L""; HRESULT hResult = _AtlModule.DllCanUnloadNow(); - BOOST_LOG_SEV(rLogger, debug) << L"DllCanUnloadNow: hResult = " << hResult; + BOOST_LOG_HRESULT(rLogger, hResult) << L""; return hResult; } @@ -47,12 +49,14 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"DllGetClassObject()"; + BOOST_LOG_SEV(rLogger, debug) << L""; HRESULT hResult = _AtlModule.DllGetClassObject(rclsid, riid, ppv); - BOOST_LOG_SEV(rLogger, debug) << L"DllGetClassObject(clsid=" << GuidFormatter::FormatGuid(rclsid) << ", riid=" << GuidFormatter::FormatGuid(riid) << ", ppv=" << ppv << "): hResult=" << hResult; + BOOST_LOG_HRESULT(rLogger, hResult) << L"clsid=" << GuidFormatter::FormatGuid(rclsid) << ", riid=" << GuidFormatter::FormatGuid(riid) << ", ppv=" << ppv; return hResult; } @@ -62,13 +66,15 @@ STDAPI DllRegisterServer() { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"DllRegisterServer()"; + BOOST_LOG_SEV(rLogger, debug) << L""; // registers object, typelib and all interfaces in typelib HRESULT hResult = _AtlModule.DllRegisterServer(); - BOOST_LOG_SEV(rLogger, debug) << L"DllRegisterServer(): hResult=" << hResult; + BOOST_LOG_HRESULT(rLogger, hResult) << L""; return hResult; } @@ -78,12 +84,14 @@ STDAPI DllUnregisterServer() { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"DllUnregisterServer()"; + BOOST_LOG_SEV(rLogger, debug) << L""; HRESULT hResult = _AtlModule.DllUnregisterServer(); - BOOST_LOG_SEV(rLogger, debug) << L"DllUnregisterServer(): hResult=" << hResult; + BOOST_LOG_HRESULT(rLogger, hResult) << L""; return hResult; } @@ -92,8 +100,10 @@ // per machine. STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine) { + BOOST_LOG_FUNC(); + TLogger& rLogger = Logger::get(); - BOOST_LOG_SEV(rLogger, debug) << L"DllInstall()"; + BOOST_LOG_SEV(rLogger, debug) << L""; HRESULT hr = E_FAIL; static const wchar_t szUserSwitch[] = _T("user"); @@ -113,7 +123,7 @@ else hr = DllUnregisterServer(); - BOOST_LOG_SEV(rLogger, debug) << L"DllInstall(bInstall=" << bInstall << ", pszCmdLine: " << pszCmdLine << L"): hResult=" << hr; + BOOST_LOG_HRESULT(rLogger, hr) << LOG_PARAMS2(bInstall, pszCmdLine); return hr; } Index: src/chext/chext.vc140.vcxproj =================================================================== diff -u -rb79aca0d66b1084f230022efe39cc89307482e6d -r3d1de44762647618faf9b5b3a87f89b293899d8d --- src/chext/chext.vc140.vcxproj (.../chext.vc140.vcxproj) (revision b79aca0d66b1084f230022efe39cc89307482e6d) +++ src/chext/chext.vc140.vcxproj (.../chext.vc140.vcxproj) (revision 3d1de44762647618faf9b5b3a87f89b293899d8d) @@ -583,6 +583,7 @@ + @@ -625,6 +626,7 @@ + Index: src/chext/chext.vc140.vcxproj.filters =================================================================== diff -u -rb79aca0d66b1084f230022efe39cc89307482e6d -r3d1de44762647618faf9b5b3a87f89b293899d8d --- src/chext/chext.vc140.vcxproj.filters (.../chext.vc140.vcxproj.filters) (revision b79aca0d66b1084f230022efe39cc89307482e6d) +++ src/chext/chext.vc140.vcxproj.filters (.../chext.vc140.vcxproj.filters) (revision 3d1de44762647618faf9b5b3a87f89b293899d8d) @@ -74,6 +74,9 @@ Source Files\Tools + + Source Files\Tools + @@ -121,6 +124,9 @@ Source Files\Tools + + Source Files\Tools +