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.

56 lines
1.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: I D E L E G A T E . C P P
  7. //
  8. // Contents: IDelegateFolder implementation fopr CUPnPDeviceFolder
  9. //
  10. // Notes:
  11. //
  12. // Author: jeffspr 22 Sep 1997
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #pragma hdrstop
  17. //+---------------------------------------------------------------------------
  18. //
  19. // Member: CUPnPDeviceFolder::SetItemAlloc
  20. //
  21. // Purpose: IDelegateFolder::SetItemAlloc implementation for
  22. // CUPnPDeviceFolder
  23. //
  24. // Arguments:
  25. // pmalloc [in] Our new allocator for creating delegate items
  26. //
  27. // Returns:
  28. //
  29. // Author: jeffspr 22 Sep 1997
  30. //
  31. // Notes:
  32. //
  33. STDMETHODIMP
  34. CUPnPDeviceFolder::SetItemAlloc(
  35. IMalloc *pMalloc)
  36. {
  37. if (m_pDelegateMalloc) m_pDelegateMalloc->Release();
  38. if (pMalloc)
  39. {
  40. m_cbDelegate = FIELD_OFFSET(DELEGATEITEMID, rgb);
  41. }
  42. else /* Not delegating, use regular malloc */
  43. {
  44. m_cbDelegate = 0;
  45. pMalloc = m_pMalloc;
  46. }
  47. m_pDelegateMalloc = pMalloc;
  48. m_pDelegateMalloc->AddRef();
  49. return S_OK;
  50. }