AddPortEx

BOOL (WINAPI *pfnAddPortEx)(

LPWSTR pName,
DWORD Level,
LPBYTE lpBuffer,
LPWSTR lpMonitorName
);

AddPortEx creates a port and adds it to the list of ports currently supported by the specified monitor in the spooler environment.

Parameters

pName

Points to a zero-terminated string that specifies the name of the server to which the port is connected. If pName is null, the port is local.

Level

Specifies the type of data in the buffer to which lpBuffer points.

lpBuffer

Points to a buffer containing the structure that identifies the name of the port to be added.

lpMonitorName

Points to a zero-terminated string that specifies the monitor associated with the port.

Return Value

The return value is TRUE if the function is successful.

Comments

The spooler calls AddPortEx when it receives an application's Win32 AddPortEx request to add a port to its environment. The spooler forwards the call to the named monitor on the named server.

AddPortEx allows the spooler to request that a port be added noninteractively; that is, without the dialog box required by AddPort.

The spooler does not support remote AddPortEx calls. Consequently, AddPortEx implementations can ignore the pName and lpMonitorName parameters.

Possible values for Level and the corresponding structure to which lpBuffer points are shown in the following table:

Level Structure to which lpBuffer points
1 PORT_INFO_1
2 PORT_INFO_2

AddPortEx should log an ERROR_INVALID_LEVEL error code and then fail if it does not support the specified level. The PORT_INFO_1 and PORT_INFO_2 structures are described in the Win32 SDK.

AddPortEx should validate the supplied port name by calling the Win32 EnumPorts function to ensure that no duplicate port names are added to the spooler environment. A monitor should also verify that the port is one that it supports.

AddPortEx is a port management function that must be implemented by port monitors and LMPMs. Pure language monitors should not implement this function.

See Also

AddPort, DeletePort