Compartilhar via


3.2.4.2 Application Requests Connecting to a Share

The application provides the following:

  • ServerName: The name of the server to which to connect.

  • ShareName: The name of the share to which to connect.

  • UserCredentials: An opaque implementation-specific entity that identifies the credentials to be used when authenticating to the remote server.

  • IsDFSShare: A Boolean indicating whether this is a DFS share.

  • TransportIdentifier: An optional implementation-specific identifier for the transport on which the connection is to be established.

Upon successful completion, the client MUST return an existing or newly constructed Session (section 3.2.1.3), an existing or newly constructed TreeConnect (section 3.2.1.4), and the share type to the caller.

The client MUST follow the steps as described in the following flowchart. The request to connect to a server can be either explicit (for example, the application requests an SMB connection to \\server\share) or implicit (for example, the application requests to open the file \\server\share\file.txt, which implies that an SMB connection to \\server\share is being established). In either case, the following steps are followed. The only difference is that for the implicit case, the error returned in the failure case MUST be returned as the error of the operation that caused the implicit connect attempt.

Application that connects to a share on a server

Figure 6: Application that connects to a share on a server

To complete a successful share connect, the client MUST have an established SMB connection, an authenticated SMB session for the user initiating the call, and a tree connect to the target share.