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.3 KiB

  1. #if !defined( _OLEMEM_H_ )
  2. #define _OLEMEM_H_
  3. // All the following Global calls deal with LPSTR
  4. #ifdef _MAC
  5. pascal DWORD OleGlobalSize(HANDLE);
  6. pascal LPSTR OleGlobalAlloc(WORD, DWORD);
  7. pascal BOOL OleGlobalFree(LPSTR); // true success, false fail
  8. pascal LPSTR OleGlobalLock(HANDLE);
  9. pascal BOOL OleGlobalUnlock(LPSTR); // true success, false fail
  10. #else
  11. #define OleGlobalAlloc(flags,dwSize) ( \
  12. Win(GlobalLock(GlobalAlloc(flags, dwSize)))\
  13. )
  14. #define OleGlobalFree(lp) ( \
  15. Win(GlobalFree((HANDLE)GlobalHandle((__segment)lp))) \
  16. )
  17. #define OleGlobalLock(hMem) ( \
  18. Win(GlobalLock(hMem))\
  19. )
  20. #define OleGlobalUnlock(lp) ( \
  21. Win(GlobalUnlock((HANDLE)GlobalHandle((__segment)lp))) \
  22. )
  23. #endif
  24. #ifndef _MAC // Windows
  25. // All the following Local calls deal with PSTR
  26. #define OleLocalAlloc(flags,wSize) (LocalLock(LocalAlloc(flags, wSize)))
  27. #define OleLocalFree(np) {\
  28. LocalUnlock((HANDLE)LocalHandle((WORD)np)); \
  29. LocalFree((HANDLE)LocalHandle((WORD)np)); \
  30. }
  31. #define OleLocalLock(hMem) (LocalLock(hMem))
  32. #define OleLocalUnlock(np) (LocalUnlock((HANDLE)LocalHandle((WORD)np)))
  33. #else // MAC
  34. #define OleLocalAlloc(flags,wSize) OleGlobalAlloc(flags, wSize)
  35. #define OleLocalFree (ptr) OleGlobalFree(ptr)
  36. #define OleLocalLock(hMem) OleGlobalLock(hMem)
  37. #define OleLocalUnlock(ptr) OleGlobalUnlock(ptr)
  38. #endif
  39. #endif // _OLEMEM_H