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
1.5 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 "sdpbstrl.h"
  9. #include "sdpsobst.h"
  10. SDP_FIELD *
  11. SDP_OPT_BSTRING_LIST::CreateElement(
  12. )
  13. {
  14. SDP_OPTIONAL_BSTRING *SdpOptionalBString;
  15. try
  16. {
  17. SdpOptionalBString = new SDP_OPTIONAL_BSTRING();
  18. }
  19. catch(...)
  20. {
  21. SdpOptionalBString = NULL;
  22. }
  23. return SdpOptionalBString;
  24. }
  25. HRESULT
  26. SDP_OPT_BSTRING_SAFEARRAY::GetSafeArray(
  27. OUT VARIANT *OptBstringVariant
  28. )
  29. {
  30. VARIANT *VariantArray[] = {OptBstringVariant};
  31. return GetSafeArrays(
  32. (ULONG) m_TList.GetSize(),
  33. sizeof(VariantArray)/sizeof(VARIANT *),
  34. m_VarType,
  35. VariantArray
  36. );
  37. }
  38. BOOL
  39. SDP_OPT_BSTRING_SAFEARRAY::Get(
  40. IN SDP_OPTIONAL_BSTRING &ListMember,
  41. IN ULONG NumEntries,
  42. IN void **Element,
  43. OUT HRESULT &HResult
  44. )
  45. {
  46. ASSERT(1 == NumEntries);
  47. Element[0] = NULL;
  48. HResult = ListMember.GetBstr((BSTR *)&Element[0]);
  49. return SUCCEEDED(HResult);
  50. }
  51. BOOL
  52. SDP_OPT_BSTRING_SAFEARRAY::Set(
  53. IN SDP_OPTIONAL_BSTRING &ListMember,
  54. IN ULONG NumEntries,
  55. IN void ***Element,
  56. OUT HRESULT &HResult
  57. )
  58. {
  59. ASSERT(1 == NumEntries);
  60. HResult = ListMember.SetBstr(*((BSTR *)Element[0]));
  61. return SUCCEEDED(HResult);
  62. }