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.

44 lines
947 B

  1. /*****************************************************************************
  2. *
  3. * mem.c - Memory management
  4. *
  5. * WARNING! These do not go through OLE allocation. Use these
  6. * only for private allocation.
  7. *
  8. *****************************************************************************/
  9. #include "fnd.h"
  10. #ifdef _WIN64
  11. #pragma pack(push,8)
  12. #endif // _WIN64
  13. /*****************************************************************************
  14. *
  15. * AllocCbPpv
  16. *
  17. * Allocate memory into the ppv.
  18. *
  19. *****************************************************************************/
  20. STDMETHODIMP EXTERNAL
  21. AllocCbPpv(UINT cb, PPV ppv)
  22. {
  23. HRESULT hres;
  24. #ifdef _WIN64
  25. UINT cb1 = LcbAlignLcb(cb);
  26. *ppv = LocalAlloc(LPTR, cb1);
  27. #else
  28. *ppv = LocalAlloc(LPTR, cb);
  29. #endif // _WIN64
  30. hres = *ppv ? NOERROR : E_OUTOFMEMORY;
  31. return hres;
  32. }
  33. #ifdef _WIN64
  34. #pragma pack(pop)
  35. #endif //_WIN64