From c9a81876ee0ba173af107fda6a831d5a2cbb61de Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Mon, 7 May 2018 12:23:02 -0700 Subject: Add possibility to read from winreg conf backend Change-Id: I67bc14d7ee1bacc15d34e6ee25ca7638de268643 Reviewed-on: https://gerrit.libreoffice.org/53942 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/53943 Tested-by: Jenkins Reviewed-by: Andras Timar --- configmgr/source/winreg.cxx | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/configmgr/source/winreg.cxx b/configmgr/source/winreg.cxx index eda41482a032..c7ba91fb205f 100644 --- a/configmgr/source/winreg.cxx +++ b/configmgr/source/winreg.cxx @@ -34,7 +34,8 @@ namespace { // Last element of Key becomes prop, first part is the path and optionally nodes, // when the node has oor:op attribute. // Values can be the following: Value (string), Type (string, optional), -// Final (dword, optional), External (dword, optional), ExternalBackend (string, optional) +// Final (dword, optional), External (dword, optional), ExternalBackend (string, optional), +// Nil (dword, optional) // // For example the following registry setting: // [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\LibreOffice\org.openoffice.UserProfile\Data\o] @@ -89,6 +90,28 @@ namespace { // // // +// +// Nil example: +// Empty value () and nil value () are different. +// In case of some path settings, the base path setting has to be cleared. +// [HKEY_CURRENT_USER\Software\Policies\LibreOffice\org.openoffice.Office.Common\Path\Current\Work] +// "Value"="" +// "Final"=dword:00000001 +// "Nil"=dword:00000001 +// [HKEY_CURRENT_USER\Software\Policies\LibreOffice\org.openoffice.Office.Paths\Paths\org.openoffice.Office.Paths:NamedPath['Work']\WritePath] +// "Value"="file:///H:/" +// "Final"=dword:00000001 +// becomes the following in configuration: +// +// +// +// +// +// +// +// file:///H:/ +// +// void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFileHandle) { @@ -136,6 +159,7 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil bool bFinal = false; bool bExternal = false; + bool bNil = false; OUString aValue; OUString aType; OUString aExternalBackend; @@ -156,6 +180,11 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil if (*reinterpret_cast(pValue.get()) == 1) bFinal = true; } + else if (!wcscmp(pValueName.get(), L"Nil")) + { + if (*reinterpret_cast(pValue.get()) == 1) + bNil = true; + } else if (!wcscmp(pValueName.get(), L"External")) { if (*reinterpret_cast(pValue.get()) == 1) @@ -231,7 +260,11 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil if(bFinal) aFileHandle.writeString(" oor:finalized=\"true\""); aFileHandle.writeString(">