From 2c909db295f72693e481c9c1ae01ad7695aecc3b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 13 Feb 2018 21:33:04 +0100 Subject: [PATCH] [NTOS:OB] Rename object types to their official names to satisfy WinDbg - Rename ObDirectoryType to ObpDirectoryObjectType and remove it from NDK (this is not exported!) - Rename ObSymbolicLinkType to ObpSymbolicLinkObjectType - Remove duplicated ObpTypeObjectType from ob.h --- ntoskrnl/include/internal/ob.h | 4 ++-- ntoskrnl/ob/devicemap.c | 2 +- ntoskrnl/ob/obdir.c | 8 ++++---- ntoskrnl/ob/obhandle.c | 4 ++-- ntoskrnl/ob/obinit.c | 12 ++++++------ ntoskrnl/ob/oblife.c | 4 ++-- ntoskrnl/ob/oblink.c | 12 ++++++------ ntoskrnl/ob/obname.c | 8 ++++---- ntoskrnl/ob/obref.c | 2 +- ntoskrnl/ob/obsecure.c | 2 +- sdk/include/ndk/obtypes.h | 1 - 11 files changed, 29 insertions(+), 30 deletions(-) diff --git a/ntoskrnl/include/internal/ob.h b/ntoskrnl/include/internal/ob.h index 374f4a2c3e3..e6f9c562926 100644 --- a/ntoskrnl/include/internal/ob.h +++ b/ntoskrnl/include/internal/ob.h @@ -601,8 +601,8 @@ extern ULONG ObpTraceLevel; extern KEVENT ObpDefaultObject; extern KGUARDED_MUTEX ObpDeviceMapLock; extern POBJECT_TYPE ObpTypeObjectType; -extern POBJECT_TYPE ObSymbolicLinkType; -extern POBJECT_TYPE ObpTypeObjectType; +extern POBJECT_TYPE ObpDirectoryObjectType; +extern POBJECT_TYPE ObpSymbolicLinkObjectType; extern POBJECT_DIRECTORY ObpRootDirectoryObject; extern POBJECT_DIRECTORY ObpTypeDirectoryObject; extern PHANDLE_TABLE ObpKernelHandleTable; diff --git a/ntoskrnl/ob/devicemap.c b/ntoskrnl/ob/devicemap.c index d79f7f6b4a1..32f45fa4a64 100644 --- a/ntoskrnl/ob/devicemap.c +++ b/ntoskrnl/ob/devicemap.c @@ -25,7 +25,7 @@ ObpCreateDeviceMap(IN HANDLE DirectoryHandle) Status = ObReferenceObjectByHandle(DirectoryHandle, DIRECTORY_TRAVERSE, - ObDirectoryType, + ObpDirectoryObjectType, KeGetPreviousMode(), (PVOID*)&DirectoryObject, NULL); diff --git a/ntoskrnl/ob/obdir.c b/ntoskrnl/ob/obdir.c index b2f1f14382a..3c62411fed5 100644 --- a/ntoskrnl/ob/obdir.c +++ b/ntoskrnl/ob/obdir.c @@ -18,7 +18,7 @@ #include BOOLEAN ObpLUIDDeviceMapsEnabled; -POBJECT_TYPE ObDirectoryType = NULL; +POBJECT_TYPE ObpDirectoryObjectType = NULL; /* PRIVATE FUNCTIONS ******************************************************/ @@ -383,7 +383,7 @@ NtOpenDirectoryObject(OUT PHANDLE DirectoryHandle, /* Open the directory object */ Status = ObOpenObjectByName(ObjectAttributes, - ObDirectoryType, + ObpDirectoryObjectType, PreviousMode, NULL, DesiredAccess, @@ -520,7 +520,7 @@ NtQueryDirectoryObject(IN HANDLE DirectoryHandle, /* Get a reference to directory */ Status = ObReferenceObjectByHandle(DirectoryHandle, DIRECTORY_QUERY, - ObDirectoryType, + ObpDirectoryObjectType, PreviousMode, (PVOID*)&Directory, NULL); @@ -756,7 +756,7 @@ NtCreateDirectoryObject(OUT PHANDLE DirectoryHandle, /* Create the object */ Status = ObCreateObject(PreviousMode, - ObDirectoryType, + ObpDirectoryObjectType, ObjectAttributes, PreviousMode, NULL, diff --git a/ntoskrnl/ob/obhandle.c b/ntoskrnl/ob/obhandle.c index d753a68fad6..057cdecd7ff 100644 --- a/ntoskrnl/ob/obhandle.c +++ b/ntoskrnl/ob/obhandle.c @@ -3095,7 +3095,7 @@ ObInsertObject(IN PVOID Object, { /* Check if this was a symbolic link */ if (OBJECT_TO_OBJECT_HEADER(InsertObject)->Type == - ObSymbolicLinkType) + ObpSymbolicLinkObjectType) { /* Dereference it */ ObDereferenceObject(InsertObject); @@ -3129,7 +3129,7 @@ ObInsertObject(IN PVOID Object, else { /* Check if this is a symbolic link */ - if (ObjectType == ObSymbolicLinkType) + if (ObjectType == ObpSymbolicLinkObjectType) { /* Create the internal name */ ObpCreateSymbolicLinkName(Object); diff --git a/ntoskrnl/ob/obinit.c b/ntoskrnl/ob/obinit.c index dcda078d308..dcc2448a4a1 100644 --- a/ntoskrnl/ob/obinit.c +++ b/ntoskrnl/ob/obinit.c @@ -282,8 +282,8 @@ ObInitSystem(VOID) ObjectTypeInitializer.GenericMapping = ObpDirectoryMapping; ObjectTypeInitializer.DeleteProcedure = NULL; ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_DIRECTORY); - ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObDirectoryType); - ObDirectoryType->TypeInfo.ValidAccessMask &= ~SYNCHRONIZE; + ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObpDirectoryObjectType); + ObpDirectoryObjectType->TypeInfo.ValidAccessMask &= ~SYNCHRONIZE; /* Create 'symbolic link' object type */ RtlInitUnicodeString(&Name, L"SymbolicLink"); @@ -292,8 +292,8 @@ ObInitSystem(VOID) ObjectTypeInitializer.ValidAccessMask = SYMBOLIC_LINK_ALL_ACCESS; ObjectTypeInitializer.ParseProcedure = ObpParseSymbolicLink; ObjectTypeInitializer.DeleteProcedure = ObpDeleteSymbolicLink; - ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObSymbolicLinkType); - ObSymbolicLinkType->TypeInfo.ValidAccessMask &= ~SYNCHRONIZE; + ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObpSymbolicLinkObjectType); + ObpSymbolicLinkObjectType->TypeInfo.ValidAccessMask &= ~SYNCHRONIZE; /* Phase 0 initialization complete */ ObpInitializationPhase++; @@ -321,7 +321,7 @@ ObPostPhase0: /* Get a handle to it */ Status = ObReferenceObjectByHandle(Handle, 0, - ObDirectoryType, + ObpDirectoryObjectType, KernelMode, (PVOID*)&ObpRootDirectoryObject, NULL); @@ -372,7 +372,7 @@ ObPostPhase0: /* Get a handle to it */ Status = ObReferenceObjectByHandle(Handle, 0, - ObDirectoryType, + ObpDirectoryObjectType, KernelMode, (PVOID*)&ObpTypeDirectoryObject, NULL); diff --git a/ntoskrnl/ob/oblife.c b/ntoskrnl/ob/oblife.c index 2bfc35a0892..56dbcae4215 100644 --- a/ntoskrnl/ob/oblife.c +++ b/ntoskrnl/ob/oblife.c @@ -1563,7 +1563,7 @@ NtQueryObject(IN HANDLE ObjectHandle, BasicInfo->SecurityDescriptorSize = 0; /* FIXME*/ /* Check if this is a symlink */ - if (ObjectHeader->Type == ObSymbolicLinkType) + if (ObjectHeader->Type == ObpSymbolicLinkObjectType) { /* Return the creation time */ BasicInfo->CreationTime.QuadPart = @@ -1798,7 +1798,7 @@ NtSetInformationObject(IN HANDLE ObjectHandle, /* Get the object directory */ Status = ObReferenceObjectByHandle(ObjectHandle, 0, - ObDirectoryType, + ObpDirectoryObjectType, PreviousMode, (PVOID*)&Directory, NULL); diff --git a/ntoskrnl/ob/oblink.c b/ntoskrnl/ob/oblink.c index 2631bd7e655..f8fbe5ad500 100644 --- a/ntoskrnl/ob/oblink.c +++ b/ntoskrnl/ob/oblink.c @@ -15,7 +15,7 @@ /* GLOBALS ******************************************************************/ -POBJECT_TYPE ObSymbolicLinkType = NULL; +POBJECT_TYPE ObpSymbolicLinkObjectType = NULL; /* PRIVATE FUNCTIONS *********************************************************/ @@ -150,12 +150,12 @@ ObpParseSymbolicLinkToIoDeviceObject(IN POBJECT_DIRECTORY SymbolicLinkDirectory, if (! *Object) break; - if (OBJECT_TO_OBJECT_HEADER(*Object)->Type == ObDirectoryType) + if (OBJECT_TO_OBJECT_HEADER(*Object)->Type == ObpDirectoryObjectType) { /* Make this current directory, and continue search */ *Directory = (POBJECT_DIRECTORY)*Object; } - else if (OBJECT_TO_OBJECT_HEADER(*Object)->Type == ObSymbolicLinkType && + else if (OBJECT_TO_OBJECT_HEADER(*Object)->Type == ObpSymbolicLinkObjectType && (((POBJECT_SYMBOLIC_LINK)*Object)->DosDeviceDriveIndex == 0)) { /* Symlink points to another initialized symlink, ask caller to reparse */ @@ -574,7 +574,7 @@ NtCreateSymbolicLinkObject(OUT PHANDLE LinkHandle, /* Create the object */ Status = ObCreateObject(PreviousMode, - ObSymbolicLinkType, + ObpSymbolicLinkObjectType, ObjectAttributes, PreviousMode, NULL, @@ -696,7 +696,7 @@ NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle, /* Open the object */ Status = ObOpenObjectByName(ObjectAttributes, - ObSymbolicLinkType, + ObpSymbolicLinkObjectType, PreviousMode, NULL, DesiredAccess, @@ -784,7 +784,7 @@ NtQuerySymbolicLinkObject(IN HANDLE LinkHandle, /* Reference the object */ Status = ObReferenceObjectByHandle(LinkHandle, SYMBOLIC_LINK_QUERY, - ObSymbolicLinkType, + ObpSymbolicLinkObjectType, PreviousMode, (PVOID *)&SymlinkObject, NULL); diff --git a/ntoskrnl/ob/obname.c b/ntoskrnl/ob/obname.c index 32e48941f7e..bf559477d89 100644 --- a/ntoskrnl/ob/obname.c +++ b/ntoskrnl/ob/obname.c @@ -306,7 +306,7 @@ ObpDeleteNameCheck(IN PVOID Object) ObpDeleteEntryDirectory(&Context); /* Check if this is a symbolic link */ - if (ObjectType == ObSymbolicLinkType) + if (ObjectType == ObpSymbolicLinkObjectType) { /* Remove internal name */ ObpDeleteSymbolicLinkName(Object); @@ -434,7 +434,7 @@ ObpLookupObjectName(IN HANDLE RootHandle OPTIONAL, } /* Don't parse a Directory */ - if (ObjectHeader->Type != ObDirectoryType) + if (ObjectHeader->Type != ObpDirectoryObjectType) { /* Make sure the Object Type has a parse routine */ ParseRoutine = ObjectHeader->Type->TypeInfo.ParseProcedure; @@ -745,7 +745,7 @@ ParseFromRoot: /* Check create access for the object */ if (!ObCheckCreateObjectAccess(Directory, - ObjectType == ObDirectoryType ? + ObjectType == ObpDirectoryObjectType ? DIRECTORY_CREATE_SUBDIRECTORY : DIRECTORY_CREATE_OBJECT, AccessState, @@ -988,7 +988,7 @@ ReparseObject: else { /* We still have a name; check if this is a directory object */ - if (ObjectHeader->Type == ObDirectoryType) + if (ObjectHeader->Type == ObpDirectoryObjectType) { /* Check if we have a referenced parent directory */ if (ReferencedParentDirectory) diff --git a/ntoskrnl/ob/obref.c b/ntoskrnl/ob/obref.c index d6b29d343bb..099903d6308 100644 --- a/ntoskrnl/ob/obref.c +++ b/ntoskrnl/ob/obref.c @@ -395,7 +395,7 @@ ObReferenceObjectByPointer(IN PVOID Object, * NOTE: Unless it's a symbolic link (Caz Yokoyama [MSFT]) */ if ((Header->Type != ObjectType) && ((AccessMode != KernelMode) || - (ObjectType == ObSymbolicLinkType))) + (ObjectType == ObpSymbolicLinkObjectType))) { /* Invalid type */ return STATUS_OBJECT_TYPE_MISMATCH; diff --git a/ntoskrnl/ob/obsecure.c b/ntoskrnl/ob/obsecure.c index 3009c448967..135b7b2f5e1 100644 --- a/ntoskrnl/ob/obsecure.c +++ b/ntoskrnl/ob/obsecure.c @@ -561,7 +561,7 @@ ObAssignSecurity(IN PACCESS_STATE AccessState, Status = SeAssignSecurity(SecurityDescriptor, AccessState->SecurityDescriptor, &NewDescriptor, - (Type == ObDirectoryType), + (Type == ObpDirectoryObjectType), &AccessState->SubjectSecurityContext, &Type->TypeInfo.GenericMapping, PagedPool); diff --git a/sdk/include/ndk/obtypes.h b/sdk/include/ndk/obtypes.h index 034f101188c..6a483f6175a 100644 --- a/sdk/include/ndk/obtypes.h +++ b/sdk/include/ndk/obtypes.h @@ -544,7 +544,6 @@ typedef struct _OBJECT_SYMBOLIC_LINK // // Kernel Exports // -extern POBJECT_TYPE NTSYSAPI ObDirectoryType; extern PDEVICE_MAP NTSYSAPI ObSystemDeviceMap; #endif // !NTOS_MODE_USER -- 2.17.1