You are currently offline, waiting for your internet to reconnect

INFO: WNetAddConnection2 and Multiple User Credentials

This article was previously published under Q183366
SUMMARY
The Windows 95 implementation of WNetAddConnection2 supports multiple setsof user credentials only if the underlying network provider is able providesuch support. The "Client for Microsoft Networks" provider is not designedto work with multiple sets of user credentials. This is a limitation of the"Client for Microsoft Networks" provider for Windows 95.

The "Microsoft Client for Netware Networks," included with Windows 95 is anexample of a provider that is able to support multiple sets of credentials.You can use the provider for Windows NT with multiple user credentials,although certain limitations still apply.
MORE INFORMATION
The behavioral difference of the API between the Client for MicrosoftNetworks on Windows 95 and Windows NT 4.0 is by design.

In Windows 95, the initial connection to a given server or its sharedresource has to be made using the interactive user's set of credentials,either by explicitly supplying it or by specifying NULL for lpPassword orlpUsername in the API (see online documentation). Otherwise, the functionfails with error 5 (ERROR_ACCESS_DENIED). Provided that such an initialconnection is successful, subsequent attempts to establish a connection toa shared resource on the server will ignore the supplied credentials andsucceed.

In Windows NT, on the other hand, you can use the API with multiple sets ofuser credentials. However, one major limitation applies, namely, thatconnections to a given server or its shared resources have to be madewithin the context of a single set of credentials. For an initialconnection, if you use NULL for lpPassword or lpUsername, the interactiveuser's credentials are used by default. If there has been a successfulinitial connection to the server, subsequent attempts to open a connectionusing a different set of credentials results in error 1219(ERROR_SESSION_CREDENTIAL_CONFLICT), which indicates a conflict between thesupplied set of credentials and the existing one. To establish a connectionusing a different set of credentials, first you have to cancel the existingconnections to the server using WNetCancelConnection2().
REFERENCES
For additional information, please see the following article in theMicrosoft Knowledge Base:
173011 HOWTO: Add and Remove Network Connections
Properties

Article ID: 183366 - Last Review: 11/21/2006 15:39:37 - Revision: 3.1

  • Microsoft Win32 Application Programming Interface
  • kbinfo kbwnet KB183366
Feedback
ipt>