RpcAddPortEx adds a port name to the list of supported ports.<359>

 DWORD RpcAddPortEx(
   [in, string, unique] STRING_HANDLE pName,
   [in] PORT_CONTAINER* pPortContainer,
   [in] PORT_VAR_CONTAINER* pPortVarContainer,
   [in, string] wchar_t* pMonitorName
 );

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

pPortContainer: A parameter specified in PORT_CONTAINER Parameters (section 3.1.4.1.8.5). The value of the Level member in the PORT_CONTAINER that is referenced by this parameter MUST be 0x00000001 or 0xFFFFFFFF.

pPortVarContainer: A pointer to a PORT_VAR_CONTAINER (section 2.2.1.2.8) information structure that contains information about the port.

pMonitorName: A pointer to a string that specifies the monitor associated with the port. For rules governing monitor names, see section 2.2.4.8.

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:

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: