ReactOS 0.4.17-dev-475-g46e69e6
ObTypes.cpp File Reference
#include <kmt_test.h>
#include "ObTypes.hpp"
#include <debug.h>
Include dependency graph for ObTypes.cpp:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define GetTypeIndex(TypeName, NtDdiVersion)    (TypeIndex_ ## TypeName[GetNtDdiIndex(NtDdiVersion)])
 
#define ok_eq_ustr(value, expected)   ok(RtlEqualUnicodeString(value, expected, FALSE), #value " = \"%wZ\", expected \"%%wZ\"\n", value, expected)
 
#define CheckObjectType(TypeName, Variable, Flags, InvalidAttr, ReadMapping, WriteMapping, ExecMapping, AllMapping, ValidMask)
 
#define ObpDirectoryObjectType   NULL
 
#define ObpSymbolicLinkObjectType   NULL
 
#define DbgkDebugObjectType   NULL
 
#define ExEventPairObjectType   NULL
 
#define ExMutantObjectType   NULL
 
#define ExCallbackObjectType   NULL
 
#define ExTimerObjectType   NULL
 
#define ExProfileObjectType   NULL
 
#define ExpKeyedEventObjectType   NULL
 
#define CmpKeyObjectType   NULL
 
#define LpcWaitablePortObjectType   NULL
 
#define IoControllerObjectType   NULL
 
#define IoCompletionObjectType   NULL
 
#define WmipGuidObjectType   NULL
 
#define OBT_NO_DEFAULT   0x01
 
#define OBT_CUSTOM_SECURITY_PROC   0x02
 
#define OBT_SECURITY_REQUIRED   0x04
 
#define OBT_CASE_INSENSITIVE   0x08
 
#define OBT_MAINTAIN_TYPE_LIST   0x10
 
#define OBT_MAINTAIN_HANDLE_COUNT   0x20
 
#define OBT_PAGED_POOL   0x40
 
#define OBT_CUSTOM_KEY   0x80
 
#define TAG(x)   RtlUlongByteSwap(x)
 
#define DIR_SEC_REQUIRED   ((NtDdiVersion >= NTDDI_VISTA) ? OBT_SECURITY_REQUIRED : 0)
 
#define TOKEN_GENERIC_READ   ((NtDdiVersion >= NTDDI_VISTA) ? 0x02001a : 0x020008)
 
#define TOKEN_GENERIC_WRITE   ((NtDdiVersion >= NTDDI_VISTA) ? 0x0201e0 : 0x0200e0)
 
#define TOKEN_GENERIC_EXECUTE   ((NtDdiVersion >= NTDDI_VISTA) ? 0x020005 : 0x020000)
 
#define PROCESS_GENERIC_WRITE   ((NtDdiVersion >= NTDDI_VISTA) ? 0x020bea : 0x020beb)
 
#define PROCESS_GENERIC_EXECUTE   ((NtDdiVersion >= NTDDI_VISTA) ? 0x121001 : 0x120000)
 
#define PROCESS_GENERIC_ALL   ((NtDdiVersion >= NTDDI_VISTA) ? 0x001fffff : 0x1f0fff)
 
#define THREAD_GENERIC_WRITE   ((NtDdiVersion >= NTDDI_VISTA) ? 0x020437 : 0x020037)
 
#define THREAD_GENERIC_EXECUTE   ((NtDdiVersion >= NTDDI_VISTA) ? 0x120800 : 0x120000)
 
#define THREAD_GENERIC_ALL   ((NtDdiVersion >= NTDDI_VISTA) ? 0x1fffff : 0x1f03ff)
 
#define JOB_GENERIC_ALL   ((NtDdiVersion >= NTDDI_VISTA) ? 0x1f001f : 0x1f03ff)
 
#define KEY_GENERIC_EXECUTE   ((NtDdiVersion >= NTDDI_VISTA) ? 0x020039 : 0x020019)
 
#define PROCESS_INDEX   ((NtDdiVersion >= NTDDI_VISTA) ? 6 : 5)
 

Functions

static ULONG GetNtDdiIndex (ULONG NtDdiVersion)
 
static POBJECT_TYPE GetObjectType (IN PCWSTR TypeName)
 
template<unsigned NtDdiVersion>
static VOID TestObjectTypes (VOID)
 
 START_TEST (ObTypes)
 

Variables

const UCHAR TypeIndex_Type [] = { 1, 1 }
 
const UCHAR TypeIndex_Directory [] = { 2, 2 }
 
const UCHAR TypeIndex_SymbolicLink [] = { 3, 3 }
 
const UCHAR TypeIndex_Token [] = { 4, 4 }
 
const UCHAR TypeIndex_Process [] = { 5, 6 }
 
const UCHAR TypeIndex_Thread [] = { 6, 7 }
 
const UCHAR TypeIndex_Job [] = { 7, 5 }
 
const UCHAR TypeIndex_DebugObject [] = { 8, 8 }
 
const UCHAR TypeIndex_Event [] = { 9, 9 }
 
const UCHAR TypeIndex_EventPair [] = { 10, 10 }
 
const UCHAR TypeIndex_Mutant [] = { 11, 11 }
 
const UCHAR TypeIndex_Callback [] = { 12, 12 }
 
const UCHAR TypeIndex_Semaphore [] = { 13, 13 }
 
const UCHAR TypeIndex_Timer [] = { 14, 14 }
 
const UCHAR TypeIndex_Profile [] = { 15, 15 }
 
const UCHAR TypeIndex_KeyedEvent [] = { 16, 16 }
 
const UCHAR TypeIndex_WindowStation [] = { 17, 17 }
 
const UCHAR TypeIndex_Desktop [] = { 18, 18 }
 
const UCHAR TypeIndex_Section [] = { 19, 30 }
 
const UCHAR TypeIndex_Key [] = { 20, 32 }
 
const UCHAR TypeIndex_Port [] = { 21, 21 }
 
const UCHAR TypeIndex_WaitablePort [] = { 22, 22 }
 
const UCHAR TypeIndex_Adapter [] = { 23, 20 }
 
const UCHAR TypeIndex_Controller [] = { 24, 21 }
 
const UCHAR TypeIndex_Device [] = { 25, 22 }
 
const UCHAR TypeIndex_Driver [] = { 26, 23 }
 
const UCHAR TypeIndex_IoCompletion [] = { 27, 24 }
 
const UCHAR TypeIndex_File [] = { 28, 25 }
 
const UCHAR TypeIndex_WmiGuid [] = { 29, 34 }
 
const UCHAR TypeIndex_FilterConnectionPort [] = { 30, 36 }
 
const UCHAR TypeIndex_FilterCommunicationPort [] = { 31, 37 }
 

Macro Definition Documentation

◆ CheckObjectType

#define CheckObjectType (   TypeName,
  Variable,
  Flags,
  InvalidAttr,
  ReadMapping,
  WriteMapping,
  ExecMapping,
  AllMapping,
  ValidMask 
)

Definition at line 95 of file ObTypes.cpp.

◆ CmpKeyObjectType

#define CmpKeyObjectType   NULL

Definition at line 179 of file ObTypes.cpp.

◆ DbgkDebugObjectType

#define DbgkDebugObjectType   NULL

Definition at line 172 of file ObTypes.cpp.

◆ DIR_SEC_REQUIRED

#define DIR_SEC_REQUIRED   ((NtDdiVersion >= NTDDI_VISTA) ? OBT_SECURITY_REQUIRED : 0)

◆ ExCallbackObjectType

#define ExCallbackObjectType   NULL

Definition at line 175 of file ObTypes.cpp.

◆ ExEventPairObjectType

#define ExEventPairObjectType   NULL

Definition at line 173 of file ObTypes.cpp.

◆ ExMutantObjectType

#define ExMutantObjectType   NULL

Definition at line 174 of file ObTypes.cpp.

◆ ExpKeyedEventObjectType

#define ExpKeyedEventObjectType   NULL

Definition at line 178 of file ObTypes.cpp.

◆ ExProfileObjectType

#define ExProfileObjectType   NULL

Definition at line 177 of file ObTypes.cpp.

◆ ExTimerObjectType

#define ExTimerObjectType   NULL

Definition at line 176 of file ObTypes.cpp.

◆ GetTypeIndex

#define GetTypeIndex (   TypeName,
  NtDdiVersion 
)     (TypeIndex_ ## TypeName[GetNtDdiIndex(NtDdiVersion)])

Definition at line 63 of file ObTypes.cpp.

◆ IoCompletionObjectType

#define IoCompletionObjectType   NULL

Definition at line 182 of file ObTypes.cpp.

◆ IoControllerObjectType

#define IoControllerObjectType   NULL

Definition at line 181 of file ObTypes.cpp.

◆ JOB_GENERIC_ALL

#define JOB_GENERIC_ALL   ((NtDdiVersion >= NTDDI_VISTA) ? 0x1f001f : 0x1f03ff)

◆ KEY_GENERIC_EXECUTE

#define KEY_GENERIC_EXECUTE   ((NtDdiVersion >= NTDDI_VISTA) ? 0x020039 : 0x020019)

◆ LpcWaitablePortObjectType

#define LpcWaitablePortObjectType   NULL

Definition at line 180 of file ObTypes.cpp.

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file ObTypes.cpp.

◆ ObpDirectoryObjectType

#define ObpDirectoryObjectType   NULL

Definition at line 170 of file ObTypes.cpp.

◆ ObpSymbolicLinkObjectType

#define ObpSymbolicLinkObjectType   NULL

Definition at line 171 of file ObTypes.cpp.

◆ OBT_CASE_INSENSITIVE

#define OBT_CASE_INSENSITIVE   0x08

Definition at line 188 of file ObTypes.cpp.

◆ OBT_CUSTOM_KEY

#define OBT_CUSTOM_KEY   0x80

Definition at line 192 of file ObTypes.cpp.

◆ OBT_CUSTOM_SECURITY_PROC

#define OBT_CUSTOM_SECURITY_PROC   0x02

Definition at line 186 of file ObTypes.cpp.

◆ OBT_MAINTAIN_HANDLE_COUNT

#define OBT_MAINTAIN_HANDLE_COUNT   0x20

Definition at line 190 of file ObTypes.cpp.

◆ OBT_MAINTAIN_TYPE_LIST

#define OBT_MAINTAIN_TYPE_LIST   0x10

Definition at line 189 of file ObTypes.cpp.

◆ OBT_NO_DEFAULT

#define OBT_NO_DEFAULT   0x01

Definition at line 185 of file ObTypes.cpp.

◆ OBT_PAGED_POOL

#define OBT_PAGED_POOL   0x40

Definition at line 191 of file ObTypes.cpp.

◆ OBT_SECURITY_REQUIRED

#define OBT_SECURITY_REQUIRED   0x04

Definition at line 187 of file ObTypes.cpp.

◆ ok_eq_ustr

#define ok_eq_ustr (   value,
  expected 
)    ok(RtlEqualUnicodeString(value, expected, FALSE), #value " = \"%wZ\", expected \"%%wZ\"\n", value, expected)

Definition at line 93 of file ObTypes.cpp.

◆ PROCESS_GENERIC_ALL

#define PROCESS_GENERIC_ALL   ((NtDdiVersion >= NTDDI_VISTA) ? 0x001fffff : 0x1f0fff)

◆ PROCESS_GENERIC_EXECUTE

#define PROCESS_GENERIC_EXECUTE   ((NtDdiVersion >= NTDDI_VISTA) ? 0x121001 : 0x120000)

◆ PROCESS_GENERIC_WRITE

#define PROCESS_GENERIC_WRITE   ((NtDdiVersion >= NTDDI_VISTA) ? 0x020bea : 0x020beb)

◆ PROCESS_INDEX

#define PROCESS_INDEX   ((NtDdiVersion >= NTDDI_VISTA) ? 6 : 5)

◆ TAG

#define TAG (   x)    RtlUlongByteSwap(x)

Definition at line 194 of file ObTypes.cpp.

◆ THREAD_GENERIC_ALL

#define THREAD_GENERIC_ALL   ((NtDdiVersion >= NTDDI_VISTA) ? 0x1fffff : 0x1f03ff)

◆ THREAD_GENERIC_EXECUTE

#define THREAD_GENERIC_EXECUTE   ((NtDdiVersion >= NTDDI_VISTA) ? 0x120800 : 0x120000)

◆ THREAD_GENERIC_WRITE

#define THREAD_GENERIC_WRITE   ((NtDdiVersion >= NTDDI_VISTA) ? 0x020437 : 0x020037)

◆ TOKEN_GENERIC_EXECUTE

#define TOKEN_GENERIC_EXECUTE   ((NtDdiVersion >= NTDDI_VISTA) ? 0x020005 : 0x020000)

◆ TOKEN_GENERIC_READ

#define TOKEN_GENERIC_READ   ((NtDdiVersion >= NTDDI_VISTA) ? 0x02001a : 0x020008)

◆ TOKEN_GENERIC_WRITE

#define TOKEN_GENERIC_WRITE   ((NtDdiVersion >= NTDDI_VISTA) ? 0x0201e0 : 0x0200e0)

◆ WmipGuidObjectType

#define WmipGuidObjectType   NULL

Definition at line 183 of file ObTypes.cpp.

Function Documentation

◆ GetNtDdiIndex()

static ULONG GetNtDdiIndex ( ULONG  NtDdiVersion)
static

Definition at line 48 of file ObTypes.cpp.

49{
50 switch (NtDdiVersion)
51 {
52 case NTDDI_WS03: return 0;
53 case NTDDI_VISTA: return 1;
54 case NTDDI_VISTASP1: return 1;
55 case NTDDI_VISTASP2: return 1;
56 case NTDDI_VISTASP3: return 1;
57 default:
58 trace("Unsupported NTDDI version 0x%lx\n", NtDdiVersion);
59 return 0;
60 }
61}
#define trace
Definition: atltest.h:70
#define NTDDI_VISTA
Definition: sdkddkver.h:103
#define NTDDI_WS03
Definition: sdkddkver.h:92
#define NTDDI_VISTASP2
Definition: sdkddkver.h:105
#define NTDDI_VISTASP3
Definition: sdkddkver.h:106
#define NTDDI_VISTASP1
Definition: sdkddkver.h:104

◆ GetObjectType()

static POBJECT_TYPE GetObjectType ( IN PCWSTR  TypeName)
static

Definition at line 68 of file ObTypes.cpp.

70{
76
77 RtlInitUnicodeString(&Name, TypeName);
80 ok(Status == STATUS_SUCCESS, "ObOpenObjectByName failed for '%wZ': %08x\n", &Name, Status);
81 ok(Handle != NULL, "ObjectTypeHandle = NULL\n");
82 if (!skip(Status == STATUS_SUCCESS && Handle, "No handle\n"))
83 {
85 ok(Status == STATUS_SUCCESS, "ObReferenceObjectByHandle failed for '%wZ': %08x\n", &Name, Status);
86 ok(ObjectType != NULL, "ObjectType = NULL\n");
88 ok(Status == STATUS_SUCCESS, "ZwClose failed for '%wZ': %08x\n", &Name, Status);
89 }
91}
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
LONG NTSTATUS
Definition: precomp.h:26
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
LPWSTR Name
Definition: desk.c:124
#define NULL
Definition: types.h:112
ULONG Handle
Definition: gdb_input.c:15
Status
Definition: gdiplustypes.h:24
ObjectType
Definition: metafile.c:88
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:115
#define KernelMode
Definition: asm.h:38
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, IN PACCESS_STATE PassedAccessState, IN ACCESS_MASK DesiredAccess, IN OUT PVOID ParseContext, OUT PHANDLE Handle)
Definition: obhandle.c:2535
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:493
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by CloseEnhMetaFile(), get_dc_data_ex(), get_graphics_device_bounds(), MFDRV_CloseMetaFile(), OleIsDcMeta(), STATIC_PaintBitmapfn(), STATIC_PaintEnhMetafn(), STATIC_SetBitmap(), STATIC_SetEnhMetaFile(), test_CopyMetaFile(), test_D3DKMTCreateDCFromMemory(), test_data_handles(), test_DeleteDC(), test_device_caps(), test_ExtTextOut(), test_gdi_objects(), test_GetCurrentObject(), test_handles(), test_handles_on_win64(), test_handles_process(), test_handles_process_dib(), test_handles_thread2(), test_hfont_lifetime(), test_logpen(), test_mf_Blank(), test_mf_Graphics(), test_mf_PatternBrush(), test_mono_1x1_bmp_dbg(), test_nonole_clipboard(), test_SetMetaFileBits(), test_shared_handle_table(), test_thread_objects(), TestObjectTypes(), and wglMakeCurrent().

◆ START_TEST()

START_TEST ( ObTypes  )

Definition at line 324 of file ObTypes.cpp.

330{
331 ULONG NtDdiVersion = GetNTDDIVersion();
332
333 switch (NtDdiVersion)
334 {
335 case NTDDI_WS03:
336 TestObjectTypes<NTDDI_WS03>();
337 return;
338 case NTDDI_VISTA:
339 TestObjectTypes<NTDDI_VISTA>();
340 return;
341 case NTDDI_VISTASP1:
342 case NTDDI_VISTASP2:
343 case NTDDI_VISTASP3:
344 TestObjectTypes<NTDDI_VISTASP1>();
345 return;
346 case NTDDI_WIN7:
347 TestObjectTypes<NTDDI_WIN7>();
348 return;
static ULONG GetNTDDIVersion(VOID)
Definition: apitest.h:23
#define NTDDI_WIN7
Definition: sdkddkver.h:112
uint32_t ULONG
Definition: typedefs.h:59

◆ TestObjectTypes()

template<unsigned NtDdiVersion>
static VOID TestObjectTypes ( VOID  )
static

Definition at line 199 of file ObTypes.cpp.

205{
211
212 ObpTypeObjectType = (OBJECT_TYPE*)GetObjectType(L"\\ObjectTypes\\Type");
213 if (skip(ObpTypeObjectType != NULL, "No Type object type\n"))
214 return;
215
217 ok(ObpDefaultObject != NULL, "No ObpDefaultObject\n");
219 ok(SeDefaultObjectMethod != NULL, "No SeDefaultObjectMethod\n");
220
221#ifdef _PROPER_NT_NDK_EXPORTS
222#define ObpTypeObjectType *ObpTypeObjectType
223#define ObpDirectoryObjectType *ObpDirectoryObjectType
224#define ObpSymbolicLinkObjectType *ObpSymbolicLinkObjectType
225#define PsJobType *PsJobType
226#define DbgkDebugObjectType *DbgkDebugObjectType
227#define ExEventPairObjectType *ExEventPairObjectType
228#define ExMutantObjectType *ExMutantObjectType
229#define ExCallbackObjectType *ExCallbackObjectType
230#define ExTimerObjectType *ExTimerObjectType
231#define ExProfileObjectType *ExProfileObjectType
232#define ExpKeyedEventObjectType *ExpKeyedEventObjectType
233#define ExWindowStationObjectType *ExWindowStationObjectType
234#define ExDesktopObjectType *ExDesktopObjectType
235#define MmSectionObjectType *MmSectionObjectType
236#define CmpKeyObjectType *CmpKeyObjectType
237#define LpcPortObjectType *LpcPortObjectType
238#define LpcWaitablePortObjectType *LpcWaitablePortObjectType
239#define IoAdapterObjectType *IoAdapterObjectType
240#define IoControllerObjectType *IoControllerObjectType
241#define IoDeviceObjectType *IoDeviceObjectType
242#define IoDriverObjectType *IoDriverObjectType
243#define IoCompletionObjectType *IoCompletionObjectType
244#define WmipGuidObjectType *WmipGuidObjectType
245#endif
246
247#define DIR_SEC_REQUIRED ((NtDdiVersion >= NTDDI_VISTA) ? OBT_SECURITY_REQUIRED : 0)
248#define TOKEN_GENERIC_READ ((NtDdiVersion >= NTDDI_VISTA) ? 0x02001a : 0x020008)
249#define TOKEN_GENERIC_WRITE ((NtDdiVersion >= NTDDI_VISTA) ? 0x0201e0 : 0x0200e0)
250#define TOKEN_GENERIC_EXECUTE ((NtDdiVersion >= NTDDI_VISTA) ? 0x020005 : 0x020000)
251#define PROCESS_GENERIC_WRITE ((NtDdiVersion >= NTDDI_VISTA) ? 0x020bea : 0x020beb)
252#define PROCESS_GENERIC_EXECUTE ((NtDdiVersion >= NTDDI_VISTA) ? 0x121001 : 0x120000)
253#define PROCESS_GENERIC_ALL ((NtDdiVersion >= NTDDI_VISTA) ? 0x001fffff : 0x1f0fff)
254#define THREAD_GENERIC_WRITE ((NtDdiVersion >= NTDDI_VISTA) ? 0x020437 : 0x020037)
255#define THREAD_GENERIC_EXECUTE ((NtDdiVersion >= NTDDI_VISTA) ? 0x120800 : 0x120000)
256#define THREAD_GENERIC_ALL ((NtDdiVersion >= NTDDI_VISTA) ? 0x1fffff : 0x1f03ff)
257#define JOB_GENERIC_ALL ((NtDdiVersion >= NTDDI_VISTA) ? 0x1f001f : 0x1f03ff)
258#define KEY_GENERIC_EXECUTE ((NtDdiVersion >= NTDDI_VISTA) ? 0x020039 : 0x020019)
259#define PROCESS_INDEX ((NtDdiVersion >= NTDDI_VISTA) ? 6 : 5)
260
261 CheckObjectType(Type, ObpTypeObjectType, OBT_MAINTAIN_TYPE_LIST | OBT_CUSTOM_KEY, 0x100, 0x020000, 0x020000, 0x020000, 0x0f0001, 0x1f0001);
263 CheckObjectType(Directory, ObpDirectoryObjectType, DIR_SEC_REQUIRED | OBT_CASE_INSENSITIVE | OBT_PAGED_POOL, 0x100, 0x020003, 0x02000c, 0x020003, 0x0f000f, 0x0f000f);
264 CheckObjectType(SymbolicLink, ObpSymbolicLinkObjectType, OBT_CASE_INSENSITIVE | OBT_PAGED_POOL, 0x100, 0x020001, 0x020000, 0x020001, 0x0f0001, 0x0f0001);
268 CheckObjectType(Job, PsJobType, OBT_NO_DEFAULT | OBT_SECURITY_REQUIRED, 0x000, 0x020004, 0x02000b, 0x120000, JOB_GENERIC_ALL, 0x1f001f);
269 CheckObjectType(DebugObject, DbgkDebugObjectType, OBT_NO_DEFAULT | OBT_SECURITY_REQUIRED, 0x000, 0x020001, 0x020002, 0x120000, 0x1f000f, 0x1f000f);
270 CheckObjectType(Event, *ExEventObjectType, OBT_NO_DEFAULT, 0x100, 0x020001, 0x020002, 0x120000, 0x1f0003, 0x1f0003);
271 CheckObjectType(EventPair, ExEventPairObjectType, 0, 0x100, 0x120000, 0x120000, 0x120000, 0x1f0000, 0x1f0000);
272 CheckObjectType(Mutant, ExMutantObjectType, OBT_NO_DEFAULT, 0x100, 0x020001, 0x020000, 0x120000, 0x1f0001, 0x1f0001);
273 CheckObjectType(Callback, ExCallbackObjectType, OBT_NO_DEFAULT, 0x100, 0x020000, 0x020001, 0x120000, 0x1f0001, 0x1f0001);
274 CheckObjectType(Semaphore, *ExSemaphoreObjectType, OBT_NO_DEFAULT, 0x100, 0x020001, 0x020002, 0x120000, 0x1f0003, 0x1f0003);
275 CheckObjectType(Timer, ExTimerObjectType, OBT_NO_DEFAULT, 0x100, 0x020001, 0x020002, 0x120000, 0x1f0003, 0x1f0003);
276 CheckObjectType(Profile, ExProfileObjectType, OBT_NO_DEFAULT, 0x100, 0x020001, 0x020001, 0x020001, 0x0f0001, 0x0f0001);
277 CheckObjectType(KeyedEvent, ExpKeyedEventObjectType, OBT_PAGED_POOL, 0x000, 0x020001, 0x020002, 0x020000, 0x0f0003, 0x1f0003);
279 0x130, 0x020303, 0x02001c, 0x020060, 0x0f037f, 0x0f037f);
281 0x130, 0x020041, 0x0200be, 0x020100, 0x0f01ff, 0x0f01ff);
282 CheckObjectType(Section, MmSectionObjectType, OBT_PAGED_POOL, 0x100, 0x020005, 0x020002, 0x020008, 0x0f001f, 0x1f001f);
284 0x030, 0x020019, 0x020006, KEY_GENERIC_EXECUTE, 0x0f003f, 0x1f003f);
285 if (NtDdiVersion <= NTDDI_WS03)
286 {
287 // 0x7b2 is used for Server 2003 SP2 RTM, it seems it was changed to 0xfb2 in some patch level.
288 CheckObjectType(Port, LpcPortObjectType, OBT_PAGED_POOL, 0xfb2, 0x020001, 0x010001, 0x000000, 0x1f0001, 0x1f0001);
289 // 0x7b2 is used for Server 2003 SP2 RTM, it seems it was changed to 0xfb2 in some patch level.
290 CheckObjectType(WaitablePort, LpcWaitablePortObjectType, OBT_NO_DEFAULT, 0xfb2, 0x020001, 0x010001, 0x000000, 0x1f0001, 0x1f0001);
291 }
292 CheckObjectType(Adapter, IoAdapterObjectType, 0, 0x100, 0x120089, 0x120116, 0x1200a0, 0x1f01ff, 0x1f01ff);
293 CheckObjectType(Controller, IoControllerObjectType, 0, 0x100, 0x120089, 0x120116, 0x1200a0, 0x1f01ff, 0x1f01ff);
295 0x100, 0x120089, 0x120116, 0x1200a0, 0x1f01ff, 0x1f01ff);
296 CheckObjectType(Driver, IoDriverObjectType, OBT_CASE_INSENSITIVE, 0x100, 0x120089, 0x120116, 0x1200a0, 0x1f01ff, 0x1f01ff);
297 CheckObjectType(IoCompletion, IoCompletionObjectType, OBT_CASE_INSENSITIVE, 0x110, 0x020001, 0x020002, 0x120000, 0x1f0003, 0x1f0003);
299 0x130, 0x120089, 0x120116, 0x1200a0, 0x1f01ff, 0x1f01ff);
301 0x100, 0x000001, 0x000002, 0x000010, 0x120fff, 0x1f0fff);
302 CheckObjectType(FilterConnectionPort, NULL, OBT_NO_DEFAULT | OBT_SECURITY_REQUIRED, 0x100, 0x020001, 0x010001, 0x000000, 0x1f0001, 0x1f0001);
303 CheckObjectType(FilterCommunicationPort, NULL, OBT_NO_DEFAULT, 0x100, 0x020001, 0x010001, 0x000000, 0x1f0001, 0x1f0001);
304
305 // exported but not created
307
308 // my Win7/x64 additionally has:
309 // ALPC Port
310 // EtwConsumer
311 // EtwRegistration
312 // IoCompletionReserve
313 // PcwObject
314 // PowerRequest
315 // Session
316 // TmEn
317 // TmRm
318 // TmTm
319 // TmTx
320 // TpWorkerFactory
321 // UserApcReserve
322 // ... and does not have:
#define ObpDirectoryObjectType
Definition: ObTypes.cpp:170
#define KEY_GENERIC_EXECUTE
#define TOKEN_GENERIC_EXECUTE
#define JOB_GENERIC_ALL
#define OBT_CUSTOM_KEY
Definition: ObTypes.cpp:192
#define IoCompletionObjectType
Definition: ObTypes.cpp:182
#define ExProfileObjectType
Definition: ObTypes.cpp:177
#define WmipGuidObjectType
Definition: ObTypes.cpp:183
#define TOKEN_GENERIC_READ
#define IoControllerObjectType
Definition: ObTypes.cpp:181
#define OBT_CUSTOM_SECURITY_PROC
Definition: ObTypes.cpp:186
#define ExEventPairObjectType
Definition: ObTypes.cpp:173
#define THREAD_GENERIC_WRITE
#define PROCESS_GENERIC_WRITE
#define THREAD_GENERIC_EXECUTE
#define OBT_CASE_INSENSITIVE
Definition: ObTypes.cpp:188
#define LpcWaitablePortObjectType
Definition: ObTypes.cpp:180
#define ExTimerObjectType
Definition: ObTypes.cpp:176
#define OBT_NO_DEFAULT
Definition: ObTypes.cpp:185
#define OBT_MAINTAIN_HANDLE_COUNT
Definition: ObTypes.cpp:190
#define DIR_SEC_REQUIRED
#define OBT_MAINTAIN_TYPE_LIST
Definition: ObTypes.cpp:189
#define PROCESS_GENERIC_EXECUTE
#define ObpSymbolicLinkObjectType
Definition: ObTypes.cpp:171
#define DbgkDebugObjectType
Definition: ObTypes.cpp:172
#define OBT_SECURITY_REQUIRED
Definition: ObTypes.cpp:187
#define TOKEN_GENERIC_WRITE
#define ExpKeyedEventObjectType
Definition: ObTypes.cpp:178
#define CmpKeyObjectType
Definition: ObTypes.cpp:179
#define ExCallbackObjectType
Definition: ObTypes.cpp:175
#define ExMutantObjectType
Definition: ObTypes.cpp:174
#define CheckObjectType(TypeName, Variable, Flags, InvalidAttr, ReadMapping, WriteMapping, ExecMapping, AllMapping, ValidMask)
Definition: ObTypes.cpp:95
#define PROCESS_GENERIC_ALL
#define OBT_PAGED_POOL
Definition: ObTypes.cpp:191
#define THREAD_GENERIC_ALL
static POBJECT_TYPE GetObjectType(IN PCWSTR TypeName)
Definition: ObTypes.cpp:68
Type
Definition: Type.h:7
#define ok_eq_pointer(value, expected)
Definition: apitest.h:116
#define ok_eq_hex(value, expected)
Definition: apitest.h:134
Definition: File.h:16
static CHAR Desktop[MAX_PATH]
Definition: dem.c:256
static const WCHAR SymbolicLink[]
Definition: interface.c:31
#define L(x)
Definition: resources.c:13
NTSTATUS NTAPI IoCompletion(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Ctx)
Definition: control.c:393
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
CPPORT Port[4]
Definition: headless.c:38
POBJECT_TYPE IoDeviceObjectType
Definition: iomgr.c:35
POBJECT_TYPE IoFileObjectType
Definition: iomgr.c:36
POBJECT_TYPE LpcPortObjectType
Definition: port.c:17
NTSTATUS(NTAPI * OB_SECURITY_METHOD)(_In_ PVOID Object, _In_ SECURITY_OPERATION_CODE OperationType, _In_ PSECURITY_INFORMATION SecurityInformation, _In_ PSECURITY_DESCRIPTOR SecurityDescriptor, _Inout_ PULONG CapturedLength, _Inout_ PSECURITY_DESCRIPTOR *ObjectSecurityDescriptor, _In_ POOL_TYPE PoolType, _In_ PGENERIC_MAPPING GenericMapping)
Definition: obtypes.h:229
_In_ BOOLEAN _In_ USHORT Directory
Definition: rtlfuncs.h:3942
OBJECT_TYPE
Definition: ntobjenum.h:13
POBJECT_TYPE ExEventObjectType
Definition: event.c:18
NTSTATUS NTAPI SeDefaultObjectMethod(_In_ PVOID Object, _In_ SECURITY_OPERATION_CODE OperationType, _In_ PSECURITY_INFORMATION SecurityInformation, _Inout_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor, _Inout_opt_ PULONG ReturnLength, _Inout_opt_ PSECURITY_DESCRIPTOR *OldSecurityDescriptor, _In_ POOL_TYPE PoolType, _In_ PGENERIC_MAPPING GenericMapping)
POBJECT_TYPE IoDeviceHandlerObjectType
Definition: adapter.c:19
POBJECT_TYPE IoAdapterObjectType
Definition: adapter.c:18
POBJECT_TYPE IoDriverObjectType
Definition: driver.c:34
POBJECT_TYPE PsProcessType
Definition: process.c:20
POBJECT_TYPE PsThreadType
Definition: thread.c:20
POBJECT_TYPE SeTokenObjectType
Definition: token.c:17
POBJECT_TYPE ObpTypeObjectType
Definition: oblife.c:22
KEVENT ObpDefaultObject
Definition: oblife.c:23
POBJECT_TYPE PsJobType
Definition: job.c:20
POBJECT_TYPE MmSectionObjectType
Definition: section.c:196
POBJECT_TYPE ExSemaphoreObjectType
Definition: sem.c:22
OB_SECURITY_METHOD SecurityProcedure
Definition: obtypes.h:371
OBJECT_TYPE_INITIALIZER TypeInfo
Definition: obtypes.h:390
ULONG Key
Definition: obtypes.h:391
PVOID DefaultObject
Definition: obtypes.h:384
Definition: fs_rec.h:143
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_Must_inspect_result_ _In_ WDFDRIVER Driver
Definition: wdfcontrol.h:83
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
POBJECT_TYPE ExDesktopObjectType
Definition: win32k.c:22
POBJECT_TYPE ExWindowStationObjectType
Definition: win32k.c:21

Variable Documentation

◆ TypeIndex_Adapter

const UCHAR TypeIndex_Adapter[] = { 23, 20 }

Definition at line 36 of file ObTypes.cpp.

◆ TypeIndex_Callback

const UCHAR TypeIndex_Callback[] = { 12, 12 }

Definition at line 25 of file ObTypes.cpp.

◆ TypeIndex_Controller

const UCHAR TypeIndex_Controller[] = { 24, 21 }

Definition at line 37 of file ObTypes.cpp.

◆ TypeIndex_DebugObject

const UCHAR TypeIndex_DebugObject[] = { 8, 8 }

Definition at line 21 of file ObTypes.cpp.

◆ TypeIndex_Desktop

const UCHAR TypeIndex_Desktop[] = { 18, 18 }

Definition at line 31 of file ObTypes.cpp.

◆ TypeIndex_Device

const UCHAR TypeIndex_Device[] = { 25, 22 }

Definition at line 38 of file ObTypes.cpp.

◆ TypeIndex_Directory

const UCHAR TypeIndex_Directory[] = { 2, 2 }

Definition at line 15 of file ObTypes.cpp.

◆ TypeIndex_Driver

const UCHAR TypeIndex_Driver[] = { 26, 23 }

Definition at line 39 of file ObTypes.cpp.

◆ TypeIndex_Event

const UCHAR TypeIndex_Event[] = { 9, 9 }

Definition at line 22 of file ObTypes.cpp.

◆ TypeIndex_EventPair

const UCHAR TypeIndex_EventPair[] = { 10, 10 }

Definition at line 23 of file ObTypes.cpp.

◆ TypeIndex_File

const UCHAR TypeIndex_File[] = { 28, 25 }

Definition at line 41 of file ObTypes.cpp.

◆ TypeIndex_FilterCommunicationPort

const UCHAR TypeIndex_FilterCommunicationPort[] = { 31, 37 }

Definition at line 44 of file ObTypes.cpp.

◆ TypeIndex_FilterConnectionPort

const UCHAR TypeIndex_FilterConnectionPort[] = { 30, 36 }

Definition at line 43 of file ObTypes.cpp.

◆ TypeIndex_IoCompletion

const UCHAR TypeIndex_IoCompletion[] = { 27, 24 }

Definition at line 40 of file ObTypes.cpp.

◆ TypeIndex_Job

const UCHAR TypeIndex_Job[] = { 7, 5 }

Definition at line 20 of file ObTypes.cpp.

◆ TypeIndex_Key

const UCHAR TypeIndex_Key[] = { 20, 32 }

Definition at line 33 of file ObTypes.cpp.

◆ TypeIndex_KeyedEvent

const UCHAR TypeIndex_KeyedEvent[] = { 16, 16 }

Definition at line 29 of file ObTypes.cpp.

◆ TypeIndex_Mutant

const UCHAR TypeIndex_Mutant[] = { 11, 11 }

Definition at line 24 of file ObTypes.cpp.

◆ TypeIndex_Port

const UCHAR TypeIndex_Port[] = { 21, 21 }

Definition at line 34 of file ObTypes.cpp.

◆ TypeIndex_Process

const UCHAR TypeIndex_Process[] = { 5, 6 }

Definition at line 18 of file ObTypes.cpp.

◆ TypeIndex_Profile

const UCHAR TypeIndex_Profile[] = { 15, 15 }

Definition at line 28 of file ObTypes.cpp.

◆ TypeIndex_Section

const UCHAR TypeIndex_Section[] = { 19, 30 }

Definition at line 32 of file ObTypes.cpp.

◆ TypeIndex_Semaphore

const UCHAR TypeIndex_Semaphore[] = { 13, 13 }

Definition at line 26 of file ObTypes.cpp.

◆ TypeIndex_SymbolicLink

const UCHAR TypeIndex_SymbolicLink[] = { 3, 3 }

Definition at line 16 of file ObTypes.cpp.

◆ TypeIndex_Thread

const UCHAR TypeIndex_Thread[] = { 6, 7 }

Definition at line 19 of file ObTypes.cpp.

◆ TypeIndex_Timer

const UCHAR TypeIndex_Timer[] = { 14, 14 }

Definition at line 27 of file ObTypes.cpp.

◆ TypeIndex_Token

const UCHAR TypeIndex_Token[] = { 4, 4 }

Definition at line 17 of file ObTypes.cpp.

◆ TypeIndex_Type

const UCHAR TypeIndex_Type[] = { 1, 1 }

Definition at line 14 of file ObTypes.cpp.

◆ TypeIndex_WaitablePort

const UCHAR TypeIndex_WaitablePort[] = { 22, 22 }

Definition at line 35 of file ObTypes.cpp.

◆ TypeIndex_WindowStation

const UCHAR TypeIndex_WindowStation[] = { 17, 17 }

Definition at line 30 of file ObTypes.cpp.

◆ TypeIndex_WmiGuid

const UCHAR TypeIndex_WmiGuid[] = { 29, 34 }

Definition at line 42 of file ObTypes.cpp.