ReactOS 0.4.16-dev-1142-g8029339
NtQuerySection.c File Reference
#include "precomp.h"
Include dependency graph for NtQuerySection.c:

Go to the source code of this file.

Functions

 START_TEST (NtQuerySection)
 

Function Documentation

◆ START_TEST()

START_TEST ( NtQuerySection  )

Definition at line 10 of file NtQuerySection.c.

11{
15 SECTION_BASIC_INFORMATION SectionInfo;
17
18 // Create a section with SEC_COMMIT
19 MaximumSize.QuadPart = 0x20000;
22 NULL, // ObjectAttributes,
26 NULL);
28 ok(hSection != NULL, "hSection is NULL\n");
29
30 // Call NtQuerySection with SectionBasicInformation and a NULL handle
33 &SectionInfo,
34 sizeof(SectionInfo),
37
38 // Call NtQuerySection with SectionBasicInformation and a NULL buffer
41 NULL,
42 sizeof(SectionInfo),
45
46 // Call NtQuerySection with SectionBasicInformation and a too small buffer
49 &SectionInfo,
50 sizeof(SectionInfo) - 1,
53
54 // Call NtQuerySection with SectionBasicInformation
57 &SectionInfo,
58 sizeof(SectionInfo),
61 ok(ReturnLength == sizeof(SectionInfo), "ReturnLength is %lu, expected %u\n", ReturnLength, sizeof(SectionInfo));
62 ok(SectionInfo.BaseAddress == NULL, "BaseAddress is %p, expected NULL\n", SectionInfo.BaseAddress);
63 ok(SectionInfo.Attributes == SEC_COMMIT, "Attributes is %lx, expected %x\n", SectionInfo.Attributes, SEC_COMMIT);
64 ok(SectionInfo.Size.QuadPart == 0x20000, "Size is %I64x, expected %I64x\n", SectionInfo.Size.QuadPart, 0x20000ull);
65
66 // Close the section handle
68
69 // Create a section with SEC_RESERVE
70 MaximumSize.QuadPart = 0x20000;
73 NULL, // ObjectAttributes,
77 NULL);
79 ok(hSection != NULL, "hSection is NULL\n");
80
81 // Call NtQuerySection with SectionBasicInformation
84 &SectionInfo,
85 sizeof(SectionInfo),
88 ok(ReturnLength == sizeof(SectionInfo), "ReturnLength is %lu, expected %u\n", ReturnLength, sizeof(SectionInfo));
89 ok(SectionInfo.BaseAddress == NULL, "BaseAddress is %p, expected NULL\n", SectionInfo.BaseAddress);
90 ok(SectionInfo.Attributes == SEC_RESERVE, "Attributes is %lx, expected %x\n", SectionInfo.Attributes, SEC_RESERVE);
91 ok(SectionInfo.Size.QuadPart == 0x20000, "Size is %I64x, expected %I64x\n", SectionInfo.Size.QuadPart, 0x20000ull);
92
93 // Close the section handle
95
96 // Create a section with SEC_BASED
97 MaximumSize.QuadPart = 0x20000;
100 NULL, // ObjectAttributes,
104 NULL);
106 ok(hSection != NULL, "hSection is NULL\n");
107
108 // Call NtQuerySection with SectionBasicInformation
111 &SectionInfo,
112 sizeof(SectionInfo),
113 &ReturnLength);
115 ok(ReturnLength == sizeof(SectionInfo), "ReturnLength is %lu, expected %u\n", ReturnLength, sizeof(SectionInfo));
116 ok(SectionInfo.BaseAddress != NULL, "BaseAddress is NULL\n");
117 ok(SectionInfo.Attributes == (SEC_BASED | SEC_COMMIT), "Attributes is %lx, expected %x\n", SectionInfo.Attributes, SEC_BASED | SEC_COMMIT);
118 ok(SectionInfo.Size.QuadPart == 0x20000, "Size is %I64x, expected %I64x\n", SectionInfo.Size.QuadPart, 0x20000ull);
119
120 // Close the section handle
122}
NTSTATUS NTAPI NtCreateSection(OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize OPTIONAL, IN ULONG SectionPageProtection OPTIONAL, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL)
Definition: section.c:3076
_In_ PVOID _In_ ULONG _Out_ PVOID _In_ ULONG _Inout_ PULONG ReturnLength
#define ok_ntstatus(status, expected)
Definition: atltest.h:135
#define ok(value,...)
Definition: atltest.h:57
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_HANDLE
Definition: d3dkmdt.h:40
#define NULL
Definition: types.h:112
Status
Definition: gdiplustypes.h:25
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_opt_ PLARGE_INTEGER MaximumSize
Definition: mmfuncs.h:362
#define SEC_COMMIT
Definition: mmtypes.h:100
@ SectionBasicInformation
Definition: mmtypes.h:195
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1293
#define SEC_RESERVE
Definition: nt_native.h:1323
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308
#define SEC_BASED
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
NTSTATUS NTAPI NtQuerySection(_In_ HANDLE SectionHandle, _In_ SECTION_INFORMATION_CLASS SectionInformationClass, _Out_ PVOID SectionInformation, _In_ SIZE_T SectionInformationLength, _Out_opt_ PSIZE_T ResultLength)
Definition: section.c:3781
#define STATUS_SUCCESS
Definition: shellext.h:65
LARGE_INTEGER Size
Definition: mmtypes.h:336
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ const BITMAPINFO _In_ UINT _In_opt_ HANDLE hSection
Definition: wingdi.h:3239