OleCreateFromFile() Does Not Check for Reserved Names (111015)
The information in this article applies to:
- Microsoft OLE Libraries for Windows and Win32s 2.01
This article was previously published under Q111015
Before an OLE 2.0 container application calls OleCreateFromFile() to create
an embedded object from the contents of a named file, it must make sure
that the filename it passes as the lpszFile parameter to
OleCreateFromFile() is not a reserved MS-DOS device name, such as COM1 or
LPT1. This check is necessary because OleCreateFromFile() does not perform
such a check itself.
A container application generally obtains the filename to pass to
OleCreateFromFile() by presenting the user with the Insert Object dialog
box. Many containers use the OLE2UI library implementation of the Insert
Object dialog box, by calling OleUIInsertObject(). OleUIInsertObject()
performs a check to make sure that the filename supplied by the user is not
a reserved MS-DOS device name; if the user supplies a filename such as
"COM1", OleUIInsertObject() brings up a modal dialog box stating "File COM1
Does Not Exist."
Therefore, container applications that use OleUIInsertObject() do not have
to perform a check for reserved names.
Modification Type: | Minor | Last Reviewed: | 3/3/2005 |
---|
Keywords: | KB111015 |
---|
|