WNetGetLastError

Like GetLastError, this returns extended error information, which is maintained on a per-thread basis. Unlike GetLastError, this function can also return a string for reporting errors that are not described by any existing error code. It is primarily used for returning network vendor specific errors, and should be called when GetLastError returns WN_EXTENDED_ERROR. It returns error information associated with the last NP that reported an error.


DWORD WNetGetLastError (
    LPDWORD lpError,
    LPTSTR lpErrorBuf,
    DWORD nErrorBufSize,
    LPTSTR lpNameBuf,
    DWORD nNameBufSize
    );

lpError

Pointer to DWORD that will receive the error reported by the NP.

lpErrorBuf

Pointer to buffer that will receive a null terminated string describing the error.

nErrorBufSize

DWORD indicating the size of lpErrorBuf. If the buffer is too small to receive an error string, the string will simply be truncated (it is still guaranteed to be null terminated). A buffer of at least 256 bytes is recommended.

lpNameBuf

Pointer to buffer that will receive a null terminated string identifying the NP that raised the error.

nNameBufSize

DWORD indicating the size of lpNameBuf. If the buffer is too small to receive the name, the string will simply be truncated (it is still guaranteed to be null terminated).

WN_NO_ERROR

no error was previously reported by a network provider in this thread.

WN_BAD_POINTER

a pointer to a buffer or a buffersize is invalid.