Partager via


3.1.4.13 NetrShareDelSticky (Opnum 19)

The NetrShareDelSticky method marks the share as nonpersistent by clearing the IsPersistent member of a Share in the ShareList.

 NET_API_STATUS NetrShareDelSticky(
   [in, string, unique] SRVSVC_HANDLE ServerName,
   [in, string] WCHAR* NetName,
   [in] DWORD Reserved
 );

ServerName: An SRVSVC_HANDLE (section 2.2.1.1) 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). If this parameter is NULL, the local computer is used.

NetName: A pointer to a null-terminated UTF-16 string that specifies the name of the share to delete.

Reserved: The server MUST ignore this parameter.<72>

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 primary use of this method is to delete a sticky share whose root directory has been deleted (thus preventing actual re-creation of the share) but whose entry still exists in permanent storage.<73> This method can also be used to remove the persistence of a share without deleting the current incarnation of the share.

If ServerName does not match any Transport.ServerName in TransportList with the SVTI2_SCOPED_NAME bit set in Transport.Flags, the server MUST reset ServerName as "*".

The server MUST remove any preceding "\\" from the ServerName parameter and normalize the ServerName parameter as specified in section 3.1.6.8, passing in the updated ServerName parameter as the ServerName, and an empty string as the ShareName.

The NetName parameter specifies the name of the share to delete. 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 search through ShareList and locate a Share where Share.ShareName matches NetName, Share.ServerName matches ServerName, and  Share.IsPersistent is TRUE. If a match is not found, the server MUST fail the call with an NERR_NetNameNotFound error code.

If a match is found, the server MUST make the share nonpersistent by setting Share.IsPersistent to FALSE and the server MUST delete the share entry from permanent storage.

The server SHOULD<74> 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<75> fail the call.