From 24aae88a4cc615d9ad079e7be55f7cbb4c16911a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 26 Jul 2009 15:50:03 +0000 Subject: [PATCH] Set access mode in wxRegKey::SetHkey(). It was left uninitialized before resulting in the key being closed on access because the check for being opened in a mode with enough permissions failed even for Read. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61537 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/registry.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/msw/registry.cpp b/src/msw/registry.cpp index dbfb079c8c..57eea64341 100644 --- a/src/msw/registry.cpp +++ b/src/msw/registry.cpp @@ -294,6 +294,18 @@ void wxRegKey::SetHkey(WXHKEY hKey) Close(); m_hKey = hKey; + + // we don't know the parent of this key, assume HKLM by default + m_hRootKey = HKEY_LOCAL_MACHINE; + + // we don't know in which mode was this key opened but we can't reopen it + // anyhow because we don't know its name, so the only thing we can is to hope + // that it allows all the operations which we're going to perform on it + m_mode = Write; + + // reset old data + m_strKey.empty(); + m_dwLastError = 0; } // ---------------------------------------------------------------------------- -- 2.47.2