3.2 Example 2: Deleting an SMB Share

This example demonstrates the use cases described in section 2.5.1.4.

The sequence in this example describes how the application deletes an SMB share from a given server.

Prerequisites

  • The admin tool has acquired an RPC calling context.

Initial System State

None.

Final System State

The specified share is removed from the list of shares that are available from that server.

The following sequence diagram shows the steps to delete an SMB share.

Sequence diagram for deleting an SMB share

Figure 12: Sequence diagram for deleting an SMB share

Sequence of Events

  1. The admin client calls the NetrShareGetInfo method ([MS-SRVS] section 3.1.4.10). It specifies the share name and server name to check if the share exists.

  2. The SMB File Service returns ERROR_SUCCESS to confirm that the share exists.

  3. The admin client calls the NetrConnectionEnum method ([MS-SRVS] section 3.1.4.1) to check if the share is currently accessed.

  4. The SMB File Service returns a success code with TotalEntries as 0 to indicate that the share is not currently accessed.

  5. The admin client calls the NetrShareDel method ([MS-SRVS] section 3.1.4.12) after checking that the share is not in use.

  6. The SMB File Service removes the share name from the share list and returns a success code to the admin client.

    In Windows-based implementations, the Shared Folders snap-in is used as the admin tool to centrally manage file shares on a computer. The Shared Folders snap-in calls the NetrShareEnum method ([MS-SRVS] section 3.1.4.8) to enumerate the share entries in the ShareList.