1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS Kernel Streaming
4  * FILE:            drivers/wdm/audio/backpln/portcls/port.cpp
5  * PURPOSE:         Port construction API
6  * PROGRAMMER:      Johannes Anderwald
7  *                  Andrew Greenwood
8  */
9 
10 #include "private.hpp"
11 
12 #define NDEBUG
13 #include <debug.h>
14 
15 NTSTATUS
16 NTAPI
17 PcNewPort(
18     OUT PPORT* OutPort,
19     IN  REFCLSID ClassId)
20 {
21     NTSTATUS Status;
22     UNICODE_STRING GuidString;
23 
24     DPRINT("PcNewPort entered\n");
25 
26     PC_ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
27 
28     if (!OutPort)
29     {
30         DPRINT("PcNewPort was supplied a NULL OutPort parameter\n");
31         return STATUS_INVALID_PARAMETER;
32     }
33 
34     if (IsEqualGUIDAligned(ClassId, CLSID_PortMidi))
35         Status = NewPortDMus(OutPort);
36     else if (IsEqualGUIDAligned(ClassId, CLSID_PortDMus))
37         Status = NewPortDMus(OutPort);
38     else if (IsEqualGUIDAligned(ClassId, CLSID_PortTopology))
39         Status = NewPortTopology(OutPort);
40     else if (IsEqualGUIDAligned(ClassId, CLSID_PortWaveCyclic))
41         Status = NewPortWaveCyclic(OutPort);
42     else if (IsEqualGUIDAligned(ClassId, CLSID_PortWavePci))
43         Status = NewPortWavePci(OutPort);
44     else if (IsEqualGUIDAligned(ClassId, CLSID_PortWaveRT))
45         Status = NewPortWaveRT(OutPort);
46     else
47     {
48 
49         if (RtlStringFromGUID(ClassId, &GuidString) == STATUS_SUCCESS)
50         {
51             DPRINT("unknown interface %S\n", GuidString.Buffer);
52             RtlFreeUnicodeString(&GuidString);
53         }
54 
55         Status = STATUS_NOT_SUPPORTED;
56         return Status;
57      }
58     DPRINT("PcNewPort Status %lx\n", Status);
59 
60     return Status;
61 }
62