2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Kernel-Mode Test Suite Section Object test
5 * PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
10 #define CheckObject(Handle, Pointers, Handles) do \
12 PUBLIC_OBJECT_BASIC_INFORMATION ObjectInfo; \
13 Status = ZwQueryObject(Handle, ObjectBasicInformation, \
14 &ObjectInfo, sizeof ObjectInfo, NULL); \
15 ok_eq_hex(Status, STATUS_SUCCESS); \
16 ok_eq_ulong(ObjectInfo.PointerCount, Pointers); \
17 ok_eq_ulong(ObjectInfo.HandleCount, Handles); \
20 #define CheckSection(SectionObject, SectionFlag) do \
22 SECTION_BASIC_INFORMATION Sbi; \
23 HANDLE SectionHandle = NULL; \
25 if (skip(SectionObject != NULL && \
26 SectionObject != (PVOID)0x5555555555555555ULL, \
27 "No section object\n")) \
29 Status = ObOpenObjectByPointer(SectionObject, OBJ_KERNEL_HANDLE, \
30 NULL, 0, MmSectionObjectType, \
31 KernelMode, &SectionHandle); \
32 ok_eq_hex(Status, STATUS_SUCCESS); \
33 ok(SectionHandle != NULL, "Section handle null\n"); \
34 if (!skip(NT_SUCCESS(Status) && SectionHandle, \
35 "No section handle\n")) \
37 Status = ZwQuerySection(SectionHandle, SectionBasicInformation, \
38 &Sbi, sizeof Sbi, NULL); \
39 ok_eq_hex(Status, STATUS_SUCCESS); \
40 ok_eq_pointer(Sbi.BaseAddress, NULL); \
41 ok_eq_longlong(Sbi.Size.QuadPart, 1LL); \
42 ok_eq_hex(Sbi.Attributes, SectionFlag | SEC_FILE); \
43 ZwClose(SectionHandle); \
47 #define TestMapView(SectionObject, ExpectAtBase, ExpectM) do \
50 PVOID BaseAddress = NULL; \
51 SIZE_T ViewSize = 0; \
52 LARGE_INTEGER SectionOffset; \
53 if (skip(SectionObject != NULL && \
54 SectionObject != (PVOID)0x5555555555555555ULL, \
55 "No section object\n")) \
58 SectionOffset.QuadPart = 0; \
59 Status = MmMapViewOfSection(SectionObject, PsGetCurrentProcess(), \
60 &BaseAddress, 0, 1, &SectionOffset, \
61 &ViewSize, ViewUnmap, 0, PAGE_READONLY); \
62 ok_eq_hex(Status, ExpectAtBase ? STATUS_SUCCESS : STATUS_IMAGE_NOT_AT_BASE);\
63 if (!skip(NT_SUCCESS(Status), "Section not mapped\n")) \
65 ok_eq_uint(*(PUCHAR)BaseAddress, ExpectM ? 'M' : 0); \
66 Status = MmUnmapViewOfSection(PsGetCurrentProcess(), BaseAddress); \
67 ok_eq_hex(Status, STATUS_SUCCESS); \
74 IN HANDLE FileHandle1
,
75 IN PFILE_OBJECT FileObject1
,
76 IN HANDLE FileHandle2
,
77 IN PFILE_OBJECT FileObject2
)
79 NTSTATUS Status
= STATUS_SUCCESS
;
81 LARGE_INTEGER MaximumSize
;
82 ULONG PointerCount1
, PointerCount2
;
85 Status
= MmCreateSection(NULL
, 0, NULL
, NULL
, 0, SEC_RESERVE
, NULL
, NULL
);
86 KmtEndSeh(STATUS_SUCCESS
);
87 ok_eq_hex(Status
, STATUS_INVALID_PAGE_PROTECTION
);
89 if (!KmtIsCheckedBuild
)
91 /* PAGE_NOACCESS and missing SEC_RESERVE/SEC_COMMIT/SEC_IMAGE assert */
93 Status
= MmCreateSection(NULL
, 0, NULL
, NULL
, PAGE_NOACCESS
, SEC_RESERVE
, NULL
, NULL
);
94 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
97 Status
= MmCreateSection(NULL
, 0, NULL
, NULL
, PAGE_NOACCESS
, 0, NULL
, NULL
);
98 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
101 SectionObject
= KmtInvalidPointer
;
103 Status
= MmCreateSection(&SectionObject
, 0, NULL
, NULL
, 0, SEC_RESERVE
, NULL
, NULL
);
104 KmtEndSeh(STATUS_SUCCESS
);
105 ok_eq_hex(Status
, STATUS_INVALID_PAGE_PROTECTION
);
106 ok_eq_pointer(SectionObject
, KmtInvalidPointer
);
108 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
109 ObDereferenceObject(SectionObject
);
112 Status
= MmCreateSection(NULL
, 0, NULL
, NULL
, PAGE_READONLY
, SEC_RESERVE
, NULL
, NULL
);
113 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
115 SectionObject
= KmtInvalidPointer
;
117 Status
= MmCreateSection(&SectionObject
, 0, NULL
, NULL
, PAGE_READONLY
, SEC_RESERVE
, NULL
, NULL
);
118 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
119 ok_eq_pointer(SectionObject
, KmtInvalidPointer
);
121 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
122 ObDereferenceObject(SectionObject
);
124 SectionObject
= KmtInvalidPointer
;
125 MaximumSize
.QuadPart
= 0;
127 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, NULL
, NULL
);
128 KmtEndSeh(STATUS_SUCCESS
);
129 ok_eq_hex(Status
, STATUS_INVALID_FILE_FOR_SECTION
);
130 ok_eq_longlong(MaximumSize
.QuadPart
, 0LL);
131 ok_eq_pointer(SectionObject
, KmtInvalidPointer
);
133 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
134 ObDereferenceObject(SectionObject
);
136 MaximumSize
.QuadPart
= 0;
138 Status
= MmCreateSection(NULL
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_RESERVE
, NULL
, NULL
);
139 KmtEndSeh(STATUS_SUCCESS
);
140 ok_eq_hex(Status
, STATUS_INVALID_PARAMETER_4
);
141 ok_eq_longlong(MaximumSize
.QuadPart
, 0LL);
143 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
144 ObDereferenceObject(SectionObject
);
146 MaximumSize
.QuadPart
= 1;
148 Status
= MmCreateSection(NULL
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_RESERVE
, NULL
, NULL
);
149 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
150 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
152 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
153 ObDereferenceObject(SectionObject
);
155 SectionObject
= KmtInvalidPointer
;
156 MaximumSize
.QuadPart
= 0;
158 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_RESERVE
, NULL
, NULL
);
159 KmtEndSeh(STATUS_SUCCESS
);
160 ok_eq_hex(Status
, STATUS_INVALID_PARAMETER_4
);
161 ok_eq_longlong(MaximumSize
.QuadPart
, 0LL);
162 ok_eq_pointer(SectionObject
, KmtInvalidPointer
);
164 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
165 ObDereferenceObject(SectionObject
);
167 /* page file section */
168 SectionObject
= KmtInvalidPointer
;
169 MaximumSize
.QuadPart
= 1;
171 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_RESERVE
, NULL
, NULL
);
172 KmtEndSeh(STATUS_SUCCESS
);
173 ok_eq_hex(Status
, STATUS_SUCCESS
);
174 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
175 ok(SectionObject
!= KmtInvalidPointer
, "Section object pointer untouched\n");
176 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
178 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
179 ObDereferenceObject(SectionObject
);
181 if (!skip(FileHandle1
!= NULL
&& FileObject1
!= NULL
&&
182 FileHandle2
!= NULL
&& FileObject2
!= NULL
, "No file handle or object\n"))
187 CheckObject(FileHandle2
, PointerCount2
, 1L);
188 SectionObject
= KmtInvalidPointer
;
189 MaximumSize
.QuadPart
= 1;
191 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, FileHandle2
, NULL
);
192 KmtEndSeh(STATUS_SUCCESS
);
193 ok_eq_hex(Status
, STATUS_SUCCESS
);
194 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
195 ok(SectionObject
!= KmtInvalidPointer
, "Section object pointer untouched\n");
196 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
197 CheckObject(FileHandle2
, PointerCount2
, 1L);
198 CheckSection(SectionObject
, SEC_IMAGE
);
199 TestMapView(SectionObject
, FALSE
, TRUE
);
201 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
202 ObDereferenceObject(SectionObject
);
204 CheckObject(FileHandle2
, PointerCount2
, 1L);
205 SectionObject
= KmtInvalidPointer
;
206 MaximumSize
.QuadPart
= 1;
208 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, NULL
, FileObject2
);
209 KmtEndSeh(STATUS_SUCCESS
);
210 ok_eq_hex(Status
, STATUS_SUCCESS
);
211 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
212 ok(SectionObject
!= KmtInvalidPointer
, "Section object pointer untouched\n");
213 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
215 CheckObject(FileHandle2
, PointerCount2
, 1L);
216 CheckSection(SectionObject
, 0);
217 TestMapView(SectionObject
, TRUE
, TRUE
);
219 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
220 ObDereferenceObject(SectionObject
);
221 //--PointerCount2; // ????
223 CheckObject(FileHandle2
, PointerCount2
, 1L);
224 SectionObject
= KmtInvalidPointer
;
225 MaximumSize
.QuadPart
= 1;
227 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, FileHandle2
, FileObject2
);
228 KmtEndSeh(STATUS_SUCCESS
);
229 ok_eq_hex(Status
, STATUS_SUCCESS
);
230 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
231 ok(SectionObject
!= KmtInvalidPointer
, "Section object pointer untouched\n");
232 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
233 CheckObject(FileHandle2
, PointerCount2
, 1L);
234 CheckSection(SectionObject
, 0);
235 TestMapView(SectionObject
, TRUE
, TRUE
);
237 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
238 ObDereferenceObject(SectionObject
);
240 /* image section with inappropriate file */
241 CheckObject(FileHandle1
, PointerCount1
, 1L);
242 SectionObject
= KmtInvalidPointer
;
243 MaximumSize
.QuadPart
= 1;
245 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, FileHandle1
, NULL
);
246 KmtEndSeh(STATUS_SUCCESS
);
247 ok_eq_hex(Status
, STATUS_INVALID_IMAGE_NOT_MZ
);
248 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
249 ok_eq_pointer(SectionObject
, KmtInvalidPointer
);
250 CheckObject(FileHandle1
, PointerCount1
, 1L);
252 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
253 ObDereferenceObject(SectionObject
);
255 CheckObject(FileHandle1
, PointerCount1
, 1L);
256 SectionObject
= KmtInvalidPointer
;
257 MaximumSize
.QuadPart
= 1;
259 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, NULL
, FileObject1
);
260 KmtEndSeh(STATUS_SUCCESS
);
261 ok_eq_hex(Status
, STATUS_SUCCESS
);
262 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
263 ok(SectionObject
!= KmtInvalidPointer
, "Section object pointer untouched\n");
264 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
266 CheckObject(FileHandle1
, PointerCount1
, 1L);
267 CheckSection(SectionObject
, 0);
268 TestMapView(SectionObject
, TRUE
, FALSE
);
270 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
271 ObDereferenceObject(SectionObject
);
272 //--PointerCount1; // ????
274 CheckObject(FileHandle1
, PointerCount1
, 1L);
275 SectionObject
= KmtInvalidPointer
;
276 MaximumSize
.QuadPart
= 1;
278 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, FileHandle1
, FileObject1
);
279 KmtEndSeh(STATUS_SUCCESS
);
280 ok_eq_hex(Status
, STATUS_SUCCESS
);
281 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
282 ok(SectionObject
!= KmtInvalidPointer
, "Section object pointer untouched\n");
283 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
284 CheckObject(FileHandle1
, PointerCount1
, 1L);
285 CheckSection(SectionObject
, 0);
286 TestMapView(SectionObject
, TRUE
, FALSE
);
288 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
289 ObDereferenceObject(SectionObject
);
291 /* image section with two different files */
292 CheckObject(FileHandle1
, PointerCount1
, 1L);
293 SectionObject
= KmtInvalidPointer
;
294 MaximumSize
.QuadPart
= 1;
296 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, FileHandle1
, FileObject2
);
297 KmtEndSeh(STATUS_SUCCESS
);
298 ok_eq_hex(Status
, STATUS_SUCCESS
);
299 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
300 ok(SectionObject
!= KmtInvalidPointer
, "Section object pointer untouched\n");
301 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
302 CheckObject(FileHandle1
, PointerCount1
, 1L);
303 CheckObject(FileHandle2
, PointerCount2
, 1L);
304 CheckSection(SectionObject
, 0);
305 TestMapView(SectionObject
, TRUE
, TRUE
);
307 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
308 ObDereferenceObject(SectionObject
);
310 CheckObject(FileHandle1
, PointerCount1
, 1L);
311 SectionObject
= KmtInvalidPointer
;
312 MaximumSize
.QuadPart
= 1;
314 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, FileHandle2
, FileObject1
);
315 KmtEndSeh(STATUS_SUCCESS
);
316 ok_eq_hex(Status
, STATUS_SUCCESS
);
317 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
318 ok(SectionObject
!= KmtInvalidPointer
, "Section object pointer untouched\n");
319 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
320 CheckObject(FileHandle1
, PointerCount1
, 1L);
321 CheckObject(FileHandle2
, PointerCount2
, 1L);
322 CheckSection(SectionObject
, 0);
323 TestMapView(SectionObject
, TRUE
, FALSE
);
325 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
326 ObDereferenceObject(SectionObject
);
328 /* data file section */
329 CheckObject(FileHandle1
, PointerCount1
, 1L);
330 SectionObject
= KmtInvalidPointer
;
331 MaximumSize
.QuadPart
= 1;
333 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_RESERVE
, FileHandle1
, NULL
);
334 KmtEndSeh(STATUS_SUCCESS
);
335 ok_eq_hex(Status
, STATUS_SUCCESS
);
336 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
337 ok(SectionObject
!= KmtInvalidPointer
, "Section object pointer untouched\n");
338 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
339 CheckObject(FileHandle1
, PointerCount1
, 1L);
340 CheckSection(SectionObject
, 0);
341 TestMapView(SectionObject
, TRUE
, FALSE
);
343 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
344 ObDereferenceObject(SectionObject
);
346 CheckObject(FileHandle1
, PointerCount1
, 1L);
347 SectionObject
= KmtInvalidPointer
;
348 MaximumSize
.QuadPart
= 1;
350 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_RESERVE
, NULL
, FileObject1
);
351 KmtEndSeh(STATUS_SUCCESS
);
352 ok_eq_hex(Status
, STATUS_SUCCESS
);
353 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
354 ok(SectionObject
!= KmtInvalidPointer
, "Section object pointer untouched\n");
355 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
356 CheckObject(FileHandle1
, PointerCount1
, 1L);
357 CheckSection(SectionObject
, 0);
358 TestMapView(SectionObject
, TRUE
, FALSE
);
360 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
361 ObDereferenceObject(SectionObject
);
363 CheckObject(FileHandle1
, PointerCount1
, 1L);
364 SectionObject
= KmtInvalidPointer
;
365 MaximumSize
.QuadPart
= 1;
367 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_RESERVE
, FileHandle1
, FileObject1
);
368 KmtEndSeh(STATUS_SUCCESS
);
369 ok_eq_hex(Status
, STATUS_SUCCESS
);
370 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
371 ok(SectionObject
!= KmtInvalidPointer
, "Section object pointer untouched\n");
372 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
373 CheckObject(FileHandle1
, PointerCount1
, 1L);
374 CheckSection(SectionObject
, 0);
375 TestMapView(SectionObject
, TRUE
, FALSE
);
377 if (SectionObject
&& SectionObject
!= KmtInvalidPointer
)
378 ObDereferenceObject(SectionObject
);
380 CheckObject(FileHandle1
, PointerCount1
, 1L);
384 START_TEST(MmSection
)
387 HANDLE FileHandle1
= NULL
, FileHandle2
= NULL
;
388 PFILE_OBJECT FileObject1
= NULL
, FileObject2
= NULL
;
389 OBJECT_ATTRIBUTES ObjectAttributes
;
390 IO_STATUS_BLOCK IoStatusBlock
;
391 UNICODE_STRING FileName1
= RTL_CONSTANT_STRING(L
"\\SystemRoot\\kmtest-MmSection.txt");
392 UNICODE_STRING FileName2
= RTL_CONSTANT_STRING(L
"\\SystemRoot\\system32\\ntdll.dll");
393 LARGE_INTEGER FileOffset
;
396 ok(ExGetPreviousMode() == UserMode
, "Previous mode is kernel mode\n");
397 /* create a one-byte file that we can use */
398 InitializeObjectAttributes(&ObjectAttributes
, &FileName1
, OBJ_CASE_INSENSITIVE
, NULL
, NULL
);
399 Status
= ZwCreateFile(&FileHandle1
, GENERIC_WRITE
| SYNCHRONIZE
, &ObjectAttributes
, &IoStatusBlock
, NULL
, FILE_ATTRIBUTE_NORMAL
, FILE_SHARE_READ
, FILE_SUPERSEDE
, FILE_NON_DIRECTORY_FILE
, NULL
, 0);
400 ok_eq_hex(Status
, STATUS_SUCCESS
);
401 ok_eq_ulongptr(IoStatusBlock
.Information
, FILE_CREATED
);
402 ok(FileHandle1
!= NULL
, "FileHandle1 is NULL\n");
405 FileOffset
.QuadPart
= 0;
406 Status
= ZwWriteFile(FileHandle1
, NULL
, NULL
, NULL
, &IoStatusBlock
, &FileData
, sizeof FileData
, &FileOffset
, NULL
);
407 ok(Status
== STATUS_SUCCESS
|| Status
== STATUS_PENDING
, "Status = 0x%08lx\n", Status
);
408 Status
= ZwWaitForSingleObject(FileHandle1
, FALSE
, NULL
);
409 ok_eq_hex(Status
, STATUS_SUCCESS
);
410 ok_eq_ulongptr(IoStatusBlock
.Information
, 1);
411 Status
= ZwClose(FileHandle1
);
412 ok_eq_hex(Status
, STATUS_SUCCESS
);
416 InitializeObjectAttributes(&ObjectAttributes
, &FileName1
, OBJ_CASE_INSENSITIVE
, NULL
, NULL
);
417 Status
= ZwCreateFile(&FileHandle1
, GENERIC_ALL
, &ObjectAttributes
, &IoStatusBlock
, NULL
, FILE_ATTRIBUTE_NORMAL
, FILE_SHARE_READ
, FILE_OPEN
, FILE_NON_DIRECTORY_FILE
| FILE_DELETE_ON_CLOSE
, NULL
, 0);
418 ok_eq_hex(Status
, STATUS_SUCCESS
);
419 ok_eq_ulongptr(IoStatusBlock
.Information
, FILE_OPENED
);
420 ok(FileHandle1
!= NULL
, "FileHandle1 is NULL\n");
421 CheckObject(FileHandle1
, 2L, 1L);
423 InitializeObjectAttributes(&ObjectAttributes
, &FileName2
, OBJ_CASE_INSENSITIVE
, NULL
, NULL
);
424 Status
= ZwCreateFile(&FileHandle2
, GENERIC_READ
, &ObjectAttributes
, &IoStatusBlock
, NULL
, FILE_ATTRIBUTE_NORMAL
, FILE_SHARE_READ
, FILE_OPEN
, FILE_NON_DIRECTORY_FILE
, NULL
, 0);
425 ok_eq_hex(Status
, STATUS_SUCCESS
);
426 ok_eq_ulongptr(IoStatusBlock
.Information
, FILE_OPENED
);
427 ok(FileHandle2
!= NULL
, "FileHandle2 is NULL\n");
429 if (!skip(Status
== STATUS_SUCCESS
&& FileHandle1
!= NULL
, "Failed to open file 1\n"))
431 Status
= ObReferenceObjectByHandle(FileHandle1
, FILE_READ_DATA
| FILE_WRITE_DATA
, *IoFileObjectType
, KernelMode
, (PVOID
*)&FileObject1
, NULL
);
432 ok_eq_hex(Status
, STATUS_SUCCESS
);
433 ok(FileObject1
!= NULL
, "FileObject1 is NULL\n");
434 CheckObject(FileHandle1
, 3L, 1L);
437 if (!skip(Status
== STATUS_SUCCESS
&& FileHandle2
!= NULL
, "Failed to open file 2\n"))
439 Status
= ObReferenceObjectByHandle(FileHandle2
, FILE_READ_DATA
| FILE_WRITE_DATA
, *IoFileObjectType
, KernelMode
, (PVOID
*)&FileObject2
, NULL
);
440 ok_eq_hex(Status
, STATUS_SUCCESS
);
441 ok(FileObject2
!= NULL
, "FileObject2 is NULL\n");
444 trace("FileHandle1=%p, FileObject1=%p\n", FileHandle1
, FileObject1
);
445 trace("FileHandle2=%p, FileObject2=%p\n", FileHandle2
, FileObject2
);
446 TestCreateSection(FileHandle1
, FileObject1
, FileHandle2
, FileObject2
);
449 ObDereferenceObject(FileObject2
);
451 ObDereferenceObject(FileObject1
);
453 ZwClose(FileHandle2
);
455 ZwClose(FileHandle1
);