ReactOS  0.4.14-dev-323-g6fe6a88
ksproxy.cpp File Reference
#include "precomp.h"
Include dependency graph for ksproxy.cpp:

Go to the source code of this file.

Functions

KSDDKAPI HRESULT WINAPI KsSynchronousDeviceControl (HANDLE Handle, ULONG IoControl, PVOID InBuffer, ULONG InLength, PVOID OutBuffer, ULONG OutLength, PULONG BytesReturned)
 
KSDDKAPI HRESULT WINAPI KsResolveRequiredAttributes (PKSDATARANGE DataRange, KSMULTIPLE_ITEM *Attributes OPTIONAL)
 
KSDDKAPI HRESULT WINAPI KsOpenDefaultDevice (REFGUID Category, ACCESS_MASK Access, PHANDLE DeviceHandle)
 
KSDDKAPI HRESULT WINAPI KsGetMultiplePinFactoryItems (HANDLE FilterHandle, ULONG PinFactoryId, ULONG PropertyId, PVOID *Items)
 
KSDDKAPI HRESULT WINAPI KsGetMediaTypeCount (HANDLE FilterHandle, ULONG PinFactoryId, ULONG *MediaTypeCount)
 
KSDDKAPI HRESULT WINAPI KsGetMediaType (int Position, AM_MEDIA_TYPE *AmMediaType, HANDLE FilterHandle, ULONG PinFactoryId)
 
KSDDKAPI HRESULT WINAPI DllUnregisterServer (void)
 
KSDDKAPI HRESULT WINAPI DllRegisterServer (void)
 
KSDDKAPI HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
KSDDKAPI HRESULT WINAPI DllCanUnloadNow (void)
 

Variables

const GUID CLSID_KsClockForwarder = {0x877e4351, 0x6fea, 0x11d0, {0xb8, 0x63, 0x00, 0xaa, 0x00, 0xa2, 0x16, 0xa1}}
 
const GUID CLSID_KsQualityForwarder = {0xe05592e4, 0xc0b5, 0x11d0, {0xa4, 0x39, 0x00, 0xa0, 0xc9, 0x22, 0x31, 0x96}}
 
const GUID CLSID_KsIBasicAudioInterfaceHandler = {0xb9f8ac3e, 0x0f71, 0x11d2, {0xb7, 0x2c, 0x00, 0xc0, 0x4f, 0xb6, 0xbd, 0x3d}}
 
static INTERFACE_TABLE InterfaceTable []
 

Function Documentation

◆ DllCanUnloadNow()

KSDDKAPI HRESULT WINAPI DllCanUnloadNow ( void  )

Definition at line 441 of file ksproxy.cpp.

442 {
443  return S_OK;
444 }
#define S_OK
Definition: intsafe.h:59

◆ DllGetClassObject()

KSDDKAPI HRESULT WINAPI DllGetClassObject ( REFCLSID  rclsid,
REFIID  riid,
LPVOID ppv 
)

Definition at line 404 of file ksproxy.cpp.

408 {
409  UINT i;
411  IClassFactory * pcf = NULL;
412 
413  if (!ppv)
414  return E_INVALIDARG;
415 
416  *ppv = NULL;
417 
418  for (i = 0; InterfaceTable[i].riid; i++)
419  {
420  if (IsEqualIID(*InterfaceTable[i].riid, rclsid))
421  {
423  break;
424  }
425  }
426 
427  if (!pcf)
428  {
430  }
431 
432  hres = pcf->QueryInterface(riid, ppv);
433  pcf->Release();
434 
435  return hres;
436 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
const GUID * riid
Definition: precomp.h:26
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
ULONG Release()
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
IClassFactory * CClassFactory_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, IID *riidInst)
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
unsigned int UINT
Definition: ndis.h:50
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static INTERFACE_TABLE InterfaceTable[]
Definition: ksproxy.cpp:18

◆ DllRegisterServer()

KSDDKAPI HRESULT WINAPI DllRegisterServer ( void  )

Definition at line 364 of file ksproxy.cpp.

365 {
366  ULONG Index = 0;
367  LPOLESTR pStr;
368  HRESULT hr = S_OK;
369  HKEY hClass, hKey, hSubKey;
370  static LPCWSTR ModuleName = L"ksproxy.ax";
371  static LPCWSTR ThreadingModel = L"Both";
372 
373  if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_WRITE, &hClass) != ERROR_SUCCESS)
374  return E_FAIL;
375 
376  do
377  {
379  if (FAILED(hr))
380  break;
381 
382  if (RegCreateKeyExW(hClass, pStr, 0, 0, 0, KEY_WRITE, NULL, &hKey, 0) == ERROR_SUCCESS)
383  {
384  if (RegCreateKeyExW(hKey, L"InprocServer32", 0, 0, 0, KEY_WRITE, NULL, &hSubKey, 0) == ERROR_SUCCESS)
385  {
386  RegSetValueExW(hSubKey, 0, 0, REG_SZ, (const BYTE*)ModuleName, (wcslen(ModuleName) + 1) * sizeof(WCHAR));
387  RegSetValueExW(hSubKey, L"ThreadingModel", 0, REG_SZ, (const BYTE*)ThreadingModel, (wcslen(ThreadingModel) + 1) * sizeof(WCHAR));
388  RegCloseKey(hSubKey);
389  }
390  RegCloseKey(hKey);
391  }
392 
393  CoTaskMemFree(pStr);
394  Index++;
395  }while(InterfaceTable[Index].lpfnCI != 0);
396 
397  RegCloseKey(hClass);
398  return hr;
399 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
REFIID riid
Definition: precomp.h:44
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1264
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WRITE
Definition: nt_native.h:1031
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static const UCHAR Index[8]
Definition: usbohci.c:18
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: mem.h:68
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
static INTERFACE_TABLE InterfaceTable[]
Definition: ksproxy.cpp:18
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
#define REG_SZ
Definition: layer.c:22

◆ DllUnregisterServer()

KSDDKAPI HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 335 of file ksproxy.cpp.

336 {
337  ULONG Index = 0;
338  LPOLESTR pStr;
339  HRESULT hr = S_OK;
340  HKEY hClass;
341 
342  if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_SET_VALUE, &hClass) != ERROR_SUCCESS)
343  return E_FAIL;
344 
345  do
346  {
348  if (FAILED(hr))
349  break;
350 
351  RegDeleteKeyW(hClass, pStr);
352  CoTaskMemFree(pStr);
353  Index++;
354  }while(InterfaceTable[Index].lpfnCI != 0);
355 
356  RegCloseKey(hClass);
357  return hr;
358 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define KEY_SET_VALUE
Definition: nt_native.h:1017
REFIID riid
Definition: precomp.h:44
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
LPFNCREATEINSTANCE lpfnCI
Definition: shellole.c:61
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
LONG HRESULT
Definition: typedefs.h:77
static const UCHAR Index[8]
Definition: usbohci.c:18
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
static INTERFACE_TABLE InterfaceTable[]
Definition: ksproxy.cpp:18
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412

◆ KsGetMediaType()

KSDDKAPI HRESULT WINAPI KsGetMediaType ( int  Position,
AM_MEDIA_TYPE AmMediaType,
HANDLE  FilterHandle,
ULONG  PinFactoryId 
)

Definition at line 250 of file ksproxy.cpp.

255 {
256  HRESULT hr;
257  PKSMULTIPLE_ITEM ItemList;
258  int i = 0;
260 
261  if (Position < 0)
262  return E_INVALIDARG;
263 
264  // get current supported ranges
265  hr = KsGetMultiplePinFactoryItems(FilterHandle, PinFactoryId, KSPROPERTY_PIN_CONSTRAINEDDATARANGES, (PVOID*)&ItemList);
266  if (FAILED(hr))
267  {
268  // get standard dataranges
269  hr = KsGetMultiplePinFactoryItems(FilterHandle, PinFactoryId, KSPROPERTY_PIN_DATARANGES, (PVOID*)&ItemList);
270 
271  //check for success
272  if (FAILED(hr))
273  return hr;
274  }
275 
276  if ((ULONG)Position >= ItemList->Count)
277  {
278  // out of bounds
279  CoTaskMemFree(ItemList);
281  }
282 
283  // goto first datarange
284  DataFormat = (PKSDATAFORMAT)(ItemList + 1);
285 
286  while(i != Position)
287  {
288  // goto next format;
290  i++;
291  }
292 
293 
294  DataFormat->FormatSize -= sizeof(KSDATAFORMAT);
295  if (DataFormat->FormatSize)
296  {
297  // copy extra format buffer
298  AmMediaType->pbFormat = (BYTE*)CoTaskMemAlloc(DataFormat->FormatSize);
299  if (!AmMediaType->pbFormat)
300  {
301  // not enough memory
302  CoTaskMemFree(ItemList);
303  return E_OUTOFMEMORY;
304  }
305  // copy format buffer
306  CopyMemory(AmMediaType->pbFormat, (DataFormat + 1), DataFormat->FormatSize);
307  AmMediaType->cbFormat = DataFormat->FormatSize;
308  }
309  else
310  {
311  // no format buffer
312  AmMediaType->pbFormat = NULL;
313  AmMediaType->cbFormat = 0;
314  }
315 
316  // copy type info
317  CopyMemory(&AmMediaType->majortype, &DataFormat->MajorFormat, sizeof(GUID));
318  CopyMemory(&AmMediaType->subtype, &DataFormat->SubFormat, sizeof(GUID));
319  CopyMemory(&AmMediaType->formattype, &DataFormat->Specifier, sizeof(GUID));
320  AmMediaType->bTemporalCompression = FALSE; //FIXME verify
321  AmMediaType->pUnk = NULL; //FIXME
322  AmMediaType->lSampleSize = DataFormat->SampleSize;
323  AmMediaType->bFixedSizeSamples = (AmMediaType->lSampleSize) ? TRUE : FALSE;
324 
325  // free dataformat list
326  CoTaskMemFree(ItemList);
327 
328  return NOERROR;
329 }
ULONG Count
Definition: ks.h:1980
#define TRUE
Definition: types.h:120
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT hr
Definition: shlfolder.c:183
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#define NOERROR
Definition: winerror.h:2354
static COORD Position
Definition: mouse.c:34
uint32_t ULONG_PTR
Definition: typedefs.h:63
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
KSDDKAPI HRESULT WINAPI KsGetMultiplePinFactoryItems(HANDLE FilterHandle, ULONG PinFactoryId, ULONG PropertyId, PVOID *Items)
Definition: ksproxy.cpp:154
LONG HRESULT
Definition: typedefs.h:77
#define CopyMemory
Definition: winbase.h:1640
#define SEVERITY_ERROR
Definition: winerror.h:65
unsigned char BYTE
Definition: mem.h:68
#define FACILITY_WIN32
Definition: winerror.h:27
unsigned int ULONG
Definition: retypes.h:1
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
KSDATAFORMAT * PKSDATAFORMAT

Referenced by CInputPin::CInputPin(), COutputPin::COutputPin(), CInputPin::EnumMediaTypes(), and COutputPin::EnumMediaTypes().

◆ KsGetMediaTypeCount()

KSDDKAPI HRESULT WINAPI KsGetMediaTypeCount ( HANDLE  FilterHandle,
ULONG  PinFactoryId,
ULONG MediaTypeCount 
)

Definition at line 216 of file ksproxy.cpp.

220 {
221  PKSMULTIPLE_ITEM MultipleItem;
222  HRESULT hr;
223 
224  /* try get constrained data ranges */
225  hr = KsGetMultiplePinFactoryItems(FilterHandle, PinFactoryId, KSPROPERTY_PIN_CONSTRAINEDDATARANGES, (PVOID*)&MultipleItem);
226 
227  /* check for failure*/
228  if (FAILED(hr))
229  {
230  /* try getting default data ranges */
231  hr = KsGetMultiplePinFactoryItems(FilterHandle, PinFactoryId, KSPROPERTY_PIN_DATARANGES, (PVOID*)&MultipleItem);
232  }
233 
234  if (SUCCEEDED(hr))
235  {
236  /* store number of media types */
237  *MediaTypeCount = MultipleItem->Count;
238 
239  /* free memory */
240  CoTaskMemFree(MultipleItem);
241  }
242 
243  /* done */
244  return hr;
245 }
ULONG Count
Definition: ks.h:1980
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT hr
Definition: shlfolder.c:183
KSDDKAPI HRESULT WINAPI KsGetMultiplePinFactoryItems(HANDLE FilterHandle, ULONG PinFactoryId, ULONG PropertyId, PVOID *Items)
Definition: ksproxy.cpp:154
LONG HRESULT
Definition: typedefs.h:77
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CInputPin::EnumMediaTypes(), and COutputPin::EnumMediaTypes().

◆ KsGetMultiplePinFactoryItems()

KSDDKAPI HRESULT WINAPI KsGetMultiplePinFactoryItems ( HANDLE  FilterHandle,
ULONG  PinFactoryId,
ULONG  PropertyId,
PVOID Items 
)

Definition at line 154 of file ksproxy.cpp.

159 {
161  ULONG BytesReturned, NumData;
162  HRESULT hResult;
163 
164  /* zero pin property */
165  RtlZeroMemory(&Property, sizeof(KSP_PIN));
169  Property.PinId = PinFactoryId;
170 
171  /* query pin factory */
172  hResult = KsSynchronousDeviceControl(FilterHandle, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSP_PIN), NULL, 0, &BytesReturned);
173 
175  {
176  /* buffer too small */
177  hResult = KsSynchronousDeviceControl(FilterHandle, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSP_PIN), (PVOID)&NumData, sizeof(ULONG), &BytesReturned);
178 
179  if (SUCCEEDED(hResult))
180  {
181  /* store required data size */
182  BytesReturned = NumData;
184  }
185  }
186 
188  {
189  /* allocate data */
190  *Items = CoTaskMemAlloc(BytesReturned);
191 
192  if (!*Items)
193  {
194  /* no memory */
195  return E_OUTOFMEMORY;
196  }
197 
198  /* retry querying property */
199  hResult = KsSynchronousDeviceControl(FilterHandle, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSP_PIN), (PVOID)*Items, BytesReturned, &BytesReturned);
200 
201  /* check for success */
202  if (FAILED(hResult))
203  {
204  /* free memory */
205  CoTaskMemFree(*Items);
206  }
207  }
208 
209  /* done */
210  return hResult;
211 }
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
_In_ PSTORAGE_PROPERTY_ID PropertyId
Definition: classpnp.h:966
KSDDKAPI HRESULT WINAPI KsSynchronousDeviceControl(HANDLE Handle, ULONG IoControl, PVOID InBuffer, ULONG InLength, PVOID OutBuffer, ULONG OutLength, PULONG BytesReturned)
Definition: ksproxy.cpp:34
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
Definition: ks.h:642
LONG HRESULT
Definition: typedefs.h:77
#define SEVERITY_ERROR
Definition: winerror.h:65
#define ERROR_MORE_DATA
Definition: dderror.h:13
_In_ DWORD Property
Definition: setupapi.h:1545
#define FACILITY_WIN32
Definition: winerror.h:27
_In_ FILTER_INFORMATION_CLASS _In_ ULONG _Out_ PULONG BytesReturned
Definition: fltkernel.h:1716
#define KSPROPSETID_Pin
Definition: ks.h:617
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
Property(long _type, long _tag, INREAL _value)
Definition: reader.h:125
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by CInputPin::CheckFormat(), COutputPin::CheckFormat(), KsGetMediaType(), KsGetMediaTypeCount(), COutputPin::KsQueryInterfaces(), CInputPin::KsQueryInterfaces(), COutputPin::KsQueryMediums(), and CInputPin::KsQueryMediums().

◆ KsOpenDefaultDevice()

KSDDKAPI HRESULT WINAPI KsOpenDefaultDevice ( REFGUID  Category,
ACCESS_MASK  Access,
PHANDLE  DeviceHandle 
)

Definition at line 101 of file ksproxy.cpp.

105 {
106  HDEVINFO hList;
107  SP_DEVICE_INTERFACE_DATA DeviceInterfaceData;
108  PSP_DEVICE_INTERFACE_DETAIL_DATA_W DeviceInterfaceDetailData;
110 
111  /* open device list */
113 
115  {
116  /* failed */
118  }
119 
120  /* setup parameters */
121  DeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
122 
123  if (SetupDiEnumDeviceInterfaces(hList, NULL, &Category, 0, &DeviceInterfaceData))
124  {
125  /* setup interface data struct */
126  DeviceInterfaceDetailData = (PSP_DEVICE_INTERFACE_DETAIL_DATA_W)Path;
127  DeviceInterfaceDetailData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W);
128 
129  /* get device interface details */
130  if (SetupDiGetDeviceInterfaceDetailW(hList, &DeviceInterfaceData, DeviceInterfaceDetailData, sizeof(Path), NULL, NULL))
131  {
132  /* open device */
134 
136  {
137  /* operation succeeded */
139  return NOERROR;
140  }
141  }
142  }
143 
144  /* free device list */
146 
147  /* failed */
149 }
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
WCHAR DevicePath[ANYSIZE_ARRAY]
Definition: setupapi.h:850
#define NOERROR
Definition: winerror.h:2354
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2297
BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, PSP_DEVICE_INTERFACE_DETAIL_DATA_W DeviceInterfaceDetailData, DWORD DeviceInterfaceDetailDataSize, PDWORD RequiredSize, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:3016
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
struct _SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_DEVICE_INTERFACE_DETAIL_DATA_W
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
#define OPEN_EXISTING
Definition: compat.h:426
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
#define MAX_PATH
Definition: compat.h:26
struct _SP_DEVICE_INTERFACE_DETAIL_DATA_W * PSP_DEVICE_INTERFACE_DETAIL_DATA_W
#define SEVERITY_ERROR
Definition: winerror.h:65
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
#define FACILITY_WIN32
Definition: winerror.h:27
HWND hList
Definition: livecd.c:10
PRTL_UNICODE_STRING_BUFFER Path
BOOL WINAPI SetupDiEnumDeviceInterfaces(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, CONST GUID *InterfaceClassGuid, DWORD MemberIndex, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2785
#define CreateFileW
Definition: compat.h:400
#define DIGCF_DEVICEINTERFACE
Definition: setupapi.h:174
struct _SP_DEVICE_INTERFACE_DATA SP_DEVICE_INTERFACE_DATA
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
#define DIGCF_PRESENT
Definition: setupapi.h:171

Referenced by CKsClockForwarder_Constructor(), and CKsQualityForwarder_Constructor().

◆ KsResolveRequiredAttributes()

KSDDKAPI HRESULT WINAPI KsResolveRequiredAttributes ( PKSDATARANGE  DataRange,
KSMULTIPLE_ITEM *Attributes  OPTIONAL 
)

Definition at line 90 of file ksproxy.cpp.

93 {
94  //UNIMPLEMENTED
95  return NOERROR;
96 }
#define NOERROR
Definition: winerror.h:2354

◆ KsSynchronousDeviceControl()

KSDDKAPI HRESULT WINAPI KsSynchronousDeviceControl ( HANDLE  Handle,
ULONG  IoControl,
PVOID  InBuffer,
ULONG  InLength,
PVOID  OutBuffer,
ULONG  OutLength,
PULONG  BytesReturned 
)

Definition at line 34 of file ksproxy.cpp.

42 {
43  OVERLAPPED Overlapped;
44  DWORD Transferred;
45 
46  /* zero overlapped */
47  RtlZeroMemory(&Overlapped, sizeof(OVERLAPPED));
48 
49  /* create notification event */
50  Overlapped.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
51 
52  if (!Overlapped.hEvent)
53  {
54  /* failed */
56  }
57 
58  if (!DeviceIoControl(Handle, IoControl, InBuffer, InLength, OutBuffer, OutLength, BytesReturned, &Overlapped))
59  {
60  /* operation failed */
62  {
63  /* failed */
64  CloseHandle(Overlapped.hEvent);
66  }
67  }
68 
69  /* get result of pending operation */
70  if (!GetOverlappedResult(Handle, &Overlapped, &Transferred, TRUE))
71  {
72  /* failed */
73  CloseHandle(Overlapped.hEvent);
75  }
76 
77  /* store number of bytes transferred */
78  *BytesReturned = Transferred;
79 
80  /* close event object */
81  CloseHandle(Overlapped.hEvent);
82 
83  /* done */
84  return NOERROR;
85 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define NOERROR
Definition: winerror.h:2354
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
Definition: iocompl.c:204
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ERROR_IO_PENDING
Definition: dderror.h:15
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
HANDLE hEvent
Definition: winbase.h:792
smooth NULL
Definition: ftsmooth.c:416
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
_In_ HANDLE Handle
Definition: extypes.h:390
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SEVERITY_ERROR
Definition: winerror.h:65
#define FACILITY_WIN32
Definition: winerror.h:27
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
_In_ FILTER_INFORMATION_CLASS _In_ ULONG _Out_ PULONG BytesReturned
Definition: fltkernel.h:1716
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261

Referenced by CKsProxy::AdvisePeriodic(), CKsProxy::AdviseTime(), CBDADeviceControl::CheckChanges(), CKsClockForwarder_ThreadStartup(), CBDADeviceControl::CommitChanges(), CKsProxy::ConvertTimeFormat(), CBDADeviceControl::CreateTopology(), CKsProxy::GetAvailable(), CKsProxy::GetCapabilities(), CBDADeviceControl::GetControlNode(), CKsProxy::GetCurrentPosition(), CKsProxy::GetDuration(), CKsProxy::GetMediaSeekingFormats(), CBDADeviceControl::GetNodeDescriptors(), CBDADeviceControl::GetNodeInterfaces(), CBDADeviceControl::GetNodeTypes(), CKsProxy::GetNumberOfPins(), CKsProxy::GetPinCommunication(), CKsProxy::GetPinDataflow(), CBDAPinControl::GetPinID(), CKsProxy::GetPinInstanceCount(), CKsProxy::GetPinName(), CBDAPinControl::GetPinType(), CBDADeviceControl::GetPinTypes(), CKsProxy::GetPreroll(), CKsProxy::GetStopPosition(), CInputPin::GetSupportedSets(), COutputPin::GetSupportedSets(), CKsProxy::GetSupportedSets(), CKsProxy::GetTime(), CKsProxy::GetTimeFormat(), CKsNode::KsEvent(), CInputPin::KsEvent(), COutputPin::KsEvent(), CKsProxy::KsEvent(), KsGetMultiplePinFactoryItems(), CKsNode::KsMethod(), CInputPin::KsMethod(), COutputPin::KsMethod(), CKsProxy::KsMethod(), CKsNode::KsProperty(), CInputPin::KsProperty(), COutputPin::KsProperty(), CKsProxy::KsProperty(), CKsProxy::PerformClockProperty(), CKsClockForwarder::SetClockState(), CKsProxy::SetPinState(), CKsProxy::SetPositions(), CKsProxy::SetSyncSource(), CKsProxy::SetTimeFormat(), CBDADeviceControl::StartChanges(), and CKsProxy::Unadvise().

Variable Documentation

◆ CLSID_KsClockForwarder

const GUID CLSID_KsClockForwarder = {0x877e4351, 0x6fea, 0x11d0, {0xb8, 0x63, 0x00, 0xaa, 0x00, 0xa2, 0x16, 0xa1}}

Definition at line 14 of file ksproxy.cpp.

◆ CLSID_KsIBasicAudioInterfaceHandler

const GUID CLSID_KsIBasicAudioInterfaceHandler = {0xb9f8ac3e, 0x0f71, 0x11d2, {0xb7, 0x2c, 0x00, 0xc0, 0x4f, 0xb6, 0xbd, 0x3d}}

Definition at line 16 of file ksproxy.cpp.

◆ CLSID_KsQualityForwarder

const GUID CLSID_KsQualityForwarder = {0xe05592e4, 0xc0b5, 0x11d0, {0xa4, 0x39, 0x00, 0xa0, 0xc9, 0x22, 0x31, 0x96}}

Definition at line 15 of file ksproxy.cpp.

◆ InterfaceTable

INTERFACE_TABLE InterfaceTable[]
static
Initial value:
=
{
{&MEDIATYPE_Audio, CKsDataTypeHandler_Constructor},
{&IID_IVPConfig, CVPConfig_Constructor},
{&IID_IVPVBIConfig, CVPVBIConfig_Constructor},
{&CLSID_Proxy, CKsProxy_Constructor},
}
HRESULT WINAPI CKsBasicAudio_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)
Definition: basicaudio.cpp:272
HRESULT WINAPI CKsProxy_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)
Definition: proxy.cpp:3159
#define KSINTERFACESETID_Standard
Definition: ks.h:280
HRESULT WINAPI CVPConfig_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)
Definition: cvpconfig.cpp:336
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI CKsQualityForwarder_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)
const GUID CLSID_KsQualityForwarder
Definition: ksproxy.cpp:15
HRESULT WINAPI CVPVBIConfig_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)
const GUID CLSID_KsIBasicAudioInterfaceHandler
Definition: ksproxy.cpp:16
const GUID CLSID_KsClockForwarder
Definition: ksproxy.cpp:14
HRESULT WINAPI CKsDataTypeHandler_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)
Definition: datatype.cpp:228
HRESULT WINAPI CKsInterfaceHandler_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)
Definition: interface.cpp:478
HRESULT WINAPI CKsClockForwarder_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)

Definition at line 18 of file ksproxy.cpp.

Referenced by DllGetClassObject(), DllRegisterServer(), and DllUnregisterServer().