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
804 B
38 lines
804 B
// Copyright (c) 1994 Microsoft Corporation
|
|
/*
|
|
gmem.h
|
|
|
|
This module supplies macros for fixed global memory
|
|
allocation compatible with those used in the Multimedia
|
|
extensions to Windows 3.x. It is included to simplify
|
|
porting of the Windows 3.x 16 bit code.
|
|
|
|
Jul-16-91 NigelT
|
|
|
|
*/
|
|
|
|
#ifndef _GMEMMACROS_
|
|
#define _GMEMMACROS_
|
|
|
|
__inline LPBYTE GlobalAllocPtr(DWORD flags, DWORD cb)
|
|
{
|
|
HANDLE h;
|
|
LPBYTE lp = NULL;
|
|
h = GlobalAlloc(flags, cb);
|
|
if (h) {
|
|
lp = GlobalLock(h);
|
|
}
|
|
return(lp);
|
|
}
|
|
|
|
|
|
#define GlobalFreePtr(lp) \
|
|
{ \
|
|
HANDLE h; \
|
|
h = GlobalHandle(lp); \
|
|
if (GlobalUnlock(h)) { \
|
|
/* memory still locked!! */ \
|
|
} \
|
|
h = GlobalFree(h); \
|
|
}
|
|
#endif // _GMEMMACROS_
|