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.

67 lines
1.3 KiB

  1. /*
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. */
  4. #include "sdppch.h"
  5. #include "sdpbstrl.h"
  6. #include <oleauto.h>
  7. #include "sdpsatt.h"
  8. #include "sdpatt.h"
  9. HRESULT
  10. SDP_ATTRIBUTE_SAFEARRAY::GetSafeArray(
  11. OUT VARIANT *Variant
  12. )
  13. {
  14. return SDP_SAFEARRAY_WRAP::GetSafeArrays((DWORD)m_TList.GetSize(), 1, m_VarType, &Variant);
  15. }
  16. BOOL
  17. SDP_ATTRIBUTE_SAFEARRAY::Get(
  18. IN SDP_CHAR_STRING_LINE &ListMember,
  19. IN ULONG NumEntries,
  20. IN void **Element,
  21. OUT HRESULT &HResult
  22. )
  23. {
  24. ASSERT(1 == NumEntries);
  25. Element[0] = NULL;
  26. HResult = ListMember.GetBstring().GetBstr((BSTR *)&Element[0]);
  27. return SUCCEEDED(HResult);
  28. }
  29. BOOL
  30. SDP_ATTRIBUTE_SAFEARRAY::Set(
  31. IN SDP_CHAR_STRING_LINE &ListMember,
  32. IN ULONG NumEntries,
  33. IN void ***Element,
  34. OUT HRESULT &HResult
  35. )
  36. {
  37. ASSERT(1 == NumEntries);
  38. // a null element in the FIRST safearray means that no more entries are present
  39. if ( (NULL == Element[0]) || (NULL == *(Element[0])) )
  40. {
  41. HResult = S_OK;
  42. return FALSE;
  43. }
  44. HResult = ListMember.SetBstr(*((BSTR *)Element[0]));
  45. return SUCCEEDED(HResult);
  46. }