Leaked source code of windows server 2003
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.

127 lines
3.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: dmsegmentstateobj.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. // dmPerformanceObj.cpp
  11. #include "dmusici.h"
  12. #include "dmusicc.h"
  13. #include "dmusicf.h"
  14. #include "stdafx.h"
  15. #include "Direct.h"
  16. #include "dms.h"
  17. #include "dmSegmentStateObj.h"
  18. #include "dmSegmentObj.h"
  19. extern void *g_dxj_DirectMusicSegmentState;
  20. extern void *g_dxj_DirectMusicSegment;
  21. extern HRESULT BSTRtoGUID(LPGUID,BSTR);
  22. CONSTRUCTOR(_dxj_DirectMusicSegmentState, {});
  23. DESTRUCTOR(_dxj_DirectMusicSegmentState, {});
  24. GETSET_OBJECT(_dxj_DirectMusicSegmentState);
  25. HRESULT C_dxj_DirectMusicSegmentStateObject::getRepeats( long __RPC_FAR *repeats)
  26. {
  27. HRESULT hr;
  28. hr=m__dxj_DirectMusicSegmentState->GetRepeats((DWORD*)repeats);
  29. return hr;
  30. }
  31. HRESULT C_dxj_DirectMusicSegmentStateObject::getSeek( long __RPC_FAR *seek)
  32. {
  33. HRESULT hr;
  34. hr=m__dxj_DirectMusicSegmentState->GetSeek(seek);
  35. return hr;
  36. }
  37. HRESULT C_dxj_DirectMusicSegmentStateObject::getStartPoint( long __RPC_FAR *t)
  38. {
  39. HRESULT hr;
  40. hr=m__dxj_DirectMusicSegmentState->GetStartPoint(t);
  41. return hr;
  42. }
  43. HRESULT C_dxj_DirectMusicSegmentStateObject::getStartTime( long __RPC_FAR *t)
  44. {
  45. HRESULT hr;
  46. hr=m__dxj_DirectMusicSegmentState->GetStartTime(t);
  47. return hr;
  48. }
  49. HRESULT CREATE_DMSEGMENT_NOADDREF(IDirectMusicSegment *pSeg,I_dxj_DirectMusicSegment **segment)
  50. {
  51. C_dxj_DirectMusicSegmentObject *prev=NULL;
  52. *segment = NULL;
  53. for(
  54. C_dxj_DirectMusicSegmentObject
  55. *ptr=(C_dxj_DirectMusicSegmentObject *)g_dxj_DirectMusicSegment;
  56. ptr;
  57. ptr=(C_dxj_DirectMusicSegmentObject *)ptr->nextobj
  58. )
  59. {
  60. IUnknown *unk=0;
  61. ptr->InternalGetObject(&unk);
  62. if(unk == pSeg)
  63. {
  64. *segment = (I_dxj_DirectMusicSegment*)ptr->pinterface;
  65. IUNK(ptr->pinterface)->AddRef();
  66. break;
  67. }
  68. prev = ptr;
  69. }
  70. if(!ptr)
  71. {
  72. C_dxj_DirectMusicSegmentObject *c=new CComObject<C_dxj_DirectMusicSegmentObject>;
  73. if( c == NULL )
  74. {
  75. pSeg->Release();
  76. return E_FAIL;
  77. }
  78. c->InternalSetObject(pSeg);
  79. if FAILED(((I_dxj_DirectMusicSegment *)c)->QueryInterface(IID_I_dxj_DirectMusicSegment, (void **)segment))
  80. {
  81. return E_FAIL;
  82. }
  83. if (!(*segment)) return E_FAIL;
  84. c->pinterface = (void*)*segment;
  85. }
  86. return S_OK;
  87. }
  88. HRESULT C_dxj_DirectMusicSegmentStateObject::getSegment(
  89. /* [retval][out] */ I_dxj_DirectMusicSegment __RPC_FAR *__RPC_FAR *segment)
  90. {
  91. HRESULT hr;
  92. IDirectMusicSegment *pSeg=NULL;
  93. if(!segment) return E_INVALIDARG;
  94. hr=m__dxj_DirectMusicSegmentState->GetSegment(&pSeg);
  95. if FAILED(hr) return hr;
  96. //INTERNAL_CREATE_NOADDREF(_dxj_DirectMusicSegment,pSeg,segment);
  97. hr= CREATE_DMSEGMENT_NOADDREF(pSeg,segment);
  98. if FAILED(hr) return hr;
  99. if (*segment==NULL) return E_OUTOFMEMORY;
  100. return hr;
  101. }