From 5e6b515abaad0dd8b8ad3baea5e94311ec538ab7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 28 Apr 2004 10:42:41 +0000 Subject: [PATCH] open registry keys in read-only mode as we might not have the rights for full access to them (this is default for normal users under XP) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26993 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/mimetype.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/msw/mimetype.cpp b/src/msw/mimetype.cpp index bd6edf88f5..711023e813 100644 --- a/src/msw/mimetype.cpp +++ b/src/msw/mimetype.cpp @@ -223,7 +223,7 @@ wxString wxFileTypeImpl::GetCommand(const wxChar *verb) const strKey << wxT("\\shell\\") << verb; wxRegKey key(wxRegKey::HKCR, strKey + _T("\\command")); wxString command; - if ( key.Open() ) { + if ( key.Open(wxRegKey::Read) ) { // it's the default value of the key if ( key.QueryValue(wxEmptyString, command) ) { bool foundFilename = CanonicalizeParams(command); @@ -233,7 +233,7 @@ wxString wxFileTypeImpl::GetCommand(const wxChar *verb) const // (and not just launch it) strKey += _T("\\DDEExec"); wxRegKey keyDDE(wxRegKey::HKCR, strKey); - if ( keyDDE.Open() ) { + if ( keyDDE.Open(wxRegKey::Read) ) { wxString ddeCommand, ddeServer, ddeTopic; keyDDE.QueryValue(wxEmptyString, ddeCommand); ddeCommand.Replace(_T("%1"), _T("%s")); @@ -323,7 +323,8 @@ bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const wxLogNull nolog; wxRegKey key(wxRegKey::HKCR, m_ext); - return key.Open() && key.QueryValue(wxT("Content Type"), *mimeType); + return key.Open(wxRegKey::Read) && + key.QueryValue(wxT("Content Type"), *mimeType); } bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const @@ -350,7 +351,7 @@ bool wxFileTypeImpl::GetIcon(wxIconLocation *iconLoc) const wxLogNull nolog; wxRegKey key(wxRegKey::HKCR, strIconKey); - if ( key.Open() ) { + if ( key.Open(wxRegKey::Read) ) { wxString strIcon; // it's the default value of the key if ( key.QueryValue(wxEmptyString, strIcon) ) { @@ -388,7 +389,7 @@ bool wxFileTypeImpl::GetDescription(wxString *desc) const wxLogNull nolog; wxRegKey key(wxRegKey::HKCR, m_strFileType); - if ( key.Open() ) { + if ( key.Open(wxRegKey::Read) ) { // it's the default value of the key if ( key.QueryValue(wxEmptyString, *desc) ) { return TRUE; @@ -425,7 +426,7 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext) wxString strFileType; wxRegKey key(wxRegKey::HKCR, str); - if ( key.Open() ) { + if ( key.Open(wxRegKey::Read) ) { // it's the default value of the key if ( key.QueryValue(wxEmptyString, strFileType) ) { // create the new wxFileType object @@ -474,7 +475,7 @@ wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType) wxString ext; wxRegKey key(wxRegKey::HKCR, strKey); - if ( key.Open() ) { + if ( key.Open(wxRegKey::Read) ) { if ( key.QueryValue(wxT("Extension"), ext) ) { return GetFileTypeFromExtension(ext); } -- 2.45.2