Platform SDK: Windows Networking |
The WNetGetLastError function retrieves the most recent extended error code set by a WNet function. The network provider reported this error code; it will not generally be one of the errors included in the SDK header file WinError.h.
DWORD WNetGetLastError( LPDWORD lpError, // error code LPTSTR lpErrorBuf, // error description buffer DWORD nErrorBufSize, // size of description buffer LPTSTR lpNameBuf, // buffer for provider name DWORD nNameBufSize // size of provider name buffer );
If the function succeeds, and it obtains the last error that the network provider reported, the return value is NO_ERROR.
If the caller supplies an invalid buffer, the return value is ERROR_INVALID_ADDRESS.
The WNetGetLastError function retrieves errors that are specific to a network provider. You can call WNetGetLastError when a WNet function returns ERROR_EXTENDED_ERROR.
Like the GetLastError function, WNetGetLastError returns extended error information, which is maintained on a per-thread basis. Unlike GetLastError, the WNetGetLastError function can return a string for reporting errors that are not described by any existing error code in WinError.h.
For more information about using an application-defined error handler that calls the WNetGetLastError function, see Retrieving Network Errors.
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winnetwk.h.
Library: Use Mpr.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.
Windows Networking (WNet) Overview, Windows Networking Functions