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.

38 lines
766 B

  1. // Copyright (c) 1994 Microsoft Corporation
  2. /*
  3. gmem.h
  4. This module supplies macros for fixed global memory
  5. allocation compatible with those used in the Multimedia
  6. extensions to Windows 3.x. It is included to simplify
  7. porting of the Windows 3.x 16 bit code.
  8. Jul-16-91 NigelT
  9. */
  10. #ifndef _GMEMMACROS_
  11. #define _GMEMMACROS_
  12. __inline LPBYTE GlobalAllocPtr(DWORD flags, DWORD cb)
  13. {
  14. HANDLE h;
  15. LPBYTE lp = NULL;
  16. h = GlobalAlloc(flags, cb);
  17. if (h) {
  18. lp = GlobalLock(h);
  19. }
  20. return(lp);
  21. }
  22. #define GlobalFreePtr(lp) \
  23. { \
  24. HANDLE h; \
  25. h = GlobalHandle(lp); \
  26. if (GlobalUnlock(h)) { \
  27. /* memory still locked!! */ \
  28. } \
  29. h = GlobalFree(h); \
  30. }
  31. #endif // _GMEMMACROS_