|
|
1.1 root 1: /****************************************************************************\
2: *
3: * Presentation Manager Paint - PMPaint
4: * File: ALLOCMEM.C - Contains 32-bit substitutes for the PMWIN memory
5: * management routines.
6: * 09-02-89 Created.
7: *
8: \****************************************************************************/
9:
10: #define INCL_DOSMEMMGR
11: #define INCL_WINHEAP
12: #include <os2.h>
13: #include "allocmem.h"
14:
15: HHEAP WinCreateHeap(PBYTE pbHeapBase, ULONG cbHeap, ULONG cbGrow,
16: ULONG chMinDed, ULONG cbMaxDed, ULONG fOptions)
17: {
18: HHEAP hheap = (HHEAP)pbHeapBase;
19:
20: if (cbHeap == 0)
21: cbHeap = 65535;
22:
23: if (pbHeapBase == NULL) {
24:
25: // If no heap memory is specified, allocate a 64K block.
26:
27: if (DosAllocMem((PPVOID)&hheap, cbHeap, MEMFLAGS))
28: return(FALSE);
29: }
30:
31: // Initialize the heap.
32:
33: if (DosSubSet((PVOID)hheap, 1, cbHeap))
34: return(FALSE);
35:
36: return(hheap);
37:
38: /* Unreferenced formal parameters referenced here to prevent compiler
39: warning */
40: cbGrow;
41: chMinDed;
42: cbMaxDed;
43: fOptions;
44:
45: }
46:
47:
48: HHEAP WinDestroyHeap(HHEAP hHeap)
49: {
50: // WinCreateHeap should toss something at the head of the heap
51: // so WinDestroyHeap can know whether to DosFreeMem it or not.
52:
53: return(hHeap);
54: }
55:
56:
57: ULONG WinAvailMem(HHEAP hHeap, BOOL fCompact, ULONG cbMinFree)
58: {
59: return(0);
60:
61: /* Unreferenced formal parameters referenced here to prevent compiler
62: warning */
63: hHeap;
64: fCompact;
65: cbMinFree;
66:
67: }
68:
69:
70: PBYTE WinAllocMem(HHEAP hHeap, ULONG cb)
71: {
72: PBYTE pbT;
73:
74: if (DosSubAlloc((PVOID)hHeap, (PPVOID)&pbT, cb))
75: return(FALSE);
76:
77: return(pbT);
78: }
79:
80:
81: PBYTE WinReallocMem(HHEAP hHeap, PBYTE pMem, ULONG cbOld, ULONG cbNew)
82: {
83: return(FALSE);
84:
85: /* Unreferenced formal parameters referenced here to prevent compiler
86: warning */
87: hHeap;
88: pMem;
89: cbOld;
90: cbNew;
91:
92: }
93:
94:
95: PBYTE WinFreeMem(HHEAP hHeap, PBYTE pMem, ULONG cbMem)
96: {
97: if (DosSubFree((PVOID)hHeap, (PVOID)pMem, cbMem))
98: return(FALSE);
99:
100: return(pMem);
101: }
102:
103:
104: PVOID WinLockHeap(HHEAP hHeap)
105: {
106: return((PVOID)hHeap);
107: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.