// - add high level functions (RegisterOleServer, ...)
///////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "registry.h"
#endif
// ----------------------------------------------------------------------------
// opens key (it's not an error to call Open() on an already opened key)
-bool wxRegKey::Open()
+bool wxRegKey::Open(AccessMode mode)
{
if ( IsOpened() )
return TRUE;
(HKEY) m_hRootKey,
m_strKey,
RESERVED,
- KEY_ALL_ACCESS,
+ mode == Read ? KEY_READ : KEY_ALL_ACCESS,
&tmpKey
);
Close();
m_dwLastError = RegDeleteKey((HKEY) m_hRootKey, m_strKey);
- if ( m_dwLastError != ERROR_SUCCESS ) {
+ // deleting a key which doesn't exist is not considered an error
+ if ( m_dwLastError != ERROR_SUCCESS &&
+ m_dwLastError != ERROR_FILE_NOT_FOUND ) {
wxLogSysError(m_dwLastError, _("Can't delete key '%s'"),
GetName().c_str());
return FALSE;
(HKEY)hRootKey,
szKey,
RESERVED,
- KEY_ALL_ACCESS,
+ KEY_READ, // we might not have enough rights for rw access
&hkeyDummy
) == ERROR_SUCCESS )
{