summaryrefslogtreecommitdiff
path: root/configmgr
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-11-01 08:17:55 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-11-01 08:17:47 +0100
commitce8536ad3cfd00242c4fa7642e59374c0c5812f3 (patch)
treedf292dfc0849b2b08c94b96613a212277a7f460b /configmgr
parent42118724a713ceb9382432ddb5cf370b44e58bf3 (diff)
Winreg configuration layer: support oox:external values
Change-Id: Ie03cd4e351de62bf298009e220ed25338dc42f62 Reviewed-on: https://gerrit.libreoffice.org/44148 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/source/winreg.cxx53
1 files changed, 43 insertions, 10 deletions
diff --git a/configmgr/source/winreg.cxx b/configmgr/source/winreg.cxx
index 773775dfde92..81fc4b43ea0d 100644
--- a/configmgr/source/winreg.cxx
+++ b/configmgr/source/winreg.cxx
@@ -39,7 +39,8 @@ namespace {
// This is not a generic registry reader. We assume the following structure:
// 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) and Final (dword, optional)
+// Values can be the following: Value (string), Type (string, optional),
+// Final (dword, optional), External (dword, optional)
//
// For example the following registry setting:
// [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\LibreOffice\org.openoffice.UserProfile\Data\o]
@@ -81,6 +82,18 @@ namespace {
// <value>false</value>
// </prop>
// </item>
+//
+// External (component data) example:
+// [HKEY_CURRENT_USER\Software\Policies\LibreOffice\org.openoffice.UserProfile\Data\o]
+// "Value"="com.sun.star.configuration.backend.LdapUserProfileBe company"
+// "Final"=dword:00000001
+// "External"=dword:00000001
+// becomes the following in configuration:
+// <item oor:path="/org.openoffice.UserProfile/Data">
+// <prop oor:name="o" oor:finalized="true">
+// <value oor:external="com.sun.star.configuration.backend.LdapUserProfileBe company"/>
+// </prop>
+// </item>
void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFileHandle)
{
@@ -127,6 +140,7 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil
new wchar_t[nLongestValueLen/sizeof(wchar_t) + 1]);
bool bFinal = false;
+ bool bExternal = false;
OUString aValue;
OUString aType;
@@ -136,17 +150,25 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil
DWORD nValueLen = nLongestValueLen + 1;
RegEnumValueW(hCurKey, i, pValueName.get(), &nValueNameLen, nullptr, nullptr, reinterpret_cast<LPBYTE>(pValue.get()), &nValueLen);
- const wchar_t wsValue[] = L"Value";
- const wchar_t wsFinal[] = L"Final";
- const wchar_t wsType[] = L"Type";
- if(!wcscmp(pValueName.get(), wsValue))
+ if (!wcscmp(pValueName.get(), L"Value"))
aValue = o3tl::toU(pValue.get());
- else if (!wcscmp(pValueName.get(), wsType))
+ else if (!wcscmp(pValueName.get(), L"Type"))
aType = o3tl::toU(pValue.get());
- else if(!wcscmp(pValueName.get(), wsFinal) && *reinterpret_cast<DWORD*>(pValue.get()) == 1)
- bFinal = true;
+ else if (!wcscmp(pValueName.get(), L"Final"))
+ {
+ if (*reinterpret_cast<DWORD*>(pValue.get()) == 1)
+ bFinal = true;
+ }
+ else if (!wcscmp(pValueName.get(), L"External"))
+ {
+ if (*reinterpret_cast<DWORD*>(pValue.get()) == 1)
+ bExternal = true;
+ }
}
+ // type and external are mutually exclusive
+ assert(aType.isEmpty() || !bExternal);
+
sal_Int32 aLastSeparator = aKeyName.lastIndexOf('\\');
OUString aPathAndNodes = aKeyName.copy(0, aLastSeparator);
OUString aProp = aKeyName.copy(aLastSeparator + 1);
@@ -202,9 +224,20 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil
}
if(bFinal)
aFileHandle.writeString(" oor:finalized=\"true\"");
- aFileHandle.writeString("><value>");
+ aFileHandle.writeString("><value");
+ if (bExternal)
+ aFileHandle.writeString(" oor:external=\"");
+ else
+ aFileHandle.writeString(">");
+
writeValueContent(aFileHandle, aValue);
- aFileHandle.writeString("</value></prop>");
+
+ if (bExternal)
+ aFileHandle.writeString("\"/");
+ else
+ aFileHandle.writeString("</value");
+
+ aFileHandle.writeString("></prop>");
for(; nCloseNode > 0; nCloseNode--)
aFileHandle.writeString("</node>");
aFileHandle.writeString("</item>\n");