ReactOS  0.4.15-dev-2972-gda2a567
RtlAllocateHeap.c File Reference
#include "precomp.h"
#include <pseh/pseh2.h>
Include dependency graph for RtlAllocateHeap.c:

Go to the source code of this file.

Functions

 START_TEST (RtlAllocateHeap)
 

Variables

PVOID Buffers [0x100]
 

Function Documentation

◆ START_TEST()

START_TEST ( RtlAllocateHeap  )

Definition at line 14 of file RtlAllocateHeap.c.

15 {
16  USHORT i;
17  HANDLE hHeap;
18  BOOLEAN Aligned = TRUE;
20 
21  for (i = 0; i < 0x100; ++i)
22  {
23  Buffers[i] = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_CREATE_ALIGN_16, (i % 16 ) + 1);
24  ASSERT(Buffers[i] != NULL);
25  if (!((ULONG_PTR)Buffers[i] & 0xF))
26  {
27  Aligned = FALSE;
28  }
29  }
30 
31  for (i = 0; i < 0x100; ++i)
32  {
33  RtlFreeHeap(RtlGetProcessHeap(), 0, Buffers[i]);
34  }
35 
36  ok(Aligned == FALSE, "No unaligned address returned\n");
37 
38  Aligned = TRUE;
39  Parameters.Length = sizeof(Parameters);
41  if (hHeap == NULL)
42  {
43  return;
44  }
45 
46  for (i = 0; i < 0x100; ++i)
47  {
48  Buffers[i] = RtlAllocateHeap(hHeap, 0, (i % 16 ) + 1);
49  ASSERT(Buffers[i] != NULL);
50  if (!((ULONG_PTR)Buffers[i] & 0xF))
51  {
52  Aligned = FALSE;
53  }
54  }
55 
56  for (i = 0; i < 0x100; ++i)
57  {
58  RtlFreeHeap(hHeap, 0, Buffers[i]);
59  }
60 
61  RtlDestroyHeap(hHeap);
62 
63  ok(Aligned == TRUE, "Unaligned address returned\n");
64 
65  _SEH2_TRY
66  {
67  hHeap = RtlCreateHeap(HEAP_CREATE_ALIGN_16, NULL, 0, 0, NULL, (PRTL_HEAP_PARAMETERS)(ULONG_PTR)0xdeadbeefdeadbeefULL);
68  }
70  {
71  hHeap = INVALID_HANDLE_VALUE;
72  }
73  _SEH2_END;
74 
75  ok(hHeap == NULL, "Unexpected heap value: %p\n", hHeap);
76 }
#define HEAP_CREATE_ALIGN_16
Definition: nt_native.h:1701
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:863
#define TRUE
Definition: types.h:120
PVOID Buffers[0x100]
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
_SEH2_TRY
Definition: create.c:4226
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
NTSYSAPI PVOID NTAPI RtlDestroyHeap(IN PVOID HeapHandle)
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
#define ASSERT(a)
Definition: mode.c:44
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
NTSYSAPI PVOID NTAPI RtlCreateHeap(IN ULONG Flags, IN PVOID HeapBase OPTIONAL, IN ULONG ReserveSize OPTIONAL, IN ULONG CommitSize OPTIONAL, IN PVOID Lock OPTIONAL, IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL)
_SEH2_END
Definition: create.c:4400
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
Definition: glfuncs.h:248
unsigned short USHORT
Definition: pedump.c:61
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40

Variable Documentation

◆ Buffers

PVOID Buffers[0x100]