|
|
1.1 root 1: /*
2: gmem.h
3:
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:
9: Jul-16-91 NigelT
10:
11: */
12:
13: #ifndef _GMEMMACROS_
14: #define _GMEMMACROS_
15:
16: #define GAllocPtr(ul) GlobalAlloc(GPTR,(ul))
17: #define GAllocPtrF(f,ul) GlobalAlloc(GPTR,(ul))
18: #define GReAllocPtr(lp,ul) GlobalReAlloc((HANDLE)(lp),(ul),GPTR)
19: #define GFreePtr(lp) GlobalFree((HANDLE)(lp))
20:
21: #define GlobalAllocPtrF(f,ul) GlobalAlloc(GPTR,(ul))
22: //#define GlobalReAllocPtr(lp,ul,f) GlobalReAlloc((HANDLE)(lp),(ul),GPTR)
23:
24: #define GlobalPtrHandle(h) (GlobalHandle(h))
25:
26: /* the following are extracts from 3.1 WindowsX.h */
27: #define GlobalUnlockPtr(lp) \
28: GlobalUnlock(GlobalPtrHandle(lp))
29:
30: #define GlobalAllocPtr(flags, cb) \
31: (GlobalLock(GlobalAlloc((flags), (cb))))
32:
33: #define GlobalReAllocPtr(lp, cbNew, flags) \
34: (GlobalUnlockPtr(lp), GlobalLock(GlobalReAlloc(GlobalPtrHandle(lp) , (cbNew), (flags))))
35:
36: #define GlobalFreePtr(lp) \
37: (GlobalUnlockPtr(lp), (BOOL)GlobalFree(GlobalPtrHandle(lp)))
38:
39: #endif // _GMEMMACROS_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.