diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-02-15 15:43:28 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-25 20:00:41 +0200 |
commit | 984c9e6ff7a0e3afb06fd4ad1f77d75b7b50d7ef (patch) | |
tree | 0c79644bfa5918eae11b55e80a3c8412025a67dc /include/comphelper | |
parent | 5f18b82dc4fb933e3af53809741ef7f739f23ff5 (diff) |
Do what the TODO said
Change-Id: I6358b550482188c6fdaf0cd01af353850d12138b
(cherry picked from commit 032c49b98635f3cc787d90cb744fcc212405a833)
Diffstat (limited to 'include/comphelper')
-rw-r--r-- | include/comphelper/windowsdebugoutput.hxx | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/include/comphelper/windowsdebugoutput.hxx b/include/comphelper/windowsdebugoutput.hxx index 4e396db92715..28eaab810ff2 100644 --- a/include/comphelper/windowsdebugoutput.hxx +++ b/include/comphelper/windowsdebugoutput.hxx @@ -19,6 +19,7 @@ #include <iomanip> #include <ostream> #include <string> +#include <vector> #ifdef LIBO_INTERNAL_ONLY #include <prewin.h> @@ -35,11 +36,41 @@ inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, t if (StringFromIID(rIid, &pRiid) != S_OK) return stream << "?"; - // TODO: Maybe look up a descriptive name for the service or interface, from HKCR\CLSID or - // HKCR\Interface? - stream << std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes( std::wstring(pRiid)); + + DWORD nSize; + if (RegGetValueW(HKEY_CLASSES_ROOT, std::wstring(L"CLSID\\").append(pRiid).data(), NULL, + RRF_RT_REG_SZ, NULL, NULL, &nSize) + == ERROR_SUCCESS) + { + std::vector<wchar_t> sValue(nSize / 2); + if (RegGetValueW(HKEY_CLASSES_ROOT, std::wstring(L"CLSID\\").append(pRiid).data(), NULL, + RRF_RT_REG_SZ, NULL, sValue.data(), &nSize) + == ERROR_SUCCESS) + { + stream << "=\"" + << std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes( + std::wstring(sValue.data())) + << "\""; + } + } + else if (RegGetValueW(HKEY_CLASSES_ROOT, std::wstring(L"Interface\\").append(pRiid).data(), + NULL, RRF_RT_REG_SZ, NULL, NULL, &nSize) + == ERROR_SUCCESS) + { + std::vector<wchar_t> sValue(nSize / 2); + if (RegGetValueW(HKEY_CLASSES_ROOT, std::wstring(L"Interface\\").append(pRiid).data(), NULL, + RRF_RT_REG_SZ, NULL, sValue.data(), &nSize) + == ERROR_SUCCESS) + { + stream << "=\"" + << std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes( + std::wstring(sValue.data())) + << "\""; + } + } + CoTaskMemFree(pRiid); return stream; } |