PRB: OpenFile API returns ERROR_BUFFER_OVERFLOW Error

Last reviewed: September 27, 1995
Article ID: Q137233
The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK) version 4.0

SYMPTOMS

If the OpenFile API is passed a path that is longer than MAXPATHNAME, OpenFile returns ERROR_BUFFER_OVERFLOW.

One of the parameters to OpenFile is a pointer to the pathname to open. Another parameter is a pointer to an OFSTRUCT structure that will receive information. OFSTRUCT contains a fixed size buffer, szPathName that holds MAXPATHNAME bytes. A path longer than that is not valid.

RESOLUTION

Consider using CreateFile instead of OpenFile.

STATUS

This behavior is by design.


Additional reference words: 4.00 Windows 95
KBCategory: kbprg kbprb
KBSubcategory: BseFileio


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: September 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.