ReactOS 0.4.16-dev-117-g38f21f9
node.cpp
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS WDM Streaming ActiveMovie Proxy
4 * FILE: dll/directx/ksproxy/node.cpp
5 * PURPOSE: Control Node
6 *
7 * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8 */
9#include "precomp.h"
10
11class CKsNode : public IKsControl
12{
13public:
15
17 {
19 return m_Ref;
20 }
22 {
24
25 if (!m_Ref)
26 {
27 delete this;
28 return 0;
29 }
30 return m_Ref;
31 }
32
33 //IKsControl
37
38 CKsNode(IUnknown * pUnkOuter, HANDLE Handle) : m_Ref(0), m_pUnkOuter(pUnkOuter), m_Handle(Handle){};
39 virtual ~CKsNode()
40 {
42 };
43
44protected:
48};
49
53 IN REFIID refiid,
55{
56 if (IsEqualGUID(refiid, IID_IUnknown) ||
58 {
59 *Output = PVOID(this);
60 reinterpret_cast<IUnknown*>(*Output)->AddRef();
61 return NOERROR;
62 }
63
64 return E_NOINTERFACE;
65}
66
67//-------------------------------------------------------------------
68// IKsControl
69//
74 ULONG PropertyLength,
78{
79 assert(m_Handle != 0);
81}
82
86 PKSMETHOD Method,
87 ULONG MethodLength,
88 LPVOID MethodData,
91{
92 assert(m_Handle != 0);
93 return KsSynchronousDeviceControl(m_Handle, IOCTL_KS_METHOD, (PVOID)Method, MethodLength, (PVOID)MethodData, DataLength, BytesReturned);
94}
95
100 ULONG EventLength,
101 LPVOID EventData,
104{
105 assert(m_Handle != 0);
106
107 if (EventLength)
109 else
111}
112
114WINAPI
116 IUnknown * pUnkOuter,
117 HANDLE ParentHandle,
118 ULONG NodeId,
120 REFIID riid,
121 LPVOID * ppv)
122{
123 HRESULT hr;
126
127#ifdef KSPROXY_TRACE
128 OutputDebugStringW(L"CKsNode_Constructor\n");
129#endif
130
131 //setup request
133 NodeCreate.Node = NodeId;
134
136 if (hr != NOERROR)
137 {
138 OutputDebugString("CKsNode_Constructor failed to open device\n");
140 }
141
142 CKsNode * quality = new CKsNode(pUnkOuter, handle);
143
144 if (!quality)
145 {
146 // free clock handle
148 return E_OUTOFMEMORY;
149 }
150
151 if (FAILED(quality->QueryInterface(riid, ppv)))
152 {
153 /* not supported */
154 delete quality;
155 return E_NOINTERFACE;
156 }
157
158 return NOERROR;
159}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define STDMETHODIMP
Definition: basetyps.h:43
const GUID IID_IUnknown
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1444
Definition: node.cpp:12
STDMETHODIMP_(ULONG) Release()
Definition: node.cpp:21
CKsNode(IUnknown *pUnkOuter, HANDLE Handle)
Definition: node.cpp:38
LONG m_Ref
Definition: node.cpp:45
virtual ~CKsNode()
Definition: node.cpp:39
IUnknown * m_pUnkOuter
Definition: node.cpp:46
HANDLE m_Handle
Definition: node.cpp:47
HRESULT STDMETHODCALLTYPE KsProperty(PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData, ULONG DataLength, ULONG *BytesReturned)
Definition: node.cpp:72
STDMETHODIMP_(ULONG) AddRef()
Definition: node.cpp:16
HRESULT STDMETHODCALLTYPE KsMethod(PKSMETHOD Method, ULONG MethodLength, LPVOID MethodData, ULONG DataLength, ULONG *BytesReturned)
Definition: node.cpp:85
HRESULT STDMETHODCALLTYPE KsEvent(PKSEVENT Event, ULONG EventLength, LPVOID EventData, ULONG DataLength, ULONG *BytesReturned)
Definition: node.cpp:98
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
Definition: node.cpp:52
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
#define CloseHandle
Definition: compat.h:739
#define assert(x)
Definition: debug.h:53
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
const GUID IID_IKsControl
Definition: filter.c:44
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData
ULONG Handle
Definition: gdb_input.c:15
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
ULONG AddRef()
ULONG Release()
#define FAILED(hr)
Definition: intsafe.h:51
int quality
Definition: jpeglib.h:992
_In_ PKSNODE_CREATE NodeCreate
Definition: ks.h:4546
#define IOCTL_KS_METHOD
Definition: ks.h:136
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
#define IOCTL_KS_ENABLE_EVENT
Definition: ks.h:130
#define IOCTL_KS_DISABLE_EVENT
Definition: ks.h:133
KSDDKAPI HRESULT WINAPI KsSynchronousDeviceControl(HANDLE Handle, ULONG IoControl, PVOID InBuffer, ULONG InLength, PVOID OutBuffer, ULONG OutLength, PULONG BytesReturned)
Definition: ksproxy.cpp:34
KSDDKAPI DWORD NTAPI KsCreateTopologyNode(HANDLE ParentHandle, PKSNODE_CREATE NodeCreate, IN ACCESS_MASK DesiredAccess, OUT PHANDLE NodeHandle)
Definition: ksuser.c:240
HRESULT WINAPI CKsNode_Constructor(IUnknown *pUnkOuter, HANDLE ParentHandle, ULONG NodeId, ACCESS_MASK DesiredAccess, REFIID riid, LPVOID *ppv)
Definition: node.cpp:115
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
@ Output
Definition: arc.h:85
HRESULT hr
Definition: shlfolder.c:183
ULONG Node
Definition: ks.h:2094
ULONG CreateFlags
Definition: ks.h:2093
void * PVOID
Definition: typedefs.h:50
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesReturned
Definition: wdfiotarget.h:1052
#define OutputDebugString
Definition: winbase.h:3890
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
#define NOERROR
Definition: winerror.h:2354
#define SEVERITY_ERROR
Definition: winerror.h:65
#define FACILITY_WIN32
Definition: winerror.h:27