Microsoft KB Archive/281128

= PRB: StartDoc Fails Because the File Name Is Too Long =

Article ID: 281128

Article Last Modified on 2/12/2007

-

APPLIES TO

 Microsoft Platform Software Development Kit-January 2000 Edition, when used with:  Microsoft Windows 2000 Standard Edition

 Microsoft Windows NT 4.0

 Microsoft Windows XP Professional  Microsoft Windows XP Professional for Itanium-based systems</li></ul>

-

<div class="notice_section">

This article was previously published under Q281128

<div class="symptoms_section">

SYMPTOMS
The function StartDoc fails and the function GetLastError returns ERROR_FILENAME_EXCED_RANGE. This error is returned when the document name string that is passed to the StartDoc function is too long.

<div class="cause_section">

CAUSE
When applications print they typically call the StartDoc function to indicate the start of the print job. This function takes a parameter of the structure type DOCINFO that has structure members to describe the print job.

The members of the DOCINFO structure can be the cause of a StartDoc function call failure if they are improperly initialized. This article describes the case in which the StartDoc function fails and the error returned by the GetLastError function is &quot;ERROR_FILENAME_EXCED_RANGE&quot; (decimal value 206).

This error value is returned because the operating system has found a string member of the DOCINFO structure to be too long. The StartDoc function validates its parameters by checking that the length of the lpszDocName and the lpszOutput members of the DOCINFO structure are less than MAX_PATH.

<div class="resolution_section">

RESOLUTION
To avoid the failure of the StartDoc function call in this case, ensure that all strings assigned to the DOCINFO structure have character counts (string lengths) that are less than MAX_PATH. MAX_PATH is currently defined in the Platform SDK header file Windef.h.

Keywords: kbdswgdi2003swept kbgdi kbpending kbprb kbprint kbspooler KB281128

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.