ReactOS  0.4.14-dev-593-g1793dcc
property.c File Reference
#include "precomp.h"
Include dependency graph for property.c:

Go to the source code of this file.

Classes

struct  CKsPropertySetImpl
 

Typedefs

typedef struct CKsPropertySetImplLPCKsPropertySetImpl
 

Functions

HRESULT WINAPI KSPropertySetImpl_fnQueryInterface (LPKSPROPERTYSET iface, REFIID riid, LPVOID *ppobj)
 
ULONG WINAPI KSPropertySetImpl_fnAddRef (LPKSPROPERTYSET iface)
 
ULONG WINAPI KSPropertySetImpl_fnRelease (LPKSPROPERTYSET iface)
 
HRESULT WINAPI KSPropertySetImpl_Get (LPKSPROPERTYSET iface, REFGUID guidPropSet, ULONG dwPropID, LPVOID pInstanceData, ULONG cbInstanceData, LPVOID pPropData, ULONG cbPropData, PULONG pcbReturned)
 
HRESULT WINAPI KSPropertySetImpl_Set (LPKSPROPERTYSET iface, REFGUID guidPropSet, ULONG dwPropID, LPVOID pInstanceData, ULONG cbInstanceData, LPVOID pPropData, ULONG cbPropData)
 
HRESULT WINAPI KSPropertySetImpl_QuerySupport (LPKSPROPERTYSET iface, REFGUID guidPropSet, ULONG dwPropID, PULONG pTypeSupport)
 
HRESULT CALLBACK NewKsPropertySet (IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObject)
 

Variables

static IKsPropertySetVtbl vt_KsPropertySet
 

Typedef Documentation

◆ LPCKsPropertySetImpl

Function Documentation

◆ KSPropertySetImpl_fnAddRef()

ULONG WINAPI KSPropertySetImpl_fnAddRef ( LPKSPROPERTYSET  iface)

Definition at line 49 of file property.c.

51 {
52  ULONG ref;
54 
55  ref = InterlockedIncrement(&This->ref);
56 
57  return ref;
58 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define InterlockedIncrement
Definition: armddk.h:53
struct CKsPropertySetImpl * LPCKsPropertySetImpl
unsigned int ULONG
Definition: retypes.h:1

◆ KSPropertySetImpl_fnQueryInterface()

HRESULT WINAPI KSPropertySetImpl_fnQueryInterface ( LPKSPROPERTYSET  iface,
REFIID  riid,
LPVOID ppobj 
)

Definition at line 22 of file property.c.

26 {
27  LPOLESTR pStr;
29 
30 
31  if (IsEqualIID(riid, &IID_IUnknown) ||
33  {
34  *ppobj = (LPVOID)&This->lpVtbl;
36  return S_OK;
37  }
38 
39  if (SUCCEEDED(StringFromIID(riid, &pStr)))
40  {
41  DPRINT("No Interface for riid %s\n", pStr);
42  CoTaskMemFree(pStr);
43  }
44  return E_NOINTERFACE;
45 }
#define E_NOINTERFACE
Definition: winerror.h:2364
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
REFIID riid
Definition: precomp.h:44
static LPOLESTR
Definition: stg_prop.c:27
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
_Check_return_ HRESULT WINAPI StringFromIID(_In_ REFIID rclsid, _Outptr_ LPOLESTR *lplpsz)
const GUID IID_IUnknown
#define LPVOID
Definition: nt_native.h:45
const GUID IID_IKsPropertySet
Definition: controlnode.cpp:13
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
struct CKsPropertySetImpl * LPCKsPropertySetImpl
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ KSPropertySetImpl_fnRelease()

ULONG WINAPI KSPropertySetImpl_fnRelease ( LPKSPROPERTYSET  iface)

Definition at line 62 of file property.c.

64 {
65  ULONG ref;
67 
68  ref = InterlockedDecrement(&(This->ref));
69 
70  if (!ref)
71  {
73  }
74 
75  return ref;
76 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
struct CKsPropertySetImpl * LPCKsPropertySetImpl
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ KSPropertySetImpl_Get()

HRESULT WINAPI KSPropertySetImpl_Get ( LPKSPROPERTYSET  iface,
REFGUID  guidPropSet,
ULONG  dwPropID,
LPVOID  pInstanceData,
ULONG  cbInstanceData,
LPVOID  pPropData,
ULONG  cbPropData,
PULONG  pcbReturned 
)

Definition at line 81 of file property.c.

90 {
91  LPOLESTR pStr;
92  //HRESULT hr;
94  WAVEINCAPSW CapsIn;
95  WAVEOUTCAPSW CapsOut;
96 
97  GUID DeviceGuid;
100 
101  StringFromIID(guidPropSet, &pStr);
102 
103  //DPRINT("Requested Property %ws dwPropID %u pInstanceData %p cbInstanceData %u pPropData %p cbPropData %u pcbReturned %p\n",
104  // pStr, dwPropID, pInstanceData, cbInstanceData, pPropData, cbPropData, pcbReturned);
105  CoTaskMemFree(pStr);
106 
107  if (!IsEqualGUID(guidPropSet, &DSPROPSETID_DirectSoundDevice))
108  {
109  /* unsupported property set */
110  return E_PROP_ID_UNSUPPORTED;
111  }
112 
114  {
115  if (cbPropData < sizeof(DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA))
116  {
117  /* invalid parameter */
118  return DSERR_INVALIDPARAM;
119  }
120 
122 
123  if (IsEqualGUID(&Desc->DeviceId, &GUID_NULL))
124  {
126  {
127  DPRINT("Using default capture guid\n");
128  CopyMemory(&DeviceGuid, &DSDEVID_DefaultCapture, sizeof(GUID));
129  }
130  else
131  {
132  DPRINT("Using default playback guid\n");
133  CopyMemory(&DeviceGuid, &DSDEVID_DefaultPlayback, sizeof(GUID));
134  }
135  }
136  else
137  {
138  /* use provided guid */
139  CopyMemory(&DeviceGuid, &Desc->DeviceId, sizeof(GUID));
140  }
141 
142  if (GetDeviceID(&DeviceGuid, &Desc->DeviceId) != DS_OK)
143  {
144  DPRINT("Unknown device guid\n");
145  return DSERR_INVALIDPARAM;
146  }
147 
148  /* sanity check */
150  ASSERT(Filter != NULL);
151 
152  /* fill in description */
153  if (IsEqualGUID(&Desc->DeviceId, &Filter->DeviceGuid[0]))
154  {
155  /* capture device */
157  Desc->WaveDeviceId = Filter->MappedId[0];
158 
159  Result = waveInGetDevCapsW(Filter->MappedId[0], &CapsIn, sizeof(WAVEINCAPSW));
160  if (Result != MMSYSERR_NOERROR)
161  {
162  CapsIn.szPname[0] = 0;
163  DPRINT("waveInGetDevCaps Device %u failed with %x\n", Filter->MappedId[0], Result);
164  }
165 
166  CapsIn.szPname[MAXPNAMELEN-1] = 0;
167  wcscpy(Desc->DescriptionW, CapsIn.szPname);
168  WideCharToMultiByte(CP_ACP, 0, CapsIn.szPname, -1, Desc->DescriptionA, sizeof(Desc->DescriptionA), NULL, NULL);
169 
170  }
171  else
172  {
173  /* render device */
175  Desc->WaveDeviceId = Filter->MappedId[1];
176 
177  Result = waveOutGetDevCapsW(Filter->MappedId[1], &CapsOut, sizeof(WAVEOUTCAPSW));
178  if (Result != MMSYSERR_NOERROR)
179  {
180  CapsOut.szPname[0] = 0;
181  DPRINT("waveOutGetDevCaps Device %u failed with %x\n", Filter->MappedId[1], Result);
182  }
183 
184  CapsOut.szPname[MAXPNAMELEN-1] = 0;
185  wcscpy(Desc->DescriptionW, CapsOut.szPname);
186  WideCharToMultiByte(CP_ACP, 0, CapsOut.szPname, -1, Desc->DescriptionA, sizeof(Desc->DescriptionA), NULL, NULL);
187  }
188 
189  /* ReactOS doesnt support vxd or emulated */
191  Desc->ModuleA[0] = 0;
192  Desc->ModuleW[0] = 0;
193 
195  return S_OK;
196  }
197 
198 
200  return E_PROP_ID_UNSUPPORTED;
201 }
HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
Definition: dsound.c:53
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
BOOL FindDeviceByGuid(LPCGUID pGuidSrc, LPFILTERINFO *Filter)
Definition: devicelist.c:470
#define WideCharToMultiByte
Definition: compat.h:101
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1060
#define CP_ACP
Definition: compat.h:99
UINT MMRESULT
Definition: mmsystem.h:962
struct _DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA * PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA
static LPOLESTR
Definition: stg_prop.c:27
DIRECTSOUNDDEVICE_DATAFLOW DataFlow
Definition: dsconf.h:62
UINT WINAPI waveInGetDevCapsW(UINT_PTR uDeviceID, LPWAVEINCAPSW lpCaps, UINT uSize)
Definition: winmm.c:2576
UINT WINAPI waveOutGetDevCapsW(UINT_PTR uDeviceID, LPWAVEOUTCAPSW lpCaps, UINT uSize)
Definition: winmm.c:2176
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
smooth NULL
Definition: ftsmooth.c:416
_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:426
void DPRINT(...)
Definition: polytest.cpp:61
_Check_return_ HRESULT WINAPI StringFromIID(_In_ REFIID rclsid, _Outptr_ LPOLESTR *lplpsz)
#define DS_OK
Definition: dsound.h:116
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
#define CopyMemory
Definition: winbase.h:1640
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1039
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define GUID_NULL
Definition: ks.h:106
struct _DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define MAXPNAMELEN
Definition: mmsystem.h:24
#define UNIMPLEMENTED
Definition: debug.h:114

◆ KSPropertySetImpl_QuerySupport()

HRESULT WINAPI KSPropertySetImpl_QuerySupport ( LPKSPROPERTYSET  iface,
REFGUID  guidPropSet,
ULONG  dwPropID,
PULONG  pTypeSupport 
)

Definition at line 220 of file property.c.

225 {
227  return E_PROP_ID_UNSUPPORTED;
228 }
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
#define UNIMPLEMENTED
Definition: debug.h:114

◆ KSPropertySetImpl_Set()

HRESULT WINAPI KSPropertySetImpl_Set ( LPKSPROPERTYSET  iface,
REFGUID  guidPropSet,
ULONG  dwPropID,
LPVOID  pInstanceData,
ULONG  cbInstanceData,
LPVOID  pPropData,
ULONG  cbPropData 
)

Definition at line 205 of file property.c.

213 {
215  return E_PROP_ID_UNSUPPORTED;
216 }
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
#define UNIMPLEMENTED
Definition: debug.h:114

◆ NewKsPropertySet()

HRESULT CALLBACK NewKsPropertySet ( IUnknown pUnkOuter,
REFIID  riid,
LPVOID ppvObject 
)

Definition at line 244 of file property.c.

248 {
249  LPOLESTR pStr;
251 
252  /* check requested interface */
254  {
255  *ppvObject = 0;
256  StringFromIID(riid, &pStr);
257  DPRINT("KsPropertySet does not support Interface %ws\n", pStr);
258  CoTaskMemFree(pStr);
259  return E_NOINTERFACE;
260  }
261 
262  /* allocate object */
264  if (!This)
265  return E_OUTOFMEMORY;
266 
267  /* initialize object */
268  This->ref = 1;
269  This->lpVtbl = &vt_KsPropertySet;
270  *ppvObject = (LPVOID)&This->lpVtbl;
271 
272  return S_OK;
273 }
#define E_NOINTERFACE
Definition: winerror.h:2364
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
REFIID riid
Definition: precomp.h:44
static LPOLESTR
Definition: stg_prop.c:27
static IKsPropertySetVtbl vt_KsPropertySet
Definition: property.c:230
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
void DPRINT(...)
Definition: polytest.cpp:61
_Check_return_ HRESULT WINAPI StringFromIID(_In_ REFIID rclsid, _Outptr_ LPOLESTR *lplpsz)
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
const GUID IID_IUnknown
#define LPVOID
Definition: nt_native.h:45
REFIID LPVOID * ppvObject
Definition: precomp.h:44
const GUID IID_IKsPropertySet
Definition: controlnode.cpp:13
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

Variable Documentation

◆ vt_KsPropertySet

IKsPropertySetVtbl vt_KsPropertySet
static
Initial value:
=
{
}
HRESULT WINAPI KSPropertySetImpl_QuerySupport(LPKSPROPERTYSET iface, REFGUID guidPropSet, ULONG dwPropID, PULONG pTypeSupport)
Definition: property.c:220
ULONG WINAPI KSPropertySetImpl_fnRelease(LPKSPROPERTYSET iface)
Definition: property.c:62
HRESULT WINAPI KSPropertySetImpl_Set(LPKSPROPERTYSET iface, REFGUID guidPropSet, ULONG dwPropID, LPVOID pInstanceData, ULONG cbInstanceData, LPVOID pPropData, ULONG cbPropData)
Definition: property.c:205
HRESULT WINAPI KSPropertySetImpl_fnQueryInterface(LPKSPROPERTYSET iface, REFIID riid, LPVOID *ppobj)
Definition: property.c:22
ULONG WINAPI KSPropertySetImpl_fnAddRef(LPKSPROPERTYSET iface)
Definition: property.c:49
HRESULT WINAPI KSPropertySetImpl_Get(LPKSPROPERTYSET iface, REFGUID guidPropSet, ULONG dwPropID, LPVOID pInstanceData, ULONG cbInstanceData, LPVOID pPropData, ULONG cbPropData, PULONG pcbReturned)
Definition: property.c:81

Definition at line 230 of file property.c.

Referenced by NewKsPropertySet().