MFC bug? The cause field is CFileException::none if path is invalid

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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


.



Relevant Pages

  • Bug Rep: Excel 2007 .xlsm file not saving commented codes
    ... since i've tested this agaist 2 different copies of Excel 2007 fresh install ... i think it's clearly a bug. ... go on any sheet that has codes in your ms vb window and just comment ... sub, and option explicit doesn't cut it either. ...
    (microsoft.public.excel)
  • Re: Char... Unicode version (bug?): what about 2.0?
    ... I'd like to submit what it seems to be a bug as for the Unicode ... For these codes I get the following ... > static private void DumpSingleChar ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Original Colors
    ... should be at least one hidden sqare inch of original color on your car, ... but the codes were used worldwide. ... 54 Bug ...
    (rec.autos.makers.vw.aircooled)
  • Re: Explorer Problems
    ... Spend some time making sense out of the bug check ... Start with "Interpreting Bug Check Codes" at ...
    (microsoft.public.win2000.new_user)