Export (0) Print
Expand All
Expand Minimize

WNetSetLastError function

Sets extended error information. Network providers should call this function instead of SetLastError.

When necessary, the Multiple Provider Router (MPR) calls SetLastError to set the Windows error returned from a network provider.

Syntax


void WNetSetLastError(
  _In_  DWORD err,
  _In_  LPTSTR lpError,
  _In_  LPTSTR lpProvider
);

Parameters

err [in]

The error that occurred. This is a network-specific error code.

lpError [in]

String that describes the network-specific error.

lpProvider [in]

String that names the network provider that raised the error.

Return value

This function does not return a value.

Remarks

This function is implemented by the Windows operating system and can be called by network providers.

A provider should use this function to report errors that contain provider-specific information. The error information is saved until it is overwritten by another call to WNetSetLastError in the same thread.

The recommended way for a provider function to handle general errors is to use the following statement.


return(providerError);


In this statement, providerError is a Windows error code, such as one of the return codes listed for the provider API in this document.

For provider-specific errors, a provider should do the following.


//  Set up lpErrorString to be the error to be reported.
WNetSetLastError(providerError,
lpErrorString,
lpProviderName) ;
return(ERROR_EXTENDED_ERROR) ;


In this case, providerError is the provider-specific error code.

Providers do not need to call SetLastError before returning from a provider function. The MPR calls SetLastError to set the Windows error returned from a provider when necessary to satisfy applications.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Npapi.h

Library

Mpr.lib

DLL

Mpr.dll

Unicode and ANSI names

WNetSetLastErrorA (ANSI)

 

 

Community Additions

ADD
Show:
© 2014 Microsoft