#include <kmt_test.h>
#include <debug.h>
Go to the source code of this file.
◆ BASE_POOL_TYPE_MASK
◆ NDEBUG
◆ QUOTA_POOL_MASK
◆ TAG_POOLTEST
◆ GetRefCount()
Definition at line 20 of file ExPools.c.
22{
24 return Header->PointerCount;
25}
#define OBJECT_TO_OBJECT_HEADER(o)
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
Referenced by TestPoolQuota().
◆ PoolsCorruption()
Definition at line 112 of file ExPools.c.
113{
116
117
118 AllocSize = 4096 + 0x10;
120
121
123
124
125
126#ifdef THIS_DOESNT_WORK
127
129 {
131
132 *TestPtr = 0xd33dbeef;
133 }
135 {
136
139
141
142
144 {
145 Ptr[2020] = 0xdeadb33f;
146 }
148 {
149
152
154#endif
155
156
158}
#define ExAllocatePoolWithTag(hernya, size, tag)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
#define EXCEPTION_EXECUTE_HANDLER
#define ExFreePoolWithTag(_P, _T)
#define STATUS_ACCESS_VIOLATION
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define RtlZeroMemory(Destination, Length)
Referenced by START_TEST().
◆ PoolsTest()
Definition at line 27 of file ExPools.c.
28{
30 ULONG AllocSize,
i, AllocNumber;
32
33
34 for (
i=1;
i<10000;
i++)
35 {
36
38
40 AllocSize++;
41
43 AllocSize += 13;
44
45
47
48
50
51
53
54
56 }
57
58
59 for (
i=1;
i<10000;
i++)
60 {
61
63
65 AllocSize++;
66
68 AllocSize += 13;
69
70
72
73
75
76
78
79
81 }
82
83
84
85
86
87
88
89
90
91
92 AllocNumber = 100000;
94
95
96 for (
i=0;
i<AllocNumber;
i++)
97 {
98 AllocSize = 42;
100 }
101
102
103 for (
i=0;
i<AllocNumber;
i++)
104 {
106 }
107
108
110}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define RtlFillMemory(Dest, Length, Fill)
Referenced by START_TEST().
◆ START_TEST()
Definition at line 308 of file ExPools.c.
309{
315}
static VOID PoolsTest(VOID)
static VOID PoolsCorruption(VOID)
static VOID TestBigPoolExpansion(VOID)
static VOID TestPoolTags(VOID)
static VOID TestPoolQuota(VOID)
◆ TestBigPoolExpansion()
static VOID TestBigPoolExpansion |
( |
VOID |
| ) |
|
|
static |
Definition at line 269 of file ExPools.c.
270{
272 PVOID *BigAllocations;
273 const ULONG MaxAllocations = 1024 * 128;
274 ULONG NumAllocations;
275
277 {
279 MaxAllocations * sizeof(*BigAllocations),
280 'ABmK');
281
282
283 for (NumAllocations = 0; NumAllocations < MaxAllocations; NumAllocations++)
284 {
287 'aPmK');
288 if (BigAllocations[NumAllocations] ==
NULL)
289 {
290 NumAllocations--;
291 break;
292 }
293 }
294
295 trace(
"Got %lu allocations for PoolType %d\n", NumAllocations,
PoolType);
296
297
298 for (; NumAllocations < MaxAllocations; NumAllocations--)
299 {
300 ASSERT(BigAllocations[NumAllocations] !=
NULL);
302 'aPmK');
303 }
305 }
306}
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Referenced by START_TEST().
◆ TestPoolQuota()
Definition at line 189 of file ExPools.c.
190{
194 LONG InitialRefCount;
197
199
200
201
204 'tQmK');
205 ok(
Memory !=
NULL,
"ExAllocatePoolWithQuotaTag returned NULL\n");
207 {
209 "Allocation %p is badly aligned\n",
213
214
217
218
224
228 }
229
230
233 'tQmK');
234 ok(
Memory !=
NULL,
"ExAllocatePoolWithQuotaTag returned NULL\n");
236 {
238 "Allocation %p is badly aligned\n",
245 }
246
247
250 0x7FFFFFFF,
251 'tQmK');
255
256
259 0x7FFFFFFF,
260 'tQmK');
265}
#define BASE_POOL_TYPE_MASK
static LONG GetRefCount(_In_ PVOID Object)
#define ok_eq_pointer(value, expected)
#define ok_eq_long(value, expected)
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
#define KmtEndSeh(ExpectedStatus)
USHORT KmtGetPoolType(PVOID Memory)
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
#define ExAllocatePoolWithQuotaTag(a, b, c)
#define POOL_QUOTA_FAIL_INSTEAD_OF_RAISE
#define PsGetCurrentProcess
static unsigned int block
Referenced by START_TEST().
◆ TestPoolTags()
Definition at line 162 of file ExPools.c.
163{
165
169
173
177
181
185}
#define ok_eq_tag(value, expected)
ULONG KmtGetPoolTag(PVOID Memory)
Referenced by START_TEST().