NetShareDelEx function (lmshare.h)

Deletes a share name from a server's list of shared resources, which disconnects all connections to that share. This function, which is an extended version of the NetShareDel function, allows the caller to specify a SHARE_INFO_0, SHARE_INFO_1, SHARE_INFO_2, SHARE_INFO_502, or SHARE_INFO_503 structure.

Syntax

NET_API_STATUS NET_API_FUNCTION NetShareDelEx(
  [in] LMSTR  servername,
  [in] DWORD  level,
  [in] LPBYTE buf
);

Parameters

[in] servername

Pointer to a string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is NULL, the local computer is used.

This string is Unicode if _WIN32_WINNT or FORCE_UNICODE is defined.

[in] level

Specifies the information level of the data. This parameter can be one of the following values.

Value Meaning
0, 1, 2, or 502
Specifies information about the shared resource, including the name of the resource, type and permissions, and number of connections. The buf parameter points to a SHARE_INFO_0, SHARE_INFO_1, SHARE_INFO_2, or SHARE_INFO_502 structure.
503
Specifies information about the shared resource, including the name of the resource, type and permissions, number of connections, and other pertinent information. The buf parameter points to a SHARE_INFO_503 structure.

[in] buf

Pointer to the buffer that specifies the data. The format of this data depends on the value of the level parameter. For more information, see Network Management Function Buffers.

Return value

If the function succeeds, the return value is NERR_Success.

If the function fails, the return value can be one of the following error codes.

Return code Description
ERROR_INTERNAL_ERROR
An internal error occurred.
ERROR_INVALID_LEVEL
The value specified for the level parameter is not valid.
ERROR_NOT_SUPPORTED
The request is not supported.

Remarks

If 503 is specified for the level parameter, the buf parameter points to a SHARE_INFO_503 structure, and the shi503_netname and shi503_servername members of that structure are used to look up the shared resource on the server; the other members are ignored. The remote server specified in the shi503_servername member must have been bound to a transport protocol using the NetServerTransportAddEx function. In the call to NetServerTransportAddEx, either 2 or 3 must have been specified for the level parameter, and the SVTI2_SCOPED_NAME flag must have been specified in the SERVER_TRANSPORT_INFO_2 structure for the transport protocol.

If 0, 1, 2, or 502 is specified for the level parameter, the buf parameter points to a SHARE_INFO_0, SHARE_INFO_1, SHARE_INFO_2, or SHARE_INFO_502 structure, and the shi0_netname, shi1_netname, shi2_netname, or shi502_netname member of that structure is used; the other members are ignored.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header lmshare.h (include Lm.h)
Library Netapi32.lib
DLL Netapi32.dll

See also

NetServerTransportAddEx

NetShareAdd

NetShareDel

Network Management Functions

Network Management Overview

Network Share Functions

SHARE_INFO_0

SHARE_INFO_1

SHARE_INFO_2

SHARE_INFO_502

SHARE_INFO_503