PcNewPort function (portcls.h)

The PcNewPort function creates a new system-supplied port-driver object, whose interface (derived from base class IPort) is specified by a class ID.

Syntax

PORTCLASSAPI NTSTATUS PcNewPort(
  [out] PPORT    *OutPort,
  [in]  REFCLSID ClassID
);

Parameters

[out] OutPort

Output pointer for the port-driver object created by this function. This parameter points to a caller-allocated pointer variable into which the function outputs the pointer to the newly created IPort object. This object has the port interface that is specified by the ClassId parameter. Specify a valid, non-NULL pointer value for this parameter.

[in] ClassID

Specifies the type of port interface that is being requested. For more information, see the following Remarks section.

Return value

PcNewPort returns STATUS_SUCCESS if the call was successful. Otherwise, it returns an appropriate error code.

Remarks

The ClassId parameter can be set to one of the GUIDs in the following table.

Class GUID Port Interface Name
CLSID_PortDMus

IPortDMus

CLSID_PortMidi

IPortMidi

CLSID_PortTopology

IPortTopology

CLSID_PortWaveCyclic

IPortWaveCyclic

CLSID_PortWavePci

IPortWavePci

CLSID_PortWaveRT

IPortWaveRT

 

CLSID_PortDMus is defined in header file dmusicks.h. The other four GUIDs in the preceding table are defined in portcls.h.

In Microsoft Windows XP and later, the MIDI and DirectMusic port drivers share the same internal software implementation. This means that the CLSID_PortMidi GUID is equivalent to CLSID_PortDMus.

For more information about creating port and miniport drivers for subdevices, see Subdevice Creation.

The OutPort parameter follows the reference-counting conventions for COM objects.

Requirements

Requirement Value
Minimum supported client The PortCls system driver implements the PcNewPort function in Microsoft Windows 98/Me and in Windows 2000 and later operating systems.
Target Platform Universal
Header portcls.h (include Portcls.h)
Library Portcls.lib
IRQL PASSIVE_LEVEL

See also

IPort

IPortDMus

IPortMidi

IPortTopology

IPortWaveCyclic

IPortWavePci

IPortWaveRT