From e1b09f3b5d064f694307b399eaa98c9f34252116 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 19 Oct 2014 14:16:22 +0000 Subject: [PATCH] Avoid spurious errors from wxFileType::GetCommand() under Windows XP too. This problem was already fixed in r77649 for Windows 7 (and hopefully all the other supported Windows versions), but it turns out that XP returns a different error when the association is not found in the registry, so the debug error message was still given under it. Fix this by checking for both ERROR_NO_ASSOCIATION and ERROR_FILE_NOT_FOUND. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/mimetype.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/msw/mimetype.cpp b/src/msw/mimetype.cpp index 21cabbda6f..a8b9c2882f 100644 --- a/src/msw/mimetype.cpp +++ b/src/msw/mimetype.cpp @@ -267,9 +267,15 @@ wxString wxAssocQueryString(ASSOCSTR assoc, if ( hr != S_OK ) { // The only really expected error here is that no association is - // defined, anything else is not expected. - if ( hr != HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) ) + // defined, anything else is not expected. The confusing thing is that + // different errors are returned for this expected error under + // different Windows versions: XP returns ERROR_FILE_NOT_FOUND while 7 + // returns ERROR_NO_ASSOCIATION. Just check for both to be sure. + if ( hr != HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) && + hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ) + { wxLogApiError("AssocQueryString", hr); + } return wxString(); }