Microsoft KB Archive/183366

From BetaArchive Wiki

INFO: WNetAddConnection2 and Multiple User Credentials

Q183366



The information in this article applies to:


  • Microsoft Win32 Application Programming Interface (API), included with:
    • Microsoft Windows 95
    • the operating system: Microsoft Windows NT 4.0





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.



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().



REFERENCES

For additional information, please see the following article in the Microsoft Knowledge Base:

Q173011 HOWTO: Add and Remove Network Connections

Additional query words:

Keywords : kbWNet
Issue type : kbinfo
Technology : kbAudDeveloper kbWin32sSearch kbWin32API


Last Reviewed: December 16, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.