Microsoft KB Archive/111015

From BetaArchive Wiki
Knowledge Base


OleCreateFromFile() Does Not Check for Reserved Names

Article ID: 111015

Article Last Modified on 3/3/2005



APPLIES TO

  • Microsoft OLE 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.


Additional query words: 2.01

Keywords: KB111015