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.

59 lines
1.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: dpaddressobj.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. #include "stdafx.h"
  11. #include "Direct.h"
  12. #include "dms.h"
  13. #include "DPAddressObj.h"
  14. CONSTRUCTOR_STRUCT(_dxj_DPAddress, {init();})
  15. DESTRUCTOR_STRUCT(_dxj_DPAddress, {cleanUp();})
  16. void C_dxj_DPAddressObject::init() {
  17. m_pAddress=NULL;
  18. m_size=0;
  19. }
  20. void C_dxj_DPAddressObject::cleanUp() {
  21. //DPF(DPF_VERRBOSE,"_dxj_DPAddress object being destroyed");
  22. if (m_pAddress) free (m_pAddress);
  23. m_size=0;
  24. }
  25. HRESULT C_dxj_DPAddressObject::setAddress(
  26. /* [in] */ long pAddress,
  27. /* [in] */ long length) {
  28. if (m_pAddress) free (m_pAddress);
  29. m_pAddress=NULL;
  30. m_pAddress=malloc((DWORD)length);
  31. if (m_pAddress==NULL) return E_OUTOFMEMORY;
  32. if (pAddress==NULL) return E_FAIL;
  33. memcpy((void*)m_pAddress,(void*)pAddress,length);
  34. m_size=(DWORD)length;
  35. return S_OK;
  36. }
  37. HRESULT C_dxj_DPAddressObject::getAddress(
  38. /* [out] */ long *pAddress,
  39. /* [out] */ long *length) {
  40. *pAddress=(long)PtrToLong(m_pAddress); //bugbug SUNDOWN- sundown wont be able to do this
  41. //will need to implement new non VB interface to get at this functionality internally
  42. *length=(long)m_size;
  43. return S_OK;
  44. }