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 #ifndef YDEBUG
12 #define NDEBUG
13 #endif
14 
15 #include <debug.h>
16 
17 PVOID
18 __cdecl
19 operator new(
20     size_t Size,
21     POOL_TYPE PoolType,
22     ULONG Tag)
23 {
24     PVOID P = ExAllocatePoolWithTag(PoolType, Size, Tag);
25     if (P)
26         RtlZeroMemory(P, Size);
27     return P;
28 }
29 
30 void
31 __cdecl
32 operator delete(
33     PVOID ptr)
34 {
35     ExFreePool(ptr);
36 }
37 
38 void
39 __cdecl
40 operator delete(
41     PVOID ptr, UINT_PTR)
42 {
43     ExFreePool(ptr);
44 }
45 
46 NTSTATUS
47 NTAPI
48 PcNewMiniport(
49     OUT PMINIPORT* OutMiniport,
50     IN  REFCLSID ClassId)
51 {
52     NTSTATUS Status = STATUS_INVALID_PARAMETER;
53 
54     DPRINT("PcNewMiniport entered\n");
55     PC_ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
56 
57     if (!OutMiniport)
58     {
59         DPRINT("PcNewMiniport was supplied a NULL OutPort parameter\n");
60         return STATUS_INVALID_PARAMETER;
61     }
62 
63     if (IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverDMusUART) ||
64         IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverUart) ||
65         IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverDMusUARTCapture))
66     {
67         Status = NewMiniportDMusUART(OutMiniport, ClassId);
68     }
69     else if (IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverFmSynth) ||
70              IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverFmSynthWithVol))
71     {
72         Status = NewMiniportFmSynth(OutMiniport, ClassId);
73     }
74     else
75     {
76         Status = STATUS_INVALID_PARAMETER;
77     }
78 
79     DPRINT("PcNewMiniport Status %x\n", Status);
80     return Status;
81 }
82 
83