1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/*++
Copyright (c) 1992 Microsoft Corporation
Module Name:
suballoc.h
Abstract:
This is the public include file for the suballocation
package.
Author:
Dave Hastings (daveh) creation-date 25-Jan-1994
Revision History:
--*/
//
// Constants
//
//
// Minimum granularity for the commit routine
// this is done as a constant rather than a parameter
// to make defining data structures easier
//
#ifdef i386
#define COMMIT_GRANULARITY 4096
#else
#define COMMIT_GRANULARITY 65536
#endif
//
// Types
//
//
// Routine for committing a specific region of of the address
// space. Although the return type is NTSTATUS, the only value
// that is checked is 0 (for STATUS_SUCCESS). If STATUS_SUCCESS
// is returned, it is assumed that the function worked. If not,
// it is assumed that it failed. No special meaning is attached to
// particular non-zero values.
//
typedef
NTSTATUS
(*PSACOMMITROUTINE)(
ULONG BaseAddress,
ULONG Size
);
//
// Routine for moving memory around in the address space.
// Note: This routine MUST correctly handle overlapping
// source and destination
//
typedef
VOID
(*PSAMEMORYMOVEROUTINE)(
ULONG Destination,
ULONG Source,
ULONG Size
);
//
// Public prototypes
//
PVOID
SAInitialize(
ULONG BaseAddress,
ULONG Size,
PSACOMMITROUTINE CommitRoutine,
PSACOMMITROUTINE DecommitRoutine,
PSAMEMORYMOVEROUTINE MemoryMoveRoutine
);
BOOL
SAQueryFree(
PVOID SubAllocation,
PULONG FreeBytes,
PULONG LargestFreeBlock
);
BOOL
SAAllocate(
PVOID SubAllocation,
ULONG Size,
PULONG Address
);
BOOL
SAFree(
PVOID SubAllocation,
ULONG Size,
ULONG Address
);
BOOL
SAReallocate(
PVOID SubAllocation,
ULONG OriginalSize,
ULONG OriginalAddress,
ULONG NewSize,
PULONG NewAddress
);
|