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.

30 lines
1.3 KiB

  1. #ifndef _INC_MEM
  2. #define _INC_MEM
  3. // wrappers for private allocations, near in 16 bits
  4. #define NearAlloc(cb) ((void NEAR*)LocalAlloc(LPTR, (cb)))
  5. #define NearReAlloc(pb, cb) ((void NEAR*)LocalReAlloc((HLOCAL)(pb), (cb), LMEM_MOVEABLE | LMEM_ZEROINIT))
  6. #define NearFree(pb) (LocalFree((HLOCAL)(pb)) ? FALSE : TRUE)
  7. #define NearSize(pb) LocalSize(pb)
  8. //
  9. // These macros are used in our controls, that in 32 bits we simply call
  10. // LocalAlloc as to have the memory associated with the process that created
  11. // it and as such will be cleaned up if the process goes away.
  12. //
  13. #ifdef DEBUG
  14. LPVOID WINAPI ControlAlloc(HANDLE hheap, DWORD cb);
  15. LPVOID WINAPI ControlReAlloc(HANDLE hheap, LPVOID pb, DWORD cb);
  16. BOOL WINAPI ControlFree(HANDLE hheap, LPVOID pb);
  17. SIZE_T WINAPI ControlSize(HANDLE hheap, LPVOID pb);
  18. #else // DEBUG
  19. #define ControlAlloc(hheap, cb) HeapAlloc((hheap), HEAP_ZERO_MEMORY, (cb))
  20. #define ControlReAlloc(hheap, pb, cb) HeapReAlloc((hheap), HEAP_ZERO_MEMORY, (pb),(cb))
  21. #define ControlFree(hheap, pb) HeapFree((hheap), 0, (pb))
  22. #define ControlSize(hheap, pb) HeapSize((hheap), 0, (LPCVOID)(pb))
  23. #endif // DEBUG
  24. BOOL Str_Set(LPTSTR *ppsz, LPCTSTR psz); // in the process heap
  25. #endif // !_INC_MEM