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 <thfabba@gmx.de>
10 #define StartSeh() ExceptionStatus = STATUS_SUCCESS; _SEH2_TRY {
11 #define EndSeh(ExpectedStatus) } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { ExceptionStatus = _SEH2_GetExceptionCode(); } _SEH2_END; ok_eq_hex(ExceptionStatus, ExpectedStatus)
13 #define CheckObject(Handle, Pointers, Handles) do \
15 PUBLIC_OBJECT_BASIC_INFORMATION ObjectInfo; \
16 Status = ZwQueryObject(Handle, ObjectBasicInformation, \
17 &ObjectInfo, sizeof ObjectInfo, NULL); \
18 ok_eq_hex(Status, STATUS_SUCCESS); \
19 ok_eq_ulong(ObjectInfo.PointerCount, Pointers); \
20 ok_eq_ulong(ObjectInfo.HandleCount, Handles); \
23 #define CheckSection(SectionObject, SectionFlag) do \
25 SECTION_BASIC_INFORMATION Sbi; \
26 HANDLE SectionHandle = NULL; \
28 if (skip(SectionObject != NULL && \
29 SectionObject != (PVOID)0x5555555555555555ULL, \
30 "No section object\n")) \
32 Status = ObOpenObjectByPointer(SectionObject, OBJ_KERNEL_HANDLE, \
33 NULL, 0, MmSectionObjectType, \
34 KernelMode, &SectionHandle); \
35 ok_eq_hex(Status, STATUS_SUCCESS); \
36 ok(SectionHandle != NULL, "Section handle null\n"); \
37 if (!skip(NT_SUCCESS(Status) && SectionHandle, \
38 "No section handle\n")) \
40 Status = ZwQuerySection(SectionHandle, SectionBasicInformation, \
41 &Sbi, sizeof Sbi, NULL); \
42 ok_eq_hex(Status, STATUS_SUCCESS); \
43 ok_eq_pointer(Sbi.BaseAddress, NULL); \
44 ok_eq_longlong(Sbi.Size.QuadPart, 1LL); \
45 ok_eq_hex(Sbi.Attributes, SectionFlag | SEC_FILE); \
46 ZwClose(SectionHandle); \
50 #define TestMapView(SectionObject, ExpectAtBase, ExpectM) do \
53 PVOID BaseAddress = NULL; \
54 SIZE_T ViewSize = 0; \
55 LARGE_INTEGER SectionOffset; \
56 if (skip(SectionObject != NULL && \
57 SectionObject != (PVOID)0x5555555555555555ULL, \
58 "No section object\n")) \
61 SectionOffset.QuadPart = 0; \
62 Status = MmMapViewOfSection(SectionObject, PsGetCurrentProcess(), \
63 &BaseAddress, 0, 1, &SectionOffset, \
64 &ViewSize, ViewUnmap, 0, PAGE_READONLY); \
65 ok_eq_hex(Status, ExpectAtBase ? STATUS_SUCCESS : STATUS_IMAGE_NOT_AT_BASE);\
66 if (!skip(NT_SUCCESS(Status), "Section not mapped\n")) \
68 ok_eq_uint(*(PUCHAR)BaseAddress, ExpectM ? 'M' : 0); \
69 Status = MmUnmapViewOfSection(PsGetCurrentProcess(), BaseAddress); \
70 ok_eq_hex(Status, STATUS_SUCCESS); \
77 IN HANDLE FileHandle1
,
78 IN PFILE_OBJECT FileObject1
,
79 IN HANDLE FileHandle2
,
80 IN PFILE_OBJECT FileObject2
)
82 NTSTATUS Status
= STATUS_SUCCESS
;
83 NTSTATUS ExceptionStatus
;
84 const PVOID InvalidPointer
= (PVOID
)0x5555555555555555ULL
;
86 LARGE_INTEGER MaximumSize
;
87 ULONG PointerCount1
, PointerCount2
;
90 Status
= MmCreateSection(NULL
, 0, NULL
, NULL
, 0, SEC_RESERVE
, NULL
, NULL
);
91 EndSeh(STATUS_SUCCESS
);
92 ok_eq_hex(Status
, STATUS_INVALID_PAGE_PROTECTION
);
94 if (!KmtIsCheckedBuild
)
96 /* PAGE_NOACCESS and missing SEC_RESERVE/SEC_COMMIT/SEC_IMAGE assert */
98 Status
= MmCreateSection(NULL
, 0, NULL
, NULL
, PAGE_NOACCESS
, SEC_RESERVE
, NULL
, NULL
);
99 EndSeh(STATUS_ACCESS_VIOLATION
);
102 Status
= MmCreateSection(NULL
, 0, NULL
, NULL
, PAGE_NOACCESS
, 0, NULL
, NULL
);
103 EndSeh(STATUS_ACCESS_VIOLATION
);
106 SectionObject
= InvalidPointer
;
108 Status
= MmCreateSection(&SectionObject
, 0, NULL
, NULL
, 0, SEC_RESERVE
, NULL
, NULL
);
109 EndSeh(STATUS_SUCCESS
);
110 ok_eq_hex(Status
, STATUS_INVALID_PAGE_PROTECTION
);
111 ok_eq_pointer(SectionObject
, InvalidPointer
);
113 if (SectionObject
&& SectionObject
!= InvalidPointer
)
114 ObDereferenceObject(SectionObject
);
117 Status
= MmCreateSection(NULL
, 0, NULL
, NULL
, PAGE_READONLY
, SEC_RESERVE
, NULL
, NULL
);
118 EndSeh(STATUS_ACCESS_VIOLATION
);
120 SectionObject
= InvalidPointer
;
122 Status
= MmCreateSection(&SectionObject
, 0, NULL
, NULL
, PAGE_READONLY
, SEC_RESERVE
, NULL
, NULL
);
123 EndSeh(STATUS_ACCESS_VIOLATION
);
124 ok_eq_pointer(SectionObject
, InvalidPointer
);
126 if (SectionObject
&& SectionObject
!= InvalidPointer
)
127 ObDereferenceObject(SectionObject
);
129 SectionObject
= InvalidPointer
;
130 MaximumSize
.QuadPart
= 0;
132 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, NULL
, NULL
);
133 EndSeh(STATUS_SUCCESS
);
134 ok_eq_hex(Status
, STATUS_INVALID_FILE_FOR_SECTION
);
135 ok_eq_longlong(MaximumSize
.QuadPart
, 0LL);
136 ok_eq_pointer(SectionObject
, InvalidPointer
);
138 if (SectionObject
&& SectionObject
!= InvalidPointer
)
139 ObDereferenceObject(SectionObject
);
141 MaximumSize
.QuadPart
= 0;
143 Status
= MmCreateSection(NULL
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_RESERVE
, NULL
, NULL
);
144 EndSeh(STATUS_SUCCESS
);
145 ok_eq_hex(Status
, STATUS_INVALID_PARAMETER_4
);
146 ok_eq_longlong(MaximumSize
.QuadPart
, 0LL);
148 if (SectionObject
&& SectionObject
!= InvalidPointer
)
149 ObDereferenceObject(SectionObject
);
151 MaximumSize
.QuadPart
= 1;
153 Status
= MmCreateSection(NULL
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_RESERVE
, NULL
, NULL
);
154 EndSeh(STATUS_ACCESS_VIOLATION
);
155 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
157 if (SectionObject
&& SectionObject
!= InvalidPointer
)
158 ObDereferenceObject(SectionObject
);
160 SectionObject
= InvalidPointer
;
161 MaximumSize
.QuadPart
= 0;
163 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_RESERVE
, NULL
, NULL
);
164 EndSeh(STATUS_SUCCESS
);
165 ok_eq_hex(Status
, STATUS_INVALID_PARAMETER_4
);
166 ok_eq_longlong(MaximumSize
.QuadPart
, 0LL);
167 ok_eq_pointer(SectionObject
, InvalidPointer
);
169 if (SectionObject
&& SectionObject
!= InvalidPointer
)
170 ObDereferenceObject(SectionObject
);
172 /* page file section */
173 SectionObject
= InvalidPointer
;
174 MaximumSize
.QuadPart
= 1;
176 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_RESERVE
, NULL
, NULL
);
177 EndSeh(STATUS_SUCCESS
);
178 ok_eq_hex(Status
, STATUS_SUCCESS
);
179 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
180 ok(SectionObject
!= InvalidPointer
, "Section object pointer untouched\n");
181 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
183 if (SectionObject
&& SectionObject
!= InvalidPointer
)
184 ObDereferenceObject(SectionObject
);
186 if (!skip(FileHandle1
!= NULL
&& FileObject1
!= NULL
&&
187 FileHandle2
!= NULL
&& FileObject2
!= NULL
, "No file handle or object\n"))
192 CheckObject(FileHandle2
, PointerCount2
, 1L);
193 SectionObject
= InvalidPointer
;
194 MaximumSize
.QuadPart
= 1;
196 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, FileHandle2
, NULL
);
197 EndSeh(STATUS_SUCCESS
);
198 ok_eq_hex(Status
, STATUS_SUCCESS
);
199 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
200 ok(SectionObject
!= InvalidPointer
, "Section object pointer untouched\n");
201 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
202 CheckObject(FileHandle2
, PointerCount2
, 1L);
203 CheckSection(SectionObject
, SEC_IMAGE
);
204 TestMapView(SectionObject
, FALSE
, TRUE
);
206 if (SectionObject
&& SectionObject
!= InvalidPointer
)
207 ObDereferenceObject(SectionObject
);
209 CheckObject(FileHandle2
, PointerCount2
, 1L);
210 SectionObject
= InvalidPointer
;
211 MaximumSize
.QuadPart
= 1;
213 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, NULL
, FileObject2
);
214 EndSeh(STATUS_SUCCESS
);
215 ok_eq_hex(Status
, STATUS_SUCCESS
);
216 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
217 ok(SectionObject
!= InvalidPointer
, "Section object pointer untouched\n");
218 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
220 CheckObject(FileHandle2
, PointerCount2
, 1L);
221 CheckSection(SectionObject
, 0);
222 TestMapView(SectionObject
, TRUE
, TRUE
);
224 if (SectionObject
&& SectionObject
!= InvalidPointer
)
225 ObDereferenceObject(SectionObject
);
226 //--PointerCount2; // ????
228 CheckObject(FileHandle2
, PointerCount2
, 1L);
229 SectionObject
= InvalidPointer
;
230 MaximumSize
.QuadPart
= 1;
232 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, FileHandle2
, FileObject2
);
233 EndSeh(STATUS_SUCCESS
);
234 ok_eq_hex(Status
, STATUS_SUCCESS
);
235 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
236 ok(SectionObject
!= InvalidPointer
, "Section object pointer untouched\n");
237 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
238 CheckObject(FileHandle2
, PointerCount2
, 1L);
239 CheckSection(SectionObject
, 0);
240 TestMapView(SectionObject
, TRUE
, TRUE
);
242 if (SectionObject
&& SectionObject
!= InvalidPointer
)
243 ObDereferenceObject(SectionObject
);
245 /* image section with inappropriate file */
246 CheckObject(FileHandle1
, PointerCount1
, 1L);
247 SectionObject
= InvalidPointer
;
248 MaximumSize
.QuadPart
= 1;
250 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, FileHandle1
, NULL
);
251 EndSeh(STATUS_SUCCESS
);
252 ok_eq_hex(Status
, STATUS_INVALID_IMAGE_NOT_MZ
);
253 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
254 ok_eq_pointer(SectionObject
, InvalidPointer
);
255 CheckObject(FileHandle1
, PointerCount1
, 1L);
257 if (SectionObject
&& SectionObject
!= InvalidPointer
)
258 ObDereferenceObject(SectionObject
);
260 CheckObject(FileHandle1
, PointerCount1
, 1L);
261 SectionObject
= InvalidPointer
;
262 MaximumSize
.QuadPart
= 1;
264 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, NULL
, FileObject1
);
265 EndSeh(STATUS_SUCCESS
);
266 ok_eq_hex(Status
, STATUS_SUCCESS
);
267 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
268 ok(SectionObject
!= InvalidPointer
, "Section object pointer untouched\n");
269 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
271 CheckObject(FileHandle1
, PointerCount1
, 1L);
272 CheckSection(SectionObject
, 0);
273 TestMapView(SectionObject
, TRUE
, FALSE
);
275 if (SectionObject
&& SectionObject
!= InvalidPointer
)
276 ObDereferenceObject(SectionObject
);
277 //--PointerCount1; // ????
279 CheckObject(FileHandle1
, PointerCount1
, 1L);
280 SectionObject
= InvalidPointer
;
281 MaximumSize
.QuadPart
= 1;
283 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, FileHandle1
, FileObject1
);
284 EndSeh(STATUS_SUCCESS
);
285 ok_eq_hex(Status
, STATUS_SUCCESS
);
286 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
287 ok(SectionObject
!= InvalidPointer
, "Section object pointer untouched\n");
288 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
289 CheckObject(FileHandle1
, PointerCount1
, 1L);
290 CheckSection(SectionObject
, 0);
291 TestMapView(SectionObject
, TRUE
, FALSE
);
293 if (SectionObject
&& SectionObject
!= InvalidPointer
)
294 ObDereferenceObject(SectionObject
);
296 /* image section with two different files */
297 CheckObject(FileHandle1
, PointerCount1
, 1L);
298 SectionObject
= InvalidPointer
;
299 MaximumSize
.QuadPart
= 1;
301 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, FileHandle1
, FileObject2
);
302 EndSeh(STATUS_SUCCESS
);
303 ok_eq_hex(Status
, STATUS_SUCCESS
);
304 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
305 ok(SectionObject
!= InvalidPointer
, "Section object pointer untouched\n");
306 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
307 CheckObject(FileHandle1
, PointerCount1
, 1L);
308 CheckObject(FileHandle2
, PointerCount2
, 1L);
309 CheckSection(SectionObject
, 0);
310 TestMapView(SectionObject
, TRUE
, TRUE
);
312 if (SectionObject
&& SectionObject
!= InvalidPointer
)
313 ObDereferenceObject(SectionObject
);
315 CheckObject(FileHandle1
, PointerCount1
, 1L);
316 SectionObject
= InvalidPointer
;
317 MaximumSize
.QuadPart
= 1;
319 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_IMAGE
, FileHandle2
, FileObject1
);
320 EndSeh(STATUS_SUCCESS
);
321 ok_eq_hex(Status
, STATUS_SUCCESS
);
322 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
323 ok(SectionObject
!= InvalidPointer
, "Section object pointer untouched\n");
324 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
325 CheckObject(FileHandle1
, PointerCount1
, 1L);
326 CheckObject(FileHandle2
, PointerCount2
, 1L);
327 CheckSection(SectionObject
, 0);
328 TestMapView(SectionObject
, TRUE
, FALSE
);
330 if (SectionObject
&& SectionObject
!= InvalidPointer
)
331 ObDereferenceObject(SectionObject
);
333 /* data file section */
334 CheckObject(FileHandle1
, PointerCount1
, 1L);
335 SectionObject
= InvalidPointer
;
336 MaximumSize
.QuadPart
= 1;
338 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_RESERVE
, FileHandle1
, NULL
);
339 EndSeh(STATUS_SUCCESS
);
340 ok_eq_hex(Status
, STATUS_SUCCESS
);
341 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
342 ok(SectionObject
!= InvalidPointer
, "Section object pointer untouched\n");
343 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
344 CheckObject(FileHandle1
, PointerCount1
, 1L);
345 CheckSection(SectionObject
, 0);
346 TestMapView(SectionObject
, TRUE
, FALSE
);
348 if (SectionObject
&& SectionObject
!= InvalidPointer
)
349 ObDereferenceObject(SectionObject
);
351 CheckObject(FileHandle1
, PointerCount1
, 1L);
352 SectionObject
= InvalidPointer
;
353 MaximumSize
.QuadPart
= 1;
355 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_RESERVE
, NULL
, FileObject1
);
356 EndSeh(STATUS_SUCCESS
);
357 ok_eq_hex(Status
, STATUS_SUCCESS
);
358 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
359 ok(SectionObject
!= InvalidPointer
, "Section object pointer untouched\n");
360 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
361 CheckObject(FileHandle1
, PointerCount1
, 1L);
362 CheckSection(SectionObject
, 0);
363 TestMapView(SectionObject
, TRUE
, FALSE
);
365 if (SectionObject
&& SectionObject
!= InvalidPointer
)
366 ObDereferenceObject(SectionObject
);
368 CheckObject(FileHandle1
, PointerCount1
, 1L);
369 SectionObject
= InvalidPointer
;
370 MaximumSize
.QuadPart
= 1;
372 Status
= MmCreateSection(&SectionObject
, 0, NULL
, &MaximumSize
, PAGE_READONLY
, SEC_RESERVE
, FileHandle1
, FileObject1
);
373 EndSeh(STATUS_SUCCESS
);
374 ok_eq_hex(Status
, STATUS_SUCCESS
);
375 ok_eq_longlong(MaximumSize
.QuadPart
, 1LL);
376 ok(SectionObject
!= InvalidPointer
, "Section object pointer untouched\n");
377 ok(SectionObject
!= NULL
, "Section object pointer NULL\n");
378 CheckObject(FileHandle1
, PointerCount1
, 1L);
379 CheckSection(SectionObject
, 0);
380 TestMapView(SectionObject
, TRUE
, FALSE
);
382 if (SectionObject
&& SectionObject
!= InvalidPointer
)
383 ObDereferenceObject(SectionObject
);
385 CheckObject(FileHandle1
, PointerCount1
, 1L);
389 START_TEST(MmSection
)
392 HANDLE FileHandle1
= NULL
, FileHandle2
= NULL
;
393 PFILE_OBJECT FileObject1
= NULL
, FileObject2
= NULL
;
394 OBJECT_ATTRIBUTES ObjectAttributes
;
395 IO_STATUS_BLOCK IoStatusBlock
;
396 UNICODE_STRING FileName1
= RTL_CONSTANT_STRING(L
"\\SystemRoot\\kmtest-MmSection.txt");
397 UNICODE_STRING FileName2
= RTL_CONSTANT_STRING(L
"\\SystemRoot\\system32\\ntdll.dll");
398 LARGE_INTEGER FileOffset
;
401 ok(ExGetPreviousMode() == UserMode
, "Previous mode is kernel mode\n");
402 /* create a one-byte file that we can use */
403 InitializeObjectAttributes(&ObjectAttributes
, &FileName1
, OBJ_CASE_INSENSITIVE
, NULL
, NULL
);
404 Status
= ZwCreateFile(&FileHandle1
, GENERIC_WRITE
| SYNCHRONIZE
, &ObjectAttributes
, &IoStatusBlock
, NULL
, FILE_ATTRIBUTE_NORMAL
, FILE_SHARE_READ
, FILE_SUPERSEDE
, FILE_NON_DIRECTORY_FILE
, NULL
, 0);
405 ok_eq_hex(Status
, STATUS_SUCCESS
);
406 ok_eq_ulongptr(IoStatusBlock
.Information
, FILE_CREATED
);
407 ok(FileHandle1
!= NULL
, "FileHandle1 is NULL\n");
410 FileOffset
.QuadPart
= 0;
411 Status
= ZwWriteFile(FileHandle1
, NULL
, NULL
, NULL
, &IoStatusBlock
, &FileData
, sizeof FileData
, &FileOffset
, NULL
);
412 ok(Status
== STATUS_SUCCESS
|| Status
== STATUS_PENDING
, "Status = 0x%08lx\n", Status
);
413 Status
= ZwWaitForSingleObject(FileHandle1
, FALSE
, NULL
);
414 ok_eq_hex(Status
, STATUS_SUCCESS
);
415 ok_eq_ulongptr(IoStatusBlock
.Information
, 1);
416 Status
= ZwClose(FileHandle1
);
417 ok_eq_hex(Status
, STATUS_SUCCESS
);
421 InitializeObjectAttributes(&ObjectAttributes
, &FileName1
, OBJ_CASE_INSENSITIVE
, NULL
, NULL
);
422 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);
423 ok_eq_hex(Status
, STATUS_SUCCESS
);
424 ok_eq_ulongptr(IoStatusBlock
.Information
, FILE_OPENED
);
425 ok(FileHandle1
!= NULL
, "FileHandle1 is NULL\n");
426 CheckObject(FileHandle1
, 2L, 1L);
428 InitializeObjectAttributes(&ObjectAttributes
, &FileName2
, OBJ_CASE_INSENSITIVE
, NULL
, NULL
);
429 Status
= ZwCreateFile(&FileHandle2
, GENERIC_READ
, &ObjectAttributes
, &IoStatusBlock
, NULL
, FILE_ATTRIBUTE_NORMAL
, FILE_SHARE_READ
, FILE_OPEN
, FILE_NON_DIRECTORY_FILE
, NULL
, 0);
430 ok_eq_hex(Status
, STATUS_SUCCESS
);
431 ok_eq_ulongptr(IoStatusBlock
.Information
, FILE_OPENED
);
432 ok(FileHandle2
!= NULL
, "FileHandle2 is NULL\n");
434 if (!skip(Status
== STATUS_SUCCESS
&& FileHandle1
!= NULL
, "Failed to open file 1\n"))
436 Status
= ObReferenceObjectByHandle(FileHandle1
, FILE_READ_DATA
| FILE_WRITE_DATA
, IoFileObjectType
, KernelMode
, (PVOID
*)&FileObject1
, NULL
);
437 ok_eq_hex(Status
, STATUS_SUCCESS
);
438 ok(FileObject1
!= NULL
, "FileObject1 is NULL\n");
439 CheckObject(FileHandle1
, 3L, 1L);
442 if (!skip(Status
== STATUS_SUCCESS
&& FileHandle2
!= NULL
, "Failed to open file 2\n"))
444 Status
= ObReferenceObjectByHandle(FileHandle2
, FILE_READ_DATA
| FILE_WRITE_DATA
, IoFileObjectType
, KernelMode
, (PVOID
*)&FileObject2
, NULL
);
445 ok_eq_hex(Status
, STATUS_SUCCESS
);
446 ok(FileObject2
!= NULL
, "FileObject2 is NULL\n");
449 trace("FileHandle1=%p, FileObject1=%p\n", FileHandle1
, FileObject1
);
450 trace("FileHandle2=%p, FileObject2=%p\n", FileHandle2
, FileObject2
);
451 TestCreateSection(FileHandle1
, FileObject1
, FileHandle2
, FileObject2
);
454 ObDereferenceObject(FileObject2
);
456 ObDereferenceObject(FileObject1
);
458 ZwClose(FileHandle2
);
460 ZwClose(FileHandle1
);