diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-02-15 15:43:28 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2018-02-15 15:44:44 +0200 |
commit | 032c49b98635f3cc787d90cb744fcc212405a833 (patch) | |
tree | 8d8b4c6d869671cbf1f29c5c04dbbf251daa5585 /include/comphelper | |
parent | a315bfee11b99b41ed6c2fc855e2ff9e10ce9a2b (diff) |
Do what the TODO said
Change-Id: I6358b550482188c6fdaf0cd01af353850d12138b
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; } |