1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS Kernel Streaming
4  * FILE:            drivers/wdm/audio/backpln/portcls/miniport.cpp
5  * PURPOSE:         Miniport construction api
6  * PROGRAMMER:      Andrew Greenwood
7  */
8 
9 #include "private.hpp"
10 
11 #define NDEBUG
12 #include <debug.h>
13 
14 PVOID
15 __cdecl
16 operator new(
17     size_t Size,
18     POOL_TYPE PoolType,
19     ULONG Tag)
20 {
21     PVOID P = ExAllocatePoolWithTag(PoolType, Size, Tag);
22     if (P)
23         RtlZeroMemory(P, Size);
24     return P;
25 }
26 
27 void
28 __cdecl
29 operator delete(
30     PVOID ptr)
31 {
32     ExFreePool(ptr);
33 }
34 
35 void
36 __cdecl
37 operator delete(
38     PVOID ptr, UINT_PTR)
39 {
40     ExFreePool(ptr);
41 }
42 
43 NTSTATUS
44 NTAPI
45 PcNewMiniport(
46     OUT PMINIPORT* OutMiniport,
47     IN  REFCLSID ClassId)
48 {
49     NTSTATUS Status = STATUS_INVALID_PARAMETER;
50 
51     DPRINT("PcNewMiniport entered\n");
52     PC_ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
53 
54     if (!OutMiniport)
55     {
56         DPRINT("PcNewMiniport was supplied a NULL OutPort parameter\n");
57         return STATUS_INVALID_PARAMETER;
58     }
59 
60     if (IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverDMusUART) ||
61         IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverUart) ||
62         IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverDMusUARTCapture))
63     {
64         Status = NewMiniportDMusUART(OutMiniport, ClassId);
65     }
66     else if (IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverFmSynth) ||
67              IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverFmSynthWithVol))
68     {
69         Status = NewMiniportFmSynth(OutMiniport, ClassId);
70     }
71     else
72     {
73         Status = STATUS_INVALID_PARAMETER;
74     }
75 
76     DPRINT("PcNewMiniport Status %x\n", Status);
77     return Status;
78 }
79