ReactOS 0.4.15-dev-7705-g2320c37
port_wavertstream.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/port_wavertstream.cpp
5 * PURPOSE: WaveRTStream helper object
6 * PROGRAMMER: Johannes Anderwald
7 */
8
9#include "private.hpp"
10
11#define NDEBUG
12#include <debug.h>
13
14class CPortWaveRTStreamInit : public CUnknownImpl<IPortWaveRTStreamInit>
15{
16public:
18
22
23};
24
28 IN REFIID refiid,
30{
31
32 DPRINT("IPortWaveRTStream_fnQueryInterface entered\n");
33
34 if (IsEqualGUIDAligned(refiid, IID_IPortWaveRTStream) ||
36 {
38 PUNKNOWN(*Output)->AddRef();
39 return STATUS_SUCCESS;
40 }
42}
43
44PMDL
46CPortWaveRTStreamInit::AllocatePagesForMdl(
49{
51}
52
53PMDL
55CPortWaveRTStreamInit::AllocateContiguousPagesForMdl(
56 IN PHYSICAL_ADDRESS LowAddress,
59{
60 PMDL Mdl;
63
65 if (!Buffer)
66 {
67 DPRINT("MmAllocateContiguousMemorySpecifyCache failed\n");
68 return NULL;
69 }
70
72
74
76 if (!Mdl)
77 {
78 DPRINT("MmAllocatePagesForMdl failed\n");
79 return NULL;
80 }
81
83 {
84 DPRINT("ByteCount %u Required %u\n", MmGetMdlByteCount(Mdl), TotalBytes);
87 return NULL;
88 }
89
90 DPRINT("Result %p\n", Mdl);
91 return Mdl;
92}
93
96CPortWaveRTStreamInit::MapAllocatedPages(
99{
101}
102
103VOID
104NTAPI
105CPortWaveRTStreamInit::UnmapAllocatedPages(
108{
110}
111
112VOID
113NTAPI
114CPortWaveRTStreamInit::FreePagesFromMdl(
116{
119}
120
121ULONG
122NTAPI
123CPortWaveRTStreamInit::GetPhysicalPagesCount(
125{
127}
128
130NTAPI
131CPortWaveRTStreamInit::GetPhysicalPageAddress(
134 IN ULONG Index)
135{
137 ULONG Pages;
139
141 if (Pages <= Index)
142 {
143 DPRINT("OutOfBounds: Pages %u Index %u\n", Pages, Index);
145 }
146
148
150 Address->QuadPart = Addr.QuadPart;
151 Result.QuadPart = (ULONG_PTR)Address;
152
153 return Result;
154}
155
158 PPORTWAVERTSTREAM *OutStream)
159{
162 if (!This)
164
165 Status = This->QueryInterface(IID_IPortWaveRTStream, (PVOID*)OutStream);
166
167 if (!NT_SUCCESS(Status))
168 {
169 delete This;
170 return Status;
171 }
172
173 *OutStream = (PPORTWAVERTSTREAM)This;
174 return Status;
175}
LONG NTSTATUS
Definition: precomp.h:26
#define STDMETHODIMP
Definition: basetyps.h:43
const GUID IID_IUnknown
Definition: bufpool.h:45
CPortWaveRTStreamInit(IUnknown *OuterUnknown)
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
PVOID NTAPI MmAllocateContiguousMemorySpecifyCache(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS LowestAcceptableAddress OPTIONAL, IN PHYSICAL_ADDRESS HighestAcceptableAddress, IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL, IN MEMORY_CACHING_TYPE CacheType OPTIONAL)
Definition: contmem.c:574
VOID NTAPI MmFreeContiguousMemorySpecifyCache(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: contmem.c:666
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ULONG_PTR
Definition: config.h:101
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define NonPagedPool
Definition: env_spec_w32.h:307
Status
Definition: gdiplustypes.h:25
NTSYSAPI ULONGLONG WINAPI RtlConvertUlongToLargeInteger(ULONG)
Definition: largeint.c:47
ULONG AddRef()
VOID NTAPI MmFreePagesFromMdl(IN PMDL Mdl)
Definition: mdlsup.c:564
PMDL NTAPI MmAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress, IN PHYSICAL_ADDRESS HighAddress, IN PHYSICAL_ADDRESS SkipBytes, IN SIZE_T TotalBytes)
Definition: mdlsup.c:489
PVOID NTAPI MmMapLockedPagesSpecifyCache(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN MEMORY_CACHING_TYPE CacheType, IN PVOID BaseAddress, IN ULONG BugCheckOnFailure, IN ULONG Priority)
Definition: mdlsup.c:660
VOID NTAPI MmUnmapLockedPages(IN PVOID BaseAddress, IN PMDL Mdl)
Definition: mdlsup.c:837
@ NormalPagePriority
Definition: imports.h:56
@ LowPagePriority
Definition: imports.h:55
#define KernelMode
Definition: asm.h:34
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(IN PVOID Address)
Definition: stubs.c:685
static WCHAR Address[46]
Definition: ping.c:68
NTSTATUS NewPortWaveRTStream(PPORTWAVERTSTREAM *OutStream)
IPortWaveRTStream * PPORTWAVERTSTREAM
Definition: portcls.h:1847
#define TAG_PORTCLASS
Definition: private.hpp:24
#define REFIID
Definition: guiddef.h:118
@ Output
Definition: arc.h:85
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define IN
Definition: typedefs.h:39
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:235
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
#define MmGetMdlByteCount(_Mdl)
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS HighAddress
Definition: mmfuncs.h:226
_Inout_ PMDL MemoryDescriptorList
Definition: mmfuncs.h:405
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size)
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ MEMORY_CACHING_TYPE CacheType
Definition: mmfuncs.h:217
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_ SIZE_T TotalBytes
Definition: mmfuncs.h:228
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE
@ MmNonCached
Definition: mmtypes.h:129