shell/source/win32/spsupp/registrar.cxx |   22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

New commits:
commit acd8692001803b67fb4e131bbf30efb07724cde9
Author: Mike Kaganski <mike.kagan...@collabora.com>
Date:   Tue Apr 11 19:20:24 2017 +0300

    tdf#103058: use RegQueryValueEx instead of RegGetValue
    
    because the latter is unsupported on WinXP
    
    Change-Id: Ie922271ab837637d77f3d76c5144d10a7f5a5f0d
    Reviewed-on: https://gerrit.libreoffice.org/36416
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit aa4e06c67dbe414ae26b757d6968eb27b5ebeb99)
    Reviewed-on: https://gerrit.libreoffice.org/36419
    Tested-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/shell/source/win32/spsupp/registrar.cxx 
b/shell/source/win32/spsupp/registrar.cxx
index 5ece3fcdd2d8..5d49efe7c88c 100644
--- a/shell/source/win32/spsupp/registrar.cxx
+++ b/shell/source/win32/spsupp/registrar.cxx
@@ -14,8 +14,28 @@ namespace {
 
     HRESULT RegRead(HKEY hRootKey, const wchar_t* subKey, const wchar_t* 
valName, wchar_t* valData, size_t cchData)
     {
+        HKEY hKey;
+        long iRetVal = RegCreateKeyExW(
+            hRootKey,
+            subKey,
+            0,
+            nullptr,
+            REG_OPTION_NON_VOLATILE,
+            KEY_READ,
+            nullptr,
+            &hKey,
+            nullptr);
+        if (iRetVal != ERROR_SUCCESS)
+            return HRESULT_FROM_WIN32(iRetVal);
+
         DWORD cbData = cchData * sizeof(valData[0]);
-        long iRetVal = RegGetValue(hRootKey, subKey, valName, RRF_RT_REG_SZ, 
nullptr, valData, &cbData);
+        DWORD dwType;
+        iRetVal = RegQueryValueExW(hKey, valName, nullptr, &dwType, 
reinterpret_cast<LPBYTE>(valData), &cbData);
+        RegCloseKey(hKey);
+        if ((iRetVal == ERROR_SUCCESS) && (dwType != REG_SZ))
+        {
+            return E_FAIL;
+        }
         return HRESULT_FROM_WIN32(iRetVal);
     }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to