ReactOS  0.4.15-dev-1070-ge1a01de
RtlAllocateHeap.c File Reference
#include "precomp.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 12 of file RtlAllocateHeap.c.

13 {
14  USHORT i;
15  HANDLE hHeap;
16  BOOLEAN Aligned = TRUE;
18 
19  for (i = 0; i < 0x100; ++i)
20  {
21  Buffers[i] = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_CREATE_ALIGN_16, (i % 16 ) + 1);
22  ASSERT(Buffers[i] != NULL);
23  if (!((ULONG_PTR)Buffers[i] & 0xF))
24  {
25  Aligned = FALSE;
26  }
27  }
28 
29  for (i = 0; i < 0x100; ++i)
30  {
31  RtlFreeHeap(RtlGetProcessHeap(), 0, Buffers[i]);
32  }
33 
34  ok(Aligned == FALSE, "No unaligned address returned\n");
35 
36  Aligned = TRUE;
37  Parameters.Length = sizeof(Parameters);
39  if (hHeap == NULL)
40  {
41  return;
42  }
43 
44  for (i = 0; i < 0x100; ++i)
45  {
46  Buffers[i] = RtlAllocateHeap(hHeap, 0, (i % 16 ) + 1);
47  ASSERT(Buffers[i] != NULL);
48  if (!((ULONG_PTR)Buffers[i] & 0xF))
49  {
50  Aligned = FALSE;
51  }
52  }
53 
54  for (i = 0; i < 0x100; ++i)
55  {
56  RtlFreeHeap(hHeap, 0, Buffers[i]);
57  }
58 
59  RtlDestroyHeap(hHeap);
60 
61  ok(Aligned == TRUE, "Unaligned address returned\n");
62 
63  _SEH2_TRY
64  {
65  hHeap = RtlCreateHeap(HEAP_CREATE_ALIGN_16, NULL, 0, 0, NULL, (PRTL_HEAP_PARAMETERS)(ULONG_PTR)0xdeadbeefdeadbeefULL);
66  }
68  {
69  hHeap = INVALID_HANDLE_VALUE;
70  }
71  _SEH2_END;
72 
73  ok(hHeap == NULL, "Unexpected heap value: %p\n", hHeap);
74 }
#define HEAP_CREATE_ALIGN_16
Definition: nt_native.h:1701
#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:479
_SEH2_TRY
Definition: create.c:4226
uint32_t ULONG_PTR
Definition: typedefs.h:65
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
#define FALSE
Definition: types.h:117
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI PVOID NTAPI RtlDestroyHeap(IN PVOID HeapHandle)
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_In_ PPCI_DEVICE_PRESENCE_PARAMETERS Parameters
Definition: iotypes.h:887
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
unsigned short USHORT
Definition: pedump.c:61
#define ok(value,...)
Definition: atltest.h:57
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

Variable Documentation

◆ Buffers

PVOID Buffers[0x100]

Definition at line 10 of file RtlAllocateHeap.c.

Referenced by recv(), recvfrom(), send(), sendto(), and START_TEST().