[Libreoffice-commits] core.git: include/comphelper

Tor Lillqvist tml at collabora.com
Thu Feb 15 13:47:33 UTC 2018


 include/comphelper/windowsdebugoutput.hxx |   37 +++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)

New commits:
commit 032c49b98635f3cc787d90cb744fcc212405a833
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Feb 15 15:43:28 2018 +0200

    Do what the TODO said
    
    Change-Id: I6358b550482188c6fdaf0cd01af353850d12138b

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;
 }


More information about the Libreoffice-commits mailing list