Partager via


3.2.4.6 NetrWkstaTransportDel (Opnum 7)

The NetrWkstaTransportDel method disables the use of a transport protocol by the SMB network redirector on a remote computer. The transport can be re-enabled by calling the NetrWkstaTransportAdd method (section 3.2.4.5).

 unsigned long NetrWkstaTransportDel(
   [in, string, unique] WKSSVC_IDENTIFY_HANDLE ServerName,
   [in, string, unique] wchar_t* TransportName,
   [in] unsigned long ForceLevel
 );

ServerName: A WKSSVC_IDENTIFY_HANDLE structure (section 2.2.2.1) 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.

TransportName: A pointer to a string that specifies the name of the transport protocol to disconnect from the SMB network redirector.

ForceLevel: The action to take if there are handles open to files or printers using the transport protocol. This parameter MUST be one of the following values:

Value/code

Meaning

USE_NOFORCE

0x00000000

Do not disconnect or close the open handles if open handles are using the transport protocol.

USE_FORCE

0x00000001

Same as 0x00000000 (USE_NOFORCE); do not disconnect or close the open handles if open handles are using the transport protocol.

USE_LOTS_OF_FORCE

0x00000002

Forcefully close any open handles and disable the specified transport protocol from the SMB network redirector.

Return Values: When the message processing result meets the description in column two of the following table, this method MUST return one of the following values ([MS-ERREF] section 2.2).

Value/code

Meaning

NERR_Success

0x00000000

The operation completed successfully.

ERROR_ACCESS_DENIED

0x00000005

Access is denied.

ERROR_INVALID_PARAMETER

0x00000057

One of the function parameters is invalid.

ERROR_OPEN_FILES

0x00002401

There are open files, or printer handles are using the transport protocol pending on this connection.

ERROR_DEVICE_IN_USE

0x00002404

The device or open directory handle is using the transport protocol and cannot be disconnected.

If the ForceLevel parameter does not equal 0x00000000, 0x00000001, or 0x00000002, the server MUST fail the call with ERROR_INVALID_PARAMETER. If the ForceLevel parameter is 0x00000000 or 0x00000001 and any open directory handle is using the transport protocol provided in the TransportName field, the server MUST fail the call with ERROR_DEVICE_IN_USE. If the ForceLevel parameter is 0x00000000 or 0x00000001 and any open files or printer handles are using the transport protocol provided in the TransportName field, fail the call with ERROR_OPEN_FILES.

If the server does not support this method, it SHOULD<43> return NERR_Success if the ForceLevel parameter is valid. If the server does support this method, it MUST be processed as follows.

The server SHOULD<44> enforce security measures to verify that the caller has the required permissions to execute this routine. If the server enforces security measures and the caller does not have the required credentials, the server MUST fail the call with ERROR_ACCESS_DENIED. Specifications for determining the identity of the caller for the purpose of performing an access check are in ([MS-RPCE] section 3.3.3.1.3.

If any open file or printer handles are using the transport protocol that this call is trying to disable, the server behavior MUST depend on the value of the ForceLevel parameter. If the ForceLevel parameter is 0x00000000 or 0x00000001, the server MUST fail the call. If the ForceLevel parameter is 0x00000002, the server MUST forcefully close all open handles and disable the transport protocol.

If this method call is successful, the server MUST remove this protocol from its list of currently enabled transport protocols.