ReactOS 0.4.15-dev-7931-gfd331f1
IoIrp.c File Reference
#include <kmt_test.h>
#include <debug.h>
Include dependency graph for IoIrp.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

 START_TEST (IoIrp)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file IoIrp.c.

Function Documentation

◆ START_TEST()

START_TEST ( IoIrp  )

Definition at line 14 of file IoIrp.c.

15{
17 IRP *iorp;
18
19 // 1st test
20 size = sizeof(IRP) + 5 * sizeof(IO_STACK_LOCATION);
22
23 if (NULL != iorp)
24 {
25 IoInitializeIrp(iorp, size, 5);
26
27 ok(6 == iorp->Type, "Irp type should be 6, but got %d\n", iorp->Type);
28 ok(iorp->Size == size, "Irp size should be %d, but got %d\n",
29 iorp->Size, size);
30 ok(5 == iorp->StackCount, "Irp StackCount should be 5, but got %d\n",
31 iorp->StackCount);
32 ok(6 == iorp->CurrentLocation, "Irp CurrentLocation should be 6, but got %d\n",
33 iorp->CurrentLocation);
34 ok(IsListEmpty(&iorp->ThreadListEntry), "IRP thread list is not empty\n");
35 ok ((PIO_STACK_LOCATION)(iorp + 1) + 5 ==
36 iorp->Tail.Overlay.CurrentStackLocation,
37 "CurrentStackLocation mismatch\n");
38
39 ExFreePool(iorp);
40 }
41
42 // 2nd test
43 size = sizeof(IRP) + 2 * sizeof(IO_STACK_LOCATION);
44 iorp = IoAllocateIrp(2, FALSE);
45
46 if (NULL != iorp)
47 {
48 ok(6 == iorp->Type, "Irp type should be 6, but got %d\n", iorp->Type);
49 ok(iorp->Size >= size,
50 "Irp size should be more or equal to %d, but got %d\n",
51 iorp->Size, size);
52 ok(2 == iorp->StackCount, "Irp StackCount should be 2, but got %d\n",
53 iorp->StackCount);
54 ok(3 == iorp->CurrentLocation, "Irp CurrentLocation should be 3, but got %d\n",
55 iorp->CurrentLocation);
56 ok(IsListEmpty(&iorp->ThreadListEntry), "IRP thread list is not empty\n");
57 ok ((PIO_STACK_LOCATION)(iorp + 1) + 2 ==
58 iorp->Tail.Overlay.CurrentStackLocation,
59 "CurrentStackLocation mismatch\n");
60 ok((IRP_ALLOCATED_FIXED_SIZE & iorp->AllocationFlags),
61 "IRP Allocation flags lack fixed size attribute\n");
62 ok(!(IRP_LOOKASIDE_ALLOCATION & iorp->AllocationFlags),
63 "IRP Allocation flags should not have lookaside allocation\n");
64
65 IoFreeIrp(iorp);
66 }
67
68 // 3rd test
69 size = sizeof(IRP) + 2 * sizeof(IO_STACK_LOCATION);
70 iorp = IoAllocateIrp(2, TRUE);
71
72 if (NULL != iorp)
73 {
74 ok(6 == iorp->Type, "Irp type should be 6, but got %d\n", iorp->Type);
75 ok(iorp->Size >= size,
76 "Irp size should be more or equal to %d, but got %d\n",
77 iorp->Size, size);
78 ok(2 == iorp->StackCount, "Irp StackCount should be 2, but got %d\n",
79 iorp->StackCount);
80 ok(3 == iorp->CurrentLocation, "Irp CurrentLocation should be 3, but got %d\n",
81 iorp->CurrentLocation);
82 ok(IsListEmpty(&iorp->ThreadListEntry), "IRP thread list is not empty\n");
83 ok ((PIO_STACK_LOCATION)(iorp + 1) + 2 ==
84 iorp->Tail.Overlay.CurrentStackLocation,
85 "CurrentStackLocation mismatch\n");
86 ok((IRP_ALLOCATED_FIXED_SIZE & iorp->AllocationFlags),
87 "IRP Allocation flags lack fixed size attribute\n");
88 ok((IRP_LOOKASIDE_ALLOCATION & iorp->AllocationFlags),
89 "IRP Allocation flags lack lookaside allocation\n");
90
91 IoFreeIrp(iorp);
92 }
93}
struct _IRP IRP
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define NonPagedPool
Definition: env_spec_w32.h:307
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
GLsizeiptr size
Definition: glext.h:5919
VOID NTAPI IoInitializeIrp(IN PIRP Irp, IN USHORT PacketSize, IN CCHAR StackSize)
Definition: irp.c:1854
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:615
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1666
unsigned short USHORT
Definition: pedump.c:61
#define IRP_LOOKASIDE_ALLOCATION
#define IRP_ALLOCATED_FIXED_SIZE