Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.6 KiB

  1. //==========================================================================;
  2. //
  3. // Copyright (c) Microsoft Corporation 1998-2000.
  4. //
  5. //--------------------------------------------------------------------------;
  6. //
  7. // Devices.cpp : Implementation of CDevices
  8. //
  9. #include "stdafx.h"
  10. #ifndef TUNING_MODEL_ONLY
  11. #include "Devices.h"
  12. static DWORD dwFetch;
  13. // note: the compiler is generating but never calling the code to construct these initializers so the pointers
  14. // are staying null. we work around this by providing a function which dynamically allocating them on the heap
  15. // and calling it in our dllmain.
  16. typedef enumerator_iterator<PQEnumVARIANT, CComVariant, IEnumVARIANT, VARIANT, std::allocator<VARIANT>::difference_type > EnumVARIANTIterator;
  17. std_arity0pmf<IEnumVARIANT, HRESULT> * EnumVARIANTIterator::Reset = NULL;
  18. std_arity1pmf<IEnumVARIANT, VARIANT *, HRESULT> * EnumVARIANTIterator::Next = NULL;
  19. #define DECLAREPMFS(coll) \
  20. std_arity1pmf<IMSVid##coll, IEnumVARIANT **, HRESULT> * VW##coll::Fetch = NULL
  21. #define INITPMFS(coll) \
  22. VW##coll::Fetch = new std_arity1pmf<IMSVid##coll, IEnumVARIANT **, HRESULT>(&IMSVid##coll::get__NewEnum)
  23. #define DELETEPMFS(coll) \
  24. delete VW##coll::Fetch
  25. DECLAREPMFS(InputDevices);
  26. DECLAREPMFS(OutputDevices);
  27. DECLAREPMFS(VideoRendererDevices);
  28. DECLAREPMFS(AudioRendererDevices);
  29. DECLAREPMFS(Features);
  30. DEFINE_EXTERN_OBJECT_ENTRY(CLSID_MSVidInputDevices, CInputDevices)
  31. DEFINE_EXTERN_OBJECT_ENTRY(CLSID_MSVidOutputDevices, COutputDevices)
  32. DEFINE_EXTERN_OBJECT_ENTRY(CLSID_MSVidVideoRendererDevices, CVideoRendererDevices)
  33. DEFINE_EXTERN_OBJECT_ENTRY(CLSID_MSVidAudioRendererDevices, CAudioRendererDevices)
  34. DEFINE_EXTERN_OBJECT_ENTRY(CLSID_MSVidFeatures, CFeatures)
  35. // work around compiler bug as per above description
  36. void CtorStaticVWDevicesFwdSeqPMFs(void) {
  37. INITPMFS(InputDevices);
  38. INITPMFS(OutputDevices);
  39. INITPMFS(VideoRendererDevices);
  40. INITPMFS(AudioRendererDevices);
  41. INITPMFS(Features);
  42. EnumVARIANTIterator::Reset = new std_arity0pmf<IEnumVARIANT, HRESULT>(&IEnumVARIANT::Reset);
  43. EnumVARIANTIterator::Next = new std_bndr_mf_1_3<std_arity3pmf<IEnumVARIANT, ULONG, VARIANT*, ULONG *, HRESULT> >(std_arity3_member(&IEnumVARIANT::Next), 1, &dwFetch);
  44. }
  45. // work around compiler bug as per above description
  46. void DtorStaticVWDevicesFwdSeqPMFs(void) {
  47. DELETEPMFS(InputDevices);
  48. DELETEPMFS(OutputDevices);
  49. DELETEPMFS(VideoRendererDevices);
  50. DELETEPMFS(AudioRendererDevices);
  51. DELETEPMFS(Features);
  52. delete EnumVARIANTIterator::Reset;
  53. delete EnumVARIANTIterator::Next;
  54. }
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CDevEnum
  57. #endif //TUNING_MODEL_ONLY
  58. // end of file - devices.cpp