Error Reporting Services

Generally, an NP does not have to do anything to handle standard error codes, as MPR always calls SetLastError on behalf of the NP and keeps text descriptions for standard error codes. However the error reporting services are provided to allow an NP to customize error text for the error messages reported back to the user. When MPR is responding to an application issuing a WNet API request, and an NP calls one of these services, then MPR takes this to mean that the WNet request is known to be specifically for that network and will not try to satisfy the request with other networks. Consequently, these services must only be called when the NP really knows that it owns the request (for example: an NPAddConnection request with a valid server but invalid share name). Doing otherwise will cause incorrect failures when more than one network is running at the same time.

There are two services, NPSSetCustomText and NPSSetExtendedError. Calling either of these services will cause MPR to stop trying other NPs as it is taken that the network is responding to the request.

NPSSetExtendedError is used to generate errors that contain network specific error codes and an optional custom text message. It must be called before an NP returns ERROR_EXTENDED_ERROR, and its results may be obtained by an application calling WNetGetLastError. See the description of WNetGetLastError in the MPR document for more details.

NPSSetCustomText is used when returning a standard error code for which an NP has a more specific description of the error than is provided by the default message associated with the error code (again, for example: an NPAddConnection request with a valid server but invalid share name).