3.1.4.47 NetrShareDelEx (Opnum 57)

The NetrShareDelEx method deletes a share from the ShareList, which disconnects all connections to the shared resource. If the share is sticky, all information about the share is also deleted from permanent storage.<177>

 NET_API_STATUS NetrShareDelEx(
   [in, string, unique] SRVSVC_HANDLE ServerName,
   [in] DWORD Level,
   [in, switch_is(Level)] LPSHARE_INFO ShareInfo
 );

ServerName: An SRVSVC_HANDLE pointer that identifies the server. The client MUST map this structure to an RPC binding handle ([C706] sections 4.3.5 and 5.1.5.2). The server MUST ignore this parameter.

Level: Specifies the information level of the data. This parameter MUST be one of the following values.

Value

Meaning

503

LPSHARE_INFO_503_I

ShareInfo: This parameter is of type LPSHARE_INFO union, as specified in section 2.2.3.6. Its contents are determined by the value of the Level parameter, as shown in the preceding table. This parameter MUST NOT contain a null value.

Return Values: The method returns 0x00000000 (NERR_Success) to indicate success; otherwise, it returns a nonzero error code. The method can take any specific error code value, as specified in [MS-ERREF] section 2.2. The most common error codes are listed in the following table.

Return value/code

Description

0x00000000

NERR_Success

The client request succeeded.

0x00000005

ERROR_ACCESS_DENIED

Access is denied.

0x00000057

ERROR_INVALID_PARAMETER

The client request failed because the specified parameter is invalid.

0x00000008

ERROR_NOT_ENOUGH_MEMORY

Not enough storage is available to process this command.

0x00000906

NERR_NetNameNotFound

The share name does not exist.

0x0000007C

ERROR_INVALID_LEVEL

The system call level is not correct.

The ShareInfo.shi503_netname parameter specifies the name of the share to delete from the ShareList. This MUST be a nonempty null-terminated UTF-16 string; otherwise, the server MUST fail the call with an ERROR_INVALID_PARAMETER error code.

The server MUST provide tuple <ShareInfo.shi503_servername, ShareInfo.shi503_netname> to look up the Share as specified in section 3.1.6.1. If no match is found, the server MUST fail the call with a NERR_NetNameNotFound (0x00000906) error code. If the Share is found and Share.IsPrinterShare is TRUE, PrinterShareCount MUST be decreased by 1. If PrinterShareCount becomes 0, the server MUST invoke an event as specified in section 3.1.6.10, providing SV_TYPE_PRINTQ_SERVER as the input parameter. The server MUST remove the share entry from ShareList.

In response to a NetrShareDelEx message, the server MUST delete the Share by invoking the underlying server event as specified in [MS-CIFS] section 3.3.4.11 and [MS-SMB2] section 3.3.4.15, providing the tuple <ShareInfo.shi503_servername, ShareInfo.shi503_netname> as input parameters. If the event fails, the server MUST return an error code.

The server SHOULD<178> enforce security measures to verify that the caller has the required permissions to execute this routine. If the caller does not have the required credentials, the server SHOULD<179> fail the call.