OleCreateFromFile() Does Not Check for Reserved Names

Last reviewed: April 21, 1995
Article ID: Q111015
The information in this article applies to:
  • Microsoft OLE Libraries for Windows and Win32s, version 2.01

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.


Additional reference words: 2.01
KBCategory: kbole
KBSubcategory: LeTwoCdt


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.