ID: Q129544
1.20 1.25a 1.30 1.30a 1.30c WINDOWS kbprg kbprb
The information in this article applies to:
When CreateFile() is passed a filename string that contains an OEM character, the name of the file created is not as expected. In particular, a file created with CreateFile() cannot be opened with OpenFile() when OpenFile() is passed the same filename string.
For example, suppose that the ANSI filename string contains a lower-case e accent character (0x0e9). The file created by CreateFile() contains an upper-case E and the file created by OpenFile() contains an upper-case E accent character.
CreateFile() is implemented with calls to MS-DOS. MS-DOS converts the given file names to upper-case letters. OpenFile() is implemented with a thunk to the 16-bit Windows OpenFile(). OpenFile() converts the file name to upper-case before calling MS-DOS. The conversion that the 16-bit OpenFile() is doing is different from the conversion performed by MS-DOS for the OEM characters. The result is that different filenames are created for the same string passed to CreateFile() and OpenFile() if the name contains OEM characters.
To make the file name created by CreateFile() consistent with the file name created by OpenFile(), call AnsiUpper() on the file name string before calling CreateFile().
This behavior is by design and will not be changed in Win32s, because it may break existing Win32-based applications.
The 16-bit OpenFile() will fail to find an existing file if the file contains OEM characters but not an explicit full path. This also occurs with the 32-bit OpenFile(), because it is thunked to the 16-bit OpenFile().
SearchFile() will also fail to find files if the file name contains OEM characters or if the search path (lpszpath != NULL) contains OEM characters.
NOTE: In 16-bit Windows and Win32s 1.2 and earlier, OpenFile() returns the filename in OEM characters. However, the Win32 API documentation states that OpenFile() should return an ANSI string. Starting with the next version of Win32s, OpenFile() will return an ANSI string, as it does under Windows NT.
KBCategory: kbprg kbprb KBSubcategory: W32s Additional reference words: 1.20 1.25a 1.30 1.30a 1.30c
Keywords : kbWin32s
Version : 1.20 1.25a 1.30 1.30a 1.30c
Platform : WINDOWS
Last Reviewed: January 17, 1997