|
|
Microsoft OS/2 SDK 2.0 05-30-1990
/****************************************************************************\
*
* Presentation Manager Paint - PMPaint
* File: ALLOCMEM.C - Contains 32-bit substitutes for the PMWIN memory
* management routines.
* 09-02-89 Created.
*
\****************************************************************************/
#define INCL_DOSMEMMGR
#define INCL_WINHEAP
#include <os2.h>
#include "allocmem.h"
HHEAP WinCreateHeap(PBYTE pbHeapBase, ULONG cbHeap, ULONG cbGrow,
ULONG chMinDed, ULONG cbMaxDed, ULONG fOptions)
{
HHEAP hheap = (HHEAP)pbHeapBase;
if (cbHeap == 0)
cbHeap = 65535;
if (pbHeapBase == NULL) {
// If no heap memory is specified, allocate a 64K block.
if (DosAllocMem((PPVOID)&hheap, cbHeap, MEMFLAGS))
return(FALSE);
}
// Initialize the heap.
if (DosSubSet((PVOID)hheap, 1, cbHeap))
return(FALSE);
return(hheap);
/* Unreferenced formal parameters referenced here to prevent compiler
warning */
cbGrow;
chMinDed;
cbMaxDed;
fOptions;
}
HHEAP WinDestroyHeap(HHEAP hHeap)
{
// WinCreateHeap should toss something at the head of the heap
// so WinDestroyHeap can know whether to DosFreeMem it or not.
return(hHeap);
}
ULONG WinAvailMem(HHEAP hHeap, BOOL fCompact, ULONG cbMinFree)
{
return(0);
/* Unreferenced formal parameters referenced here to prevent compiler
warning */
hHeap;
fCompact;
cbMinFree;
}
PBYTE WinAllocMem(HHEAP hHeap, ULONG cb)
{
PBYTE pbT;
if (DosSubAlloc((PVOID)hHeap, (PPVOID)&pbT, cb))
return(FALSE);
return(pbT);
}
PBYTE WinReallocMem(HHEAP hHeap, PBYTE pMem, ULONG cbOld, ULONG cbNew)
{
return(FALSE);
/* Unreferenced formal parameters referenced here to prevent compiler
warning */
hHeap;
pMem;
cbOld;
cbNew;
}
PBYTE WinFreeMem(HHEAP hHeap, PBYTE pMem, ULONG cbMem)
{
if (DosSubFree((PVOID)hHeap, (PVOID)pMem, cbMem))
return(FALSE);
return(pMem);
}
PVOID WinLockHeap(HHEAP hHeap)
{
return((PVOID)hHeap);
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.