Previous Next

PcNewPort

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

PORTCLASSAPI NTSTATUS NTAPI
  PcNewPort(
    OUT PPORT  *OutPort,
    IN REFCLSID  ClassId
    );

Parameters

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.
ClassId
Specifies the type of port interface that is being requested. See the following Comments section.

Return Value

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

Headers

Declared in portcls.h. Include portcls.h.

Comments

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_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.

See Subdevice Creation for more information on creating port and miniport drivers for subdevices.

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

See Also

IPort, IPortDMus, IPortMidi, IPortTopology, IPortWaveCyclic, IPortWavePci