BUG: lstrcat, lstrcpy, and lstrcpyn Do Not Set Win32 Error Code on Failure

ID: Q207008


The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API), used with:
    • Microsoft Windows NT 4.0
    • Microsoft Windows 2000


SYMPTOMS

The GetLastError function returns 0 (zero) when lstrcat, lstrcpy, and lstrcpyn fail.


RESOLUTION

To work around this issue, applications that must run on Windows NT or Windows 2000 should perform error handling based on the return value of the lstrcat, lstrcpy, and lstrcpyn functions, but not on the result of GetLastError.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

The lstrcat, lstrcpy, and lstrcpyn functions should return NULL when they fail. In addition, these functions should set a Win32 error code to be returned by a call to the GetLastError function. Windows 95 and Windows 98 set the error code appropriately. However, Windows NT and Windows 2000 do not set the error code, and therefore GetLastError always returns 0 (ERROR_SUCCESS).

Additional query words:

Keywords : kbAPI kbKernBase kbNTOS400bug kbWinOS2000bug kbString kbDSupport kbGrpKernBase
Version : winnt:4.0
Platform : winnt
Issue type : kbbug


Last Reviewed: January 20, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.