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 #ifndef YDEBUG
13 #define NDEBUG
14 #endif
15 
16 #include <debug.h>
17 
18 NTSTATUS
19 NTAPI
20 PcNewPort(
21     OUT PPORT* OutPort,
22     IN  REFCLSID ClassId)
23 {
24     NTSTATUS Status;
25     UNICODE_STRING GuidString;
26 
27     DPRINT("PcNewPort entered\n");
28 
29     PC_ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
30 
31     if (!OutPort)
32     {
33         DPRINT("PcNewPort was supplied a NULL OutPort parameter\n");
34         return STATUS_INVALID_PARAMETER;
35     }
36 
37     if (IsEqualGUIDAligned(ClassId, CLSID_PortMidi))
38         Status = NewPortDMus(OutPort);
39     else if (IsEqualGUIDAligned(ClassId, CLSID_PortDMus))
40         Status = NewPortDMus(OutPort);
41     else if (IsEqualGUIDAligned(ClassId, CLSID_PortTopology))
42         Status = NewPortTopology(OutPort);
43     else if (IsEqualGUIDAligned(ClassId, CLSID_PortWaveCyclic))
44         Status = NewPortWaveCyclic(OutPort);
45     else if (IsEqualGUIDAligned(ClassId, CLSID_PortWavePci))
46         Status = NewPortWavePci(OutPort);
47     else if (IsEqualGUIDAligned(ClassId, CLSID_PortWaveRT))
48         Status = NewPortWaveRT(OutPort);
49     else
50     {
51 
52         if (RtlStringFromGUID(ClassId, &GuidString) == STATUS_SUCCESS)
53         {
54             DPRINT("unknown interface %S\n", GuidString.Buffer);
55             RtlFreeUnicodeString(&GuidString);
56         }
57 
58         Status = STATUS_NOT_SUPPORTED;
59         return Status;
60      }
61     DPRINT("PcNewPort Status %lx\n", Status);
62 
63     return Status;
64 }
65