MFC bug? The cause field is CFileException::none if path is invalid
- From: "Antti Nivala" <nivant@xxxxxxxxxxxxxxxx>
- Date: Thu, 1 Sep 2005 18:17:56 +0300
Based on a quick examination of MFC source codes during debugging a strange
behavior of our application I'd say that there's a bug in MFC's CFile::Open
method when using VS .NET 2003. I think the bug did not exist in VC++ 6.0.
If I try to open a file using CFile's Open method and pass it a path that
points to a nonexisting hard disk (e.g. "E:\Test\Test.txt" in my case since
I don't have an E drive), the exception object returned by CFile::Open has
its m_cause member set to CFileException::none. According to MSDN, this
should indicate that no error occurred, and MFC's own codes rely on this in
some places.
In VC++ 6.0, CFile::Open would have set m_cause to CFileException::badPath
in the same case.
Is this a known bug in MFC in VS .NET 2003?
Details:
The problem is in filecore.cpp, line 134:
if( AfxFullPath(szTemp, lpszFileName) == FALSE )
return FALSE;
Here, the code uses AfxFullPath to detect an invalid path and then returns
FALSE without touching the CFileException parameter.
Best regards,
Antti Nivala
.
- Follow-Ups:
- RE: MFC bug? The cause field is CFileException::none if path is invalid
- From: "Gary Chang[MSFT]"
- Re: MFC bug? The cause field is CFileException::none if path is invalid
- From: David Lowndes
- RE: MFC bug? The cause field is CFileException::none if path is invalid
- Prev by Date: Re: RealyREALYWindowFromPoint()
- Next by Date: Windows Docable
- Previous by thread: CString Problem
- Next by thread: Re: MFC bug? The cause field is CFileException::none if path is invalid
- Index(es):
Relevant Pages
|