Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

INFO: WNetAddConnection2 and Multiple User Credentials


View products that this article applies to.

Summary

The Windows 95 implementation of WNetAddConnection2 supports multiple sets of user credentials only if the underlying network provider is able provide such support. The "Client for Microsoft Networks" provider is not designed to 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 an example 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.

↑ Back to the top


More information

The behavioral difference of the API between the Client for Microsoft Networks on Windows 95 and Windows NT 4.0 is by design.

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

In Windows NT, on the other hand, you can use the API with multiple sets of user credentials. However, one major limitation applies, namely, that connections to a given server or its shared resources have to be made within the context of a single set of credentials. For an initial connection, if you use NULL for lpPassword or lpUsername, the interactive user's credentials are used by default. If there has been a successful initial connection to the server, subsequent attempts to open a connection using a different set of credentials results in error 1219 (ERROR_SESSION_CREDENTIAL_CONFLICT), which indicates a conflict between the supplied set of credentials and the existing one. To establish a connection using a different set of credentials, first you have to cancel the existing connections to the server using WNetCancelConnection2().

↑ Back to the top


References

For additional information, please see the following article in the Microsoft Knowledge Base:
173011 HOWTO: Add and Remove Network Connections

↑ Back to the top


Keywords: kbinfo, kbwnet, KB183366

↑ Back to the top

Article Info
Article ID : 183366
Revision : 4
Created on : 11/21/2006
Published on : 11/21/2006
Exists online : False
Views : 345