ReactOS  0.4.13-dev-464-g6b95727
drm_port.cpp
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Kernel Streaming
4  * FILE: drivers/wdm/audio/backpln/portcls/drm_port.cpp
5  * PURPOSE: portcls drm port object
6  * PROGRAMMER: Johannes Anderwald
7  */
8 
9 #include "private.hpp"
10 
11 #ifndef YDEBUG
12 #define NDEBUG
13 #endif
14 
15 #include <debug.h>
16 
17 class CDrmPort2 : public IDrmPort2
18 {
19 public:
21 
23  {
25  return m_Ref;
26  }
28  {
30 
31  if (!m_Ref)
32  {
33  delete this;
34  return 0;
35  }
36  return m_Ref;
37  }
39  CDrmPort2(IUnknown *OuterUnknown){}
40  virtual ~CDrmPort2(){}
41 
42 protected:
44 
45 };
46 
48 NTAPI
50  IN REFIID refiid,
51  OUT PVOID* Output)
52 {
54 
55  if (IsEqualGUIDAligned(refiid, IID_IDrmPort) ||
56  IsEqualGUIDAligned(refiid, IID_IDrmPort2) ||
58  {
59  *Output = PVOID(PUNKNOWN(this));
60  PUNKNOWN(*Output)->AddRef();
61  return STATUS_SUCCESS;
62  }
63 
65  {
66  DPRINT("IDrmPort2_QueryInterface no interface!!! iface %S\n", GuidString.Buffer);
68  }
69  return STATUS_UNSUCCESSFUL;
70 }
71 
73 NTAPI
74 CDrmPort2::CreateContentMixed(
75  IN PULONG paContentId,
78 {
80  return DrmCreateContentMixed(paContentId, cContentId, pMixedContentId);
81 }
82 
84 NTAPI
85 CDrmPort2::DestroyContent(
86  IN ULONG ContentId)
87 {
89  return DrmDestroyContent(ContentId);
90 }
91 
93 NTAPI
94 CDrmPort2::ForwardContentToFileObject(
95  IN ULONG ContentId,
97 {
98  return DrmForwardContentToFileObject(ContentId, FileObject);
99 }
100 
101 NTSTATUS
102 NTAPI
103 CDrmPort2::ForwardContentToInterface(
104  IN ULONG ContentId,
107 {
110 }
111 
112 NTSTATUS
113 NTAPI
114 CDrmPort2::GetContentRights(
115  IN ULONG ContentId,
117 {
119  return DrmGetContentRights(ContentId, DrmRights);
120 }
121 
122 NTSTATUS
123 NTAPI
124 CDrmPort2::AddContentHandlers(
125  IN ULONG ContentId,
126  IN PVOID * paHandlers,
128 {
130  return DrmAddContentHandlers(ContentId, paHandlers, NumHandlers);
131 }
132 
133 NTSTATUS
134 NTAPI
135 CDrmPort2::ForwardContentToDeviceObject(
136  IN ULONG ContentId,
137  IN PVOID Reserved,
138  IN PCDRMFORWARD DrmForward)
139 {
141  return DrmForwardContentToDeviceObject(ContentId, Reserved, DrmForward);
142 }
143 
144 NTSTATUS
146  OUT PDRMPORT2 *OutPort)
147 {
149  if (!This)
151 
152  This->AddRef();
153 
154  *OutPort = (PDRMPORT2)This;
155  return STATUS_SUCCESS;
156 }
157 
158 
static PWSTR GuidString
Definition: apphelp.c:91
#define IN
Definition: typedefs.h:38
STDMETHODIMP_(ULONG) Release()
Definition: drm_port.cpp:27
Definition: drmk.h:18
CDrmPort2(IUnknown *OuterUnknown)
Definition: drm_port.cpp:39
#define REFIID
Definition: guiddef.h:113
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSTATUS NTAPI DrmGetContentRights(IN ULONG ContentId, OUT PDRMRIGHTS DrmRights)
Definition: stubs.cpp:133
_In_ BOOLEAN Release
Definition: classpnp.h:929
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
#define TAG_PORTCLASS
Definition: private.hpp:24
NTSTATUS NTAPI DrmDestroyContent(IN ULONG ContentId)
Definition: stubs.cpp:64
LONG NTSTATUS
Definition: precomp.h:26
LONG m_Ref
Definition: drm_port.cpp:43
NTSTATUS NTAPI DrmForwardContentToFileObject(IN ULONG ContentId, IN PFILE_OBJECT FileObject)
Definition: stubs.cpp:99
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:233
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
long LONG
Definition: pedump.c:60
NTSTATUS NTAPI DrmForwardContentToInterface(IN ULONG ContentId, IN PUNKNOWN pUnknown, IN ULONG NumMethods)
Definition: stubs.cpp:116
NTSTATUS NTAPI DrmForwardContentToDeviceObject(IN ULONG ContentId, IN PVOID Reserved, IN PCDRMFORWARD DrmForward)
Definition: stubs.cpp:80
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
Definition: drm_port.cpp:49
#define STDMETHODIMP
Definition: basetyps.h:43
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
void * PVOID
Definition: retypes.h:9
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
IDrmPort2 * PDRMPORT2
Definition: portcls.h:2172
const GUID IID_IUnknown
NTSTATUS NTAPI DrmAddContentHandlers(IN ULONG ContentId, IN PVOID *paHandlers, IN ULONG NumHandlers)
Definition: stubs.cpp:29
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define PC_ASSERT_IRQL_EQUAL(x)
Definition: private.hpp:31
* PFILE_OBJECT
Definition: iotypes.h:1954
ULONG AddRef()
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define InterlockedDecrement
Definition: armddk.h:52
Definition: arc.h:85
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
virtual ~CDrmPort2()
Definition: drm_port.cpp:40
#define InterlockedIncrement
Definition: armddk.h:53
_In_ ULONG cContentId
Definition: drmk.h:48
NTSTATUS NTAPI DrmCreateContentMixed(IN PULONG paContentId, IN ULONG cContentId, OUT PULONG pMixedContentId)
Definition: stubs.cpp:47
unsigned int * PULONG
Definition: retypes.h:1
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
STDMETHODIMP_(ULONG) AddRef()
Definition: drm_port.cpp:22
_In_ ULONG _Out_ PULONG pMixedContentId
Definition: drmk.h:48
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
_Out_ PDRMRIGHTS DrmRights
Definition: drmk.h:84
NTSTATUS NewIDrmPort(OUT PDRMPORT2 *OutPort)
Definition: drm_port.cpp:145
return STATUS_SUCCESS
Definition: btrfs.c:2777
_In_ ULONG NumHandlers
Definition: drmk.h:41