3.1.4.6.1 RpcEnumPorts (Opnum 35)

RpcEnumPorts enumerates the ports that are available for printing on a specified server.

 DWORD RpcEnumPorts(
   [in, string, unique] STRING_HANDLE pName,
   [in] DWORD Level,
   [in, out, unique, size_is(cbBuf), disable_consistency_check] 
     BYTE* pPort,
   [in] DWORD cbBuf,
   [out] DWORD* pcbNeeded,
   [out] DWORD* pcReturned
 );

pName: A parameter specified in Print Server Name Parameters, section 3.1.4.1.4.

Level: The port information level.

Value

Description

0x00000001

Corresponds to _PORT_INFO_1 (section 2.2.2.8.1).

0x00000002

Corresponds to _PORT_INFO_2 (section 2.2.2.8.2).

pPort: A pointer to the BUFFER, as specified in INFO Structures Query Parameters, section 3.1.4.1.9.

BUFFER TYPE: _PORT_INFO.

This parameter can be NULL if cbBuf equals zero.

cbBuf: A parameter specified in INFO Structures Query Parameters.

pcbNeeded: A parameter specified in INFO Structures Query Parameters.

pcReturned: A parameter specified in INFO Structures Query Parameters.

Return Values: This method MUST return zero (ERROR_SUCCESS) to indicate successful completion or a nonzero Windows error code to indicate failure [MS-ERREF].

Upon receiving this message, the server MUST validate parameters as follows:

  • Perform the validation steps specified in Print Server Name Parameters, section 3.1.4.1.4.

  • Perform the validation steps specified in INFO Structures Query Parameters, section 3.1.4.1.9.

  • Additional validation MAY<356> be performed.

If parameter validation fails, the server MUST fail the operation immediately and return a nonzero error response to the client. Otherwise, the server MUST process the message and compose a response to the client as follows:

  • Enumerate all ports on the print server.

  • Using the enumerated objects, perform the processing and response steps specified in INFO Structures Query Parameters, section 3.1.4.1.9.

  • Return the status of the operation.