ReactOS 0.4.15-dev-7693-gd0e2924
ObQuery.c File Reference
#include <kmt_test.h>
Include dependency graph for ObQuery.c:

Go to the source code of this file.

Macros

#define OBJ_WINSTA_DIRECTORY_NAME_INFO_SIZE   (sizeof(UNICODE_STRING) + sizeof(L"\\Windows"))
 
#define OBJ_DIRECTORY_TYPE_INFO_SIZE   (sizeof(OBJECT_TYPE_INFORMATION) + sizeof(L"Directory"))
 

Functions

static VOID ObjectBasicInformationTests (VOID)
 
 START_TEST (ObQuery)
 

Macro Definition Documentation

◆ OBJ_DIRECTORY_TYPE_INFO_SIZE

#define OBJ_DIRECTORY_TYPE_INFO_SIZE   (sizeof(OBJECT_TYPE_INFORMATION) + sizeof(L"Directory"))

Definition at line 11 of file ObQuery.c.

◆ OBJ_WINSTA_DIRECTORY_NAME_INFO_SIZE

#define OBJ_WINSTA_DIRECTORY_NAME_INFO_SIZE   (sizeof(UNICODE_STRING) + sizeof(L"\\Windows"))

Definition at line 10 of file ObQuery.c.

Function Documentation

◆ ObjectBasicInformationTests()

static VOID ObjectBasicInformationTests ( VOID  )
static

Definition at line 15 of file ObQuery.c.

16{
18 HANDLE WinStaDirHandle;
22 static UNICODE_STRING WinStaDir = RTL_CONSTANT_STRING(L"\\Windows");
23
24 /* We must be in PASSIVE_LEVEL to do all of this stuff */
25 ok_irql(PASSIVE_LEVEL);
26
27 /* Create a path to \Windows directory */
29 &WinStaDir,
31 NULL,
32 NULL);
33 Status = ZwOpenDirectoryObject(&WinStaDirHandle,
36 if (!NT_SUCCESS(Status))
37 {
38 ok(FALSE, "Failed to open \\Windows directory (Status 0x%lx)\n", Status);
39 return;
40 }
41
42 /* Give 0 as information length, this must fail */
43 Status = ZwQueryObject(WinStaDirHandle,
45 &BasicInfo,
46 0,
49
50 /* Do a proper query now */
51 Status = ZwQueryObject(WinStaDirHandle,
53 &BasicInfo,
54 sizeof(BasicInfo),
57
58 /* \Windows is currently used */
59 ok(BasicInfo.HandleCount != 0, "\\Windows is in use but HandleCount is 0!\n");
60 ok(BasicInfo.PointerCount != 0, "\\Windows is in use but PointerCount is 0!\n");
61
64
65 ZwClose(WinStaDirHandle);
66}
@ ObjectBasicInformation
Definition: DriverTester.h:54
#define OBJ_WINSTA_DIRECTORY_NAME_INFO_SIZE
Definition: ObQuery.c:10
#define OBJ_DIRECTORY_TYPE_INFO_SIZE
Definition: ObQuery.c:11
#define ok_eq_hex(value, expected)
Definition: apitest.h:76
#define ok_eq_ulong(value, expected)
Definition: apitest.h:62
#define ok(value,...)
Definition: atltest.h:57
LONG NTSTATUS
Definition: precomp.h:26
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:43
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
Status
Definition: gdiplustypes.h:25
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_OPENIF
Definition: winternl.h:229
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
NTSYSAPI NTSTATUS NTAPI ZwOpenDirectoryObject(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes)
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define DIRECTORY_QUERY
Definition: nt_native.h:1254
#define DIRECTORY_TRAVERSE
Definition: nt_native.h:1255
#define L(x)
Definition: ntvdm.h:50
#define STATUS_SUCCESS
Definition: shellext.h:65
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( ObQuery  )

Definition at line 68 of file ObQuery.c.

69{
71}
static VOID ObjectBasicInformationTests(VOID)
Definition: ObQuery.c:15