diff options
Diffstat (limited to 'setup_native/source/win32/customactions/reg4msdoc/registrywnt.cxx')
-rw-r--r-- | setup_native/source/win32/customactions/reg4msdoc/registrywnt.cxx | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/setup_native/source/win32/customactions/reg4msdoc/registrywnt.cxx b/setup_native/source/win32/customactions/reg4msdoc/registrywnt.cxx index 4f60d0cae32a..cd3507b7d696 100644 --- a/setup_native/source/win32/customactions/reg4msdoc/registrywnt.cxx +++ b/setup_native/source/win32/customactions/reg4msdoc/registrywnt.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -27,7 +27,7 @@ ************************************************************************/ //--------------------------------------- -// +// //--------------------------------------- #ifdef _MSC_VER @@ -50,22 +50,22 @@ #endif //--------------------------------------- -// +// //--------------------------------------- const size_t MAX_TMP_BUFF_SIZE = 1024 * sizeof(wchar_t); //############################################ -// Creation -// only possible through WindowsRegistry class +// Creation +// only possible through WindowsRegistry class //############################################ //----------------------------------------------------- /** Create instance and open the specified Registry key */ -RegistryKeyImplWinNT::RegistryKeyImplWinNT(HKEY RootKey, const std::wstring& KeyName) : +RegistryKeyImplWinNT::RegistryKeyImplWinNT(HKEY RootKey, const std::wstring& KeyName) : RegistryKeyImpl(RootKey, KeyName) { } @@ -73,7 +73,7 @@ RegistryKeyImplWinNT::RegistryKeyImplWinNT(HKEY RootKey, const std::wstring& Key //----------------------------------------------------- /** Create instance and open the specified Registry key */ -RegistryKeyImplWinNT::RegistryKeyImplWinNT(HKEY RootKey) : +RegistryKeyImplWinNT::RegistryKeyImplWinNT(HKEY RootKey) : RegistryKeyImpl(RootKey) { } @@ -95,10 +95,10 @@ RegistryKeyImplWinNT::RegistryKeyImplWinNT(HKEY RootKey, HKEY SubKey, const std: //----------------------------------------------------- /** The number of sub values of the key at hand - + @precond IsOpen = true - @throws + @throws */ size_t RegistryKeyImplWinNT::GetSubValueCount() const { @@ -147,37 +147,37 @@ size_t RegistryKeyImplWinNT::GetSubKeyCount() const /** */ StringListPtr RegistryKeyImplWinNT::GetSubKeyNames() const -{ +{ assert(IsOpen()); wchar_t buff[1024]; - DWORD buff_size = sizeof(buff); + DWORD buff_size = sizeof(buff); FILETIME ftime; - + StringList* key_names = new StringList(); - + LONG rc = ERROR_SUCCESS; for (DWORD i = 0; /* left empty */; i++) - { + { rc = RegEnumKeyExW( m_hSubKey, i, buff, &buff_size, 0, 0, 0, &ftime); - - if (ERROR_SUCCESS != rc && + + if (ERROR_SUCCESS != rc && ERROR_MORE_DATA != rc) break; - + buff_size = sizeof(buff); - key_names->push_back(buff); + key_names->push_back(buff); } - + if (ERROR_INVALID_HANDLE == rc) throw RegistryIOException(rc); else if (ERROR_NO_MORE_ITEMS != rc && ERROR_SUCCESS != rc) throw RegistryException(rc); - + #if (_MSC_VER < 1300) && !defined(__MINGW32__) return key_names; #else @@ -193,7 +193,7 @@ StringListPtr RegistryKeyImplWinNT::GetSubValueNames() const assert(IsOpen()); wchar_t buff[1024]; - DWORD buff_size = sizeof(buff); + DWORD buff_size = sizeof(buff); StringList* value_names = new StringList(); @@ -204,16 +204,16 @@ StringListPtr RegistryKeyImplWinNT::GetSubValueNames() const rc = RegEnumValueW( m_hSubKey, i, buff, &buff_size, 0, 0, 0, 0); - - if (ERROR_SUCCESS != rc && + + if (ERROR_SUCCESS != rc && ERROR_MORE_DATA != rc) break; buff_size = sizeof(buff); - value_names->push_back(buff); + value_names->push_back(buff); } - + if (ERROR_INVALID_HANDLE == rc) throw RegistryIOException(rc); else if (ERROR_NO_MORE_ITEMS != rc && ERROR_SUCCESS != rc) @@ -271,7 +271,7 @@ RegistryValue RegistryKeyImplWinNT::GetValue(const std::wstring& Name) const { assert(false); } - + return regval; } @@ -324,7 +324,7 @@ RegistryValue RegistryKeyImplWinNT::GetValue(const std::wstring& Name, const Reg return regval; } - + //############################################ // Commands @@ -332,7 +332,7 @@ RegistryValue RegistryKeyImplWinNT::GetValue(const std::wstring& Name, const Reg //----------------------------------------------------- -/** Open the registry key, has no effect if +/** Open the registry key, has no effect if the key is already open @precond IsOpen = false @@ -365,7 +365,7 @@ void RegistryKeyImplWinNT::Open(bool Writeable) throw RegistryException(rc); m_IsWriteable = Writeable; - + assert(IsOpen()); } @@ -405,7 +405,7 @@ RegistryKey RegistryKeyImplWinNT::CreateSubKey(const std::wstring& Name) HKEY hRoot = IsRootKey() ? m_hRootKey : m_hSubKey; HKEY hKey; - + LONG rc = RegCreateKeyExW( hRoot, Name.c_str(), @@ -442,16 +442,16 @@ void RegistryKeyImplWinNT::DeleteSubKey(const std::wstring& Name) assert(IsOpen()); assert(IsWriteable()); assert(HasSubKey(Name)); - + RegistryKey SubKey = OpenSubKey(Name); size_t nSubKeyCount = SubKey->GetSubKeyCount(); - + assert(0 == nSubKeyCount); - + if (nSubKeyCount) throw RegistryInvalidOperationException(ERROR_NOT_SUPPORTED); - + LONG rc = RegDeleteKeyW(m_hSubKey, Name.c_str()); if (ERROR_INVALID_HANDLE == rc) @@ -499,9 +499,9 @@ LONG RegistryKeyImplWinNT::ImplDeleteSubKeyTree(HKEY RootKey, const std::wstring 0, KEY_READ | DELETE, &hKey); - + if (ERROR_SUCCESS == rc) - { + { wchar_t* lpSubKey; DWORD nMaxSubKeyLen; @@ -509,7 +509,7 @@ LONG RegistryKeyImplWinNT::ImplDeleteSubKeyTree(HKEY RootKey, const std::wstring hKey, 0, 0, 0, 0, &nMaxSubKeyLen, 0, 0, 0, 0, 0, 0); - + nMaxSubKeyLen++; // space for trailing '\0' lpSubKey = reinterpret_cast<wchar_t*>( @@ -538,7 +538,7 @@ LONG RegistryKeyImplWinNT::ImplDeleteSubKeyTree(HKEY RootKey, const std::wstring } // while - RegCloseKey(hKey); + RegCloseKey(hKey); } // if @@ -561,7 +561,7 @@ LONG RegistryKeyImplWinNT::ImplDeleteSubKeyTree(HKEY RootKey, const std::wstring IsWriteable = true HasValue(Name) = true - @throws RegistryIOException + @throws RegistryIOException RegistryWriteAccessDeniedException RegistryValueNotFoundException */ |