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.

83 lines
1.8 KiB

  1. /*
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. */
  4. #include "sdppch.h"
  5. #include <afxdisp.h>
  6. #include <winerror.h>
  7. #include <oleauto.h>
  8. #include "sdpstp.h"
  9. #include "sdptime.h"
  10. HRESULT
  11. SDP_TIME_PERIOD_SAFEARRAY::GetSafeArray(
  12. OUT VARIANT *IsCompactVariant,
  13. OUT VARIANT *UnitVariant,
  14. OUT VARIANT *CompactValueVariant,
  15. OUT VARIANT *PeriodValueVariant
  16. )
  17. {
  18. VARIANT *VariantArray[] = {
  19. IsCompactVariant, UnitVariant,
  20. CompactValueVariant, PeriodValueVariant
  21. };
  22. return GetSafeArrays(
  23. (ULONG)m_TList.GetSize(),
  24. sizeof(VariantArray)/sizeof(VARIANT *),
  25. m_VarType,
  26. VariantArray
  27. );
  28. }
  29. BOOL
  30. SDP_TIME_PERIOD_SAFEARRAY::Get(
  31. IN SDP_TIME_PERIOD &ListMember,
  32. IN ULONG NumEntries,
  33. IN void **Element,
  34. OUT HRESULT &HResult
  35. )
  36. {
  37. ASSERT(4 == NumEntries);
  38. BOOL IsCompact;
  39. ListMember.Get(IsCompact, m_Unit, m_CompactValue, m_PeriodValue);
  40. m_IsCompact = (IsCompact) ? VARIANT_TRUE: VARIANT_FALSE;
  41. Element[0] = &m_IsCompact;
  42. Element[1] = &m_Unit;
  43. Element[2] = &m_CompactValue;
  44. Element[3] = &m_PeriodValue;
  45. HResult = S_OK;
  46. return TRUE;
  47. }
  48. BOOL
  49. SDP_TIME_PERIOD_SAFEARRAY::Set(
  50. IN SDP_TIME_PERIOD &ListMember,
  51. IN ULONG NumEntries,
  52. IN void ***Element,
  53. OUT HRESULT &HResult
  54. )
  55. {
  56. ASSERT(4 == NumEntries);
  57. BOOL IsCompact = (VARIANT_FALSE == (VARIANT_BOOL)*(Element[0])) ? FALSE : TRUE;
  58. ListMember.Set(
  59. IsCompact,
  60. *((CHAR *)Element[1]),
  61. *((LONG *)Element[2]),
  62. *((LONG *)Element[3])
  63. );
  64. return SUCCEEDED(HResult);
  65. }