ID: Q183344
The information in this article applies to:
- Microsoft Windows 95
In Windows 95, if you run a Win32 program, change the process directory to the parent or some other ancestor directory, and then use OpenFile() to open a file in the original process directory using a minimum relative path, it will always fail with ERROR_FILE_NOT_FOUND.
On Win32 platforms, you need to use CreateFile() to open a file. If you are using OpenFile() for cross-platform compatibility, the function should be supplied with a full path or a better qualified path (that is, one that begins with a period).
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.
Write a Win32 program that will run from C:\Temp\Debug. The program should call SetCurrentDirectory("C:\\Temp"). Then, the program should try to open a file in the original process directory using a minimum relative path as follows:
OpenFile( "DEBUG\\TEST.TXT", ... )
This call fails with ERROR_FILE_NOT_FOUND. A call to GetCurrentDirectory()
correctly returns C:\Temp.
The error only occurs with the minimum relative path shown above. The error does not occur if you use a full path in the OpenFile() call or if you use a better qualified path:
OpenFile( ".\\DEBUG\\TEST.TXT", ... )
Keywords : kbAPI kbKernBase kbGrpKernBase
Version : Win95
Platform : Win95
Issue type : kbbug
Solution Type : kbnofix
Last Reviewed: April 3, 1998