BUG: lstrcat, lstrcpy, and lstrcpyn Do Not Set Win32 Error Code on Failure (207008)
The information in this article applies to:
- Microsoft Win32 Application Programming Interface (API), when used with:
- the operating system: Microsoft Windows NT 4.0
- the operating system: Microsoft Windows 2000
- the operating system: Microsoft Windows XP
This article was previously published under Q207008 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.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are 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).
Modification Type: | Major | Last Reviewed: | 12/17/2003 |
---|
Keywords: | kbAPI kbBug kbKernBase kbpending kbString KB207008 |
---|
|