diff options
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/components.cxx | 7 | ||||
-rw-r--r-- | configmgr/source/winreg.cxx | 5 | ||||
-rw-r--r-- | configmgr/source/winreg.hxx | 4 |
3 files changed, 11 insertions, 5 deletions
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 4b1eaeabfeaf..9e19ef94024a 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -537,13 +537,16 @@ Components::Components( ++layer; //TODO: overflow #endif #if defined WNT - } else if (type == "winreg") { + } else if (type == "winreg" || type == "winuserreg") { if (!url.isEmpty()) { throw css::uno::RuntimeException( "CONFIGURATION_LAYERS: non-empty \"winreg\" URL"); } OUString aTempFileURL; - if (dumpWindowsRegistry(&aTempFileURL)) { + WinRegType eType = WinRegType::LOCAL_MACHINE; + if (type == "winuserreg") + eType = WinRegType::CURRENT_USER; + if (dumpWindowsRegistry(&aTempFileURL, eType)) { parseFileLeniently(&parseXcuFile, aTempFileURL, layer, 0, 0, 0); osl::File::remove(aTempFileURL); } diff --git a/configmgr/source/winreg.cxx b/configmgr/source/winreg.cxx index a5723d7588ef..455c7119f329 100644 --- a/configmgr/source/winreg.cxx +++ b/configmgr/source/winreg.cxx @@ -188,10 +188,11 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString aKeyName, oslFileHandle aFileHan } } -bool dumpWindowsRegistry(OUString* pFileURL) +bool dumpWindowsRegistry(OUString* pFileURL, WinRegType eType) { HKEY hKey; - if(RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Policies\\LibreOffice", 0, KEY_READ, &hKey) != ERROR_SUCCESS) + HKEY hDomain = eType == LOCAL_MACHINE ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; + if(RegOpenKeyExW(hDomain, L"SOFTWARE\\Policies\\LibreOffice", 0, KEY_READ, &hKey) != ERROR_SUCCESS) { SAL_INFO( "configmgr", diff --git a/configmgr/source/winreg.hxx b/configmgr/source/winreg.hxx index 020977262beb..fb880ac0c564 100644 --- a/configmgr/source/winreg.hxx +++ b/configmgr/source/winreg.hxx @@ -13,7 +13,9 @@ namespace configmgr { -bool dumpWindowsRegistry(OUString* pFileURL); +enum WinRegType { LOCAL_MACHINE, CURRENT_USER }; + +bool dumpWindowsRegistry(OUString* pFileURL, WinRegType eType); } |