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.

79 lines
1.6 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 "sdpsadt.h"
  9. #include "sdpadtex.h"
  10. HRESULT
  11. SDP_ADDRESS_TEXT_SAFEARRAY::GetSafeArray(
  12. OUT VARIANT *AddressVariant,
  13. OUT VARIANT *TextVariant
  14. )
  15. {
  16. VARIANT *VariantArray[] = {AddressVariant, TextVariant};
  17. return GetSafeArrays(
  18. (DWORD)m_TList.GetSize(),
  19. sizeof(VariantArray)/sizeof(VARIANT *),
  20. m_VarType,
  21. VariantArray
  22. );
  23. }
  24. BOOL
  25. SDP_ADDRESS_TEXT_SAFEARRAY::Get(
  26. IN SDP_ADDRESS_TEXT &ListMember,
  27. IN ULONG NumEntries,
  28. IN void **Element,
  29. OUT HRESULT &HResult
  30. )
  31. {
  32. ASSERT(2 == NumEntries);
  33. Element[0] = NULL;
  34. HResult = ListMember.GetAddress().GetBstr((BSTR *)&Element[0]);
  35. if ( FAILED(HResult) )
  36. {
  37. return FALSE;
  38. }
  39. Element[1] = NULL;
  40. HResult = ListMember.GetText().GetBstr((BSTR *)&Element[1]);
  41. return SUCCEEDED(HResult);
  42. }
  43. BOOL
  44. SDP_ADDRESS_TEXT_SAFEARRAY::Set(
  45. IN SDP_ADDRESS_TEXT &ListMember,
  46. IN ULONG NumEntries,
  47. IN void ***Element,
  48. OUT HRESULT &HResult
  49. )
  50. {
  51. ASSERT(2 == NumEntries);
  52. // a null element in the FIRST safearray means that no more entries are present
  53. if ( (NULL == Element[0]) || (NULL == *(Element[0])) )
  54. {
  55. HResult = S_OK;
  56. return FALSE;
  57. }
  58. HResult = ListMember.SetAddressTextValues(*((BSTR *)Element[0]), *((BSTR *)Element[1]));
  59. return SUCCEEDED(HResult);
  60. }