3.1.4.6.4 RpcSetPort (Opnum 71)

RpcSetPort sets the status associated with a printer port.<361>

 DWORD RpcSetPort(
   [in, string, unique] STRING_HANDLE pName,
   [in, string, unique] wchar_t* pPortName,
   [in] PORT_CONTAINER* pPortContainer
 );

pName: A parameter that adheres to the specification in Print Server Name Parameters (section 3.1.4.1.4).

pPortName: A pointer to a string that specifies the name of the printer port. For rules governing port names, see section 2.2.4.10.

pPortContainer: A parameter that adheres to the specification in PORT_CONTAINER Parameters (section 3.1.4.1.8.5). The level as specified in the Level member of the PORT_CONTAINER structure MUST be 0x00000003.

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:

  • Verify that the string that is referenced by pPortName represents a port installed on the server, and if validation fails, the server MUST fail the operation immediately and return ERROR_UNKNOWN_PORT.

  • Perform the validation steps that are specified in Print Server Name Parameters.

  • Perform the validation steps that are specified in PORT_CONTAINER Parameters.

  • Additional validation MAY<362> 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:

  • The pPortContainer parameter points to a PORT_CONTAINER structure. This structure references a PORT_INFO structure that contains members dwStatus, pszStatus, and dwSeverity. Copy these members to the port object that is referenced by the pPortName parameter.

  • Return the status of the operation.