fixed problem with non-const methods not working on wxRegKey initially opened in read-only mode
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -245,6 +245,7 @@ private:
|
|||||||
m_hRootKey; // handle of the top key (i.e. StdKey)
|
m_hRootKey; // handle of the top key (i.e. StdKey)
|
||||||
wxString m_strKey; // key name (relative to m_hRootKey)
|
wxString m_strKey; // key name (relative to m_hRootKey)
|
||||||
|
|
||||||
|
AccessMode m_mode; // valid only if key is opened
|
||||||
long m_dwLastError; // last error (0 if none)
|
long m_dwLastError; // last error (0 if none)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -364,7 +364,13 @@ bool wxRegKey::GetKeyInfo(size_t *pnSubKeys,
|
|||||||
bool wxRegKey::Open(AccessMode mode)
|
bool wxRegKey::Open(AccessMode mode)
|
||||||
{
|
{
|
||||||
if ( IsOpened() )
|
if ( IsOpened() )
|
||||||
return true;
|
{
|
||||||
|
if ( mode <= m_mode )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// we had been opened in read mode but now must be reopened in write
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
HKEY tmpKey;
|
HKEY tmpKey;
|
||||||
m_dwLastError = ::RegOpenKeyEx
|
m_dwLastError = ::RegOpenKeyEx
|
||||||
@@ -384,6 +390,8 @@ bool wxRegKey::Open(AccessMode mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_hKey = (WXHKEY) tmpKey;
|
m_hKey = (WXHKEY) tmpKey;
|
||||||
|
m_mode = mode;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user