Author: ion
Date: Mon Jun 5 10:31:42 2006
New Revision: 22232
URL:
http://svn.reactos.ru/svn/reactos?rev=22232&view=rev
Log:
- Rename ObpCreateTypeObject to ObCreateObjectType and fix definition. The latter is
actually exported in NT, and there's no reason not to export it while having our own
internally renamed version.
- Added stub exports for ObCloseHandle, ObReferenceSecurityDesciptor,
ObSetHandleAttributes, ObSetSecurityObjectByPointer so that someday someone can know what
needs to be implemented.
- Removed ObGetObjectPointerCount. It is not exported in newer OSes and was always
undocumented.
- Move ObQueryObjecctAuditingByHandle to security.c and optimized it not to attach to the
system process, as well as to cache the handle table instead of dereferencing the owner
process all the time.
Modified:
trunk/reactos/include/ndk/obfuncs.h
trunk/reactos/ntoskrnl/cm/registry.c
trunk/reactos/ntoskrnl/ex/callback.c
trunk/reactos/ntoskrnl/ex/event.c
trunk/reactos/ntoskrnl/ex/evtpair.c
trunk/reactos/ntoskrnl/ex/mutant.c
trunk/reactos/ntoskrnl/ex/profile.c
trunk/reactos/ntoskrnl/ex/sem.c
trunk/reactos/ntoskrnl/ex/timer.c
trunk/reactos/ntoskrnl/ex/win32k.c
trunk/reactos/ntoskrnl/include/internal/ob.h
trunk/reactos/ntoskrnl/io/driver.c
trunk/reactos/ntoskrnl/io/iocomp.c
trunk/reactos/ntoskrnl/io/iomgr.c
trunk/reactos/ntoskrnl/lpc/port.c
trunk/reactos/ntoskrnl/mm/section.c
trunk/reactos/ntoskrnl/ntoskrnl.def
trunk/reactos/ntoskrnl/ob/obhandle.c
trunk/reactos/ntoskrnl/ob/obinit.c
trunk/reactos/ntoskrnl/ob/oblife.c
trunk/reactos/ntoskrnl/ob/obname.c
trunk/reactos/ntoskrnl/ob/obref.c
trunk/reactos/ntoskrnl/ob/security.c
trunk/reactos/ntoskrnl/ob/symlink.c
trunk/reactos/ntoskrnl/ps/job.c
trunk/reactos/ntoskrnl/ps/psmgr.c
trunk/reactos/ntoskrnl/se/token.c
Modified: trunk/reactos/include/ndk/obfuncs.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/include/ndk/obfuncs.h?rev=2…
==============================================================================
--- trunk/reactos/include/ndk/obfuncs.h (original)
+++ trunk/reactos/include/ndk/obfuncs.h Mon Jun 5 10:31:42 2006
@@ -44,6 +44,15 @@
OUT PVOID *Object
);
+NTSTATUS
+NTAPI
+ObCreateObjectType(
+ IN PUNICODE_STRING TypeName,
+ IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer,
+ IN PVOID Reserved,
+ OUT POBJECT_TYPE *ObjectType
+);
+
NTKERNELAPI
ULONG
NTAPI
Modified: trunk/reactos/ntoskrnl/cm/registry.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/cm/registry.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/cm/registry.c (original)
+++ trunk/reactos/ntoskrnl/cm/registry.c Mon Jun 5 10:31:42 2006
@@ -22,6 +22,7 @@
#pragma alloc_text(INIT, CmInit2)
#endif
+#define ObGetObjectPointerCount(x) OBJECT_TO_OBJECT_HEADER(x)->PointerCount
/* GLOBALS ******************************************************************/
@@ -373,7 +374,7 @@
ObjectTypeInitializer.SecurityProcedure = CmiObjectSecurity;
ObjectTypeInitializer.QueryNameProcedure = CmiObjectQueryName;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &CmiKeyType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &CmiKeyType);
/* Initialize the hive list */
InitializeListHead(&CmiHiveListHead);
Modified: trunk/reactos/ntoskrnl/ex/callback.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ex/callback.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/callback.c (original)
+++ trunk/reactos/ntoskrnl/ex/callback.c Mon Jun 5 10:31:42 2006
@@ -97,7 +97,7 @@
ObjectTypeInitializer.GenericMapping = ExpCallbackMapping;
ObjectTypeInitializer.PoolType = NonPagedPool;
- Status = ObpCreateTypeObject(&ObjectTypeInitializer, &Name,
&ExCallbackObjectType);
+ Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExCallbackObjectType);
/* Fail if it wasn't created successfully */
if (!NT_SUCCESS(Status))
Modified: trunk/reactos/ntoskrnl/ex/event.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ex/event.c?rev=222…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/event.c (original)
+++ trunk/reactos/ntoskrnl/ex/event.c Mon Jun 5 10:31:42 2006
@@ -53,7 +53,7 @@
ObjectTypeInitializer.GenericMapping = ExpEventMapping;
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.ValidAccessMask = EVENT_ALL_ACCESS;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExEventObjectType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExEventObjectType);
}
/*
Modified: trunk/reactos/ntoskrnl/ex/evtpair.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ex/evtpair.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/evtpair.c (original)
+++ trunk/reactos/ntoskrnl/ex/evtpair.c Mon Jun 5 10:31:42 2006
@@ -49,7 +49,7 @@
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.ValidAccessMask = EVENT_PAIR_ALL_ACCESS;
ObjectTypeInitializer.UseDefaultObject = TRUE;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name,
&ExEventPairObjectType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExEventPairObjectType);
}
NTSTATUS
Modified: trunk/reactos/ntoskrnl/ex/mutant.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ex/mutant.c?rev=22…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/mutant.c (original)
+++ trunk/reactos/ntoskrnl/ex/mutant.c Mon Jun 5 10:31:42 2006
@@ -68,7 +68,7 @@
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.DeleteProcedure = ExpDeleteMutant;
ObjectTypeInitializer.ValidAccessMask = MUTANT_ALL_ACCESS;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExMutantObjectType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExMutantObjectType);
}
/*
Modified: trunk/reactos/ntoskrnl/ex/profile.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ex/profile.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/profile.c (original)
+++ trunk/reactos/ntoskrnl/ex/profile.c Mon Jun 5 10:31:42 2006
@@ -82,7 +82,7 @@
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.DeleteProcedure = ExpDeleteProfile;
ObjectTypeInitializer.ValidAccessMask = PROFILE_ALL_ACCESS;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name,
&ExProfileObjectType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExProfileObjectType);
}
NTSTATUS
Modified: trunk/reactos/ntoskrnl/ex/sem.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ex/sem.c?rev=22232…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/sem.c (original)
+++ trunk/reactos/ntoskrnl/ex/sem.c Mon Jun 5 10:31:42 2006
@@ -55,7 +55,7 @@
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
ObjectTypeInitializer.ValidAccessMask = SEMAPHORE_ALL_ACCESS;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name,
&ExSemaphoreObjectType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExSemaphoreObjectType);
}
/*
Modified: trunk/reactos/ntoskrnl/ex/timer.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ex/timer.c?rev=222…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/timer.c (original)
+++ trunk/reactos/ntoskrnl/ex/timer.c Mon Jun 5 10:31:42 2006
@@ -249,7 +249,7 @@
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.ValidAccessMask = TIMER_ALL_ACCESS;
ObjectTypeInitializer.DeleteProcedure = ExpDeleteTimer;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExTimerType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ExTimerType);
/* Initialize the Wait List and Lock */
KeInitializeSpinLock(&ExpWakeListLock);
Modified: trunk/reactos/ntoskrnl/ex/win32k.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ex/win32k.c?rev=22…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/win32k.c (original)
+++ trunk/reactos/ntoskrnl/ex/win32k.c Mon Jun 5 10:31:42 2006
@@ -137,9 +137,10 @@
ObjectTypeInitializer.OpenProcedure = ExpWinStaObjectOpen;
ObjectTypeInitializer.DeleteProcedure = ExpWinStaObjectDelete;
ObjectTypeInitializer.ParseProcedure = ExpWinStaObjectParse;
- ObpCreateTypeObject(&ObjectTypeInitializer,
- &Name,
- &ExWindowStationObjectType);
+ ObCreateObjectType(&Name,
+ &ObjectTypeInitializer,
+ NULL,
+ &ExWindowStationObjectType);
/* Create desktop object type */
RtlInitUnicodeString(&Name, L"Desktop");
@@ -147,7 +148,10 @@
ObjectTypeInitializer.OpenProcedure = NULL;
ObjectTypeInitializer.DeleteProcedure = ExpDesktopDelete;
ObjectTypeInitializer.ParseProcedure = NULL;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name,
&ExDesktopObjectType);
+ ObCreateObjectType(&Name,
+ &ObjectTypeInitializer,
+ NULL,
+ &ExDesktopObjectType);
}
/* EOF */
Modified: trunk/reactos/ntoskrnl/include/internal/ob.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/include/internal/o…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ob.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ob.h Mon Jun 5 10:31:42 2006
@@ -114,14 +114,6 @@
IN PVOID Context
);
-NTSTATUS
-STDCALL
-ObpCreateTypeObject(
- struct _OBJECT_TYPE_INITIALIZER *ObjectTypeInitializer,
- PUNICODE_STRING TypeName,
- POBJECT_TYPE *ObjectType
-);
-
ULONG
NTAPI
ObGetObjectHandleCount(PVOID Object);
Modified: trunk/reactos/ntoskrnl/io/driver.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/io/driver.c?rev=22…
==============================================================================
--- trunk/reactos/ntoskrnl/io/driver.c (original)
+++ trunk/reactos/ntoskrnl/io/driver.c Mon Jun 5 10:31:42 2006
@@ -129,7 +129,7 @@
ObjectTypeInitializer.UseDefaultObject = TRUE;
ObjectTypeInitializer.DeleteProcedure = IopDeleteDriver;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &IoDriverObjectType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&IoDriverObjectType);
InitializeListHead(&DriverReinitListHead);
KeInitializeSpinLock(&DriverReinitListLock);
Modified: trunk/reactos/ntoskrnl/io/iocomp.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/io/iocomp.c?rev=22…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iocomp.c (original)
+++ trunk/reactos/ntoskrnl/io/iocomp.c Mon Jun 5 10:31:42 2006
@@ -216,7 +216,7 @@
ObjectTypeInitializer.UseDefaultObject = TRUE;
ObjectTypeInitializer.GenericMapping = IopCompletionMapping;
ObjectTypeInitializer.DeleteProcedure = IopDeleteIoCompletion;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &IoCompletionType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&IoCompletionType);
}
NTSTATUS
Modified: trunk/reactos/ntoskrnl/io/iomgr.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr.c?rev=222…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr.c Mon Jun 5 10:31:42 2006
@@ -210,16 +210,16 @@
ObjectTypeInitializer.ValidAccessMask = FILE_ALL_ACCESS;
ObjectTypeInitializer.UseDefaultObject = TRUE;
ObjectTypeInitializer.GenericMapping = IopFileMapping;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &IoDeviceObjectType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&IoDeviceObjectType);
/* Do the Adapter Type */
RtlInitUnicodeString(&Name, L"Adapter");
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name,
&IoAdapterObjectType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&IoAdapterObjectType);
/* Do the Controller Type */
RtlInitUnicodeString(&Name, L"Controller");
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(CONTROLLER_OBJECT);
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name,
&IoControllerObjectType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&IoControllerObjectType);
/* Initialize the File object type */
RtlInitUnicodeString(&Name, L"File");
@@ -230,7 +230,7 @@
ObjectTypeInitializer.SecurityProcedure = IopSecurityFile;
ObjectTypeInitializer.QueryNameProcedure = IopQueryNameFile;
ObjectTypeInitializer.UseDefaultObject = FALSE;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &IoFileObjectType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&IoFileObjectType);
/*
* Create the '\Driver' object directory
Modified: trunk/reactos/ntoskrnl/lpc/port.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/lpc/port.c?rev=222…
==============================================================================
--- trunk/reactos/ntoskrnl/lpc/port.c (original)
+++ trunk/reactos/ntoskrnl/lpc/port.c Mon Jun 5 10:31:42 2006
@@ -56,8 +56,8 @@
ObjectTypeInitializer.UseDefaultObject = TRUE;
ObjectTypeInitializer.CloseProcedure = LpcpClosePort;
ObjectTypeInitializer.DeleteProcedure = LpcpDeletePort;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &LpcPortObjectType);
-
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&LpcPortObjectType);
+
LpcpNextMessageId = 0;
ExInitializeFastMutex (& LpcpLock);
Modified: trunk/reactos/ntoskrnl/mm/section.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/section.c (original)
+++ trunk/reactos/ntoskrnl/mm/section.c Mon Jun 5 10:31:42 2006
@@ -2202,7 +2202,7 @@
ObjectTypeInitializer.GenericMapping = MmpSectionMapping;
ObjectTypeInitializer.DeleteProcedure = MmpDeleteSection;
ObjectTypeInitializer.CloseProcedure = MmpCloseSection;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &MmSectionObjectType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&MmSectionObjectType);
return(STATUS_SUCCESS);
}
Modified: trunk/reactos/ntoskrnl/ntoskrnl.def
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.def?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/ntoskrnl.def (original)
+++ trunk/reactos/ntoskrnl/ntoskrnl.def Mon Jun 5 10:31:42 2006
@@ -830,13 +830,20 @@
NtW32Call@20
NtWaitForSingleObject@12
NtWriteFile@36
+
+;
+; Object Manager
ObAssignSecurity@16
;ObCheckCreateObjectAccess@28
;ObCheckObjectAccess@20
+;ObCloseHandle@4
ObCreateObject@36
+ObCreateObjectType@16
+ObDereferenceObject@4
ObDereferenceSecurityDescriptor@8
+@ObfDereferenceObject@4
ObFindHandleForObject@20
-ObGetObjectPointerCount@4
+@ObfReferenceObject@4
ObGetObjectSecurity@12
ObInsertObject@24
ObLogSecurityDescriptor@12
@@ -845,14 +852,18 @@
ObOpenObjectByPointer@28
ObQueryNameString@16
ObQueryObjectAuditingByHandle@8
-@ObfDereferenceObject@4
-@ObfReferenceObject@4
ObReferenceObjectByHandle@24
ObReferenceObjectByName@32
ObReferenceObjectByPointer@16
+;ObReferenceSecurityDescriptor@8
ObReleaseObjectSecurity@8
-ObDereferenceObject@4
+;ObSetHandleAttributes@12
;ObSetSecurityDescriptorInfo@24
+;ObSetSecurityObjectByPointer@12
+
+;
+;
+;
;PfxFindPrefix
;PfxInitialize
;PfxInsertPrefix
Modified: trunk/reactos/ntoskrnl/ob/obhandle.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ob/obhandle.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obhandle.c (original)
+++ trunk/reactos/ntoskrnl/ob/obhandle.c Mon Jun 5 10:31:42 2006
@@ -592,64 +592,6 @@
return STATUS_UNSUCCESSFUL;
}
-
-/*
-* @implemented
-*/
-NTSTATUS STDCALL
-ObQueryObjectAuditingByHandle(IN HANDLE Handle,
- OUT PBOOLEAN GenerateOnClose)
-{
- PHANDLE_TABLE_ENTRY HandleEntry;
- PEPROCESS Process, CurrentProcess;
- KAPC_STATE ApcState;
- BOOLEAN AttachedToProcess = FALSE;
- NTSTATUS Status = STATUS_SUCCESS;
-
- PAGED_CODE();
-
- DPRINT("ObQueryObjectAuditingByHandle(Handle %p)\n", Handle);
-
- CurrentProcess = PsGetCurrentProcess();
-
- KeEnterCriticalRegion();
-
- if(ObIsKernelHandle(Handle, ExGetPreviousMode()))
- {
- Process = PsInitialSystemProcess;
- Handle = ObKernelHandleToHandle(Handle);
-
- if (Process != CurrentProcess)
- {
- KeStackAttachProcess(&Process->Pcb,
- &ApcState);
- AttachedToProcess = TRUE;
- }
- }
- else
- Process = CurrentProcess;
-
- HandleEntry = ExMapHandleToPointer(Process->ObjectTable,
- Handle);
- if(HandleEntry != NULL)
- {
- *GenerateOnClose = (HandleEntry->ObAttributes &
EX_HANDLE_ENTRY_AUDITONCLOSE) != 0;
-
- ExUnlockHandleTableEntry(Process->ObjectTable,
- HandleEntry);
- }
- else
- Status = STATUS_INVALID_HANDLE;
-
- if (AttachedToProcess)
- {
- KeUnstackDetachProcess(&ApcState);
- }
-
- KeLeaveCriticalRegion();
-
- return Status;
-}
/* PUBLIC FUNCTIONS *********************************************************/
ULONG
Modified: trunk/reactos/ntoskrnl/ob/obinit.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ob/obinit.c?rev=22…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obinit.c (original)
+++ trunk/reactos/ntoskrnl/ob/obinit.c Mon Jun 5 10:31:42 2006
@@ -158,7 +158,7 @@
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.GenericMapping = ObpTypeMapping;
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_TYPE);
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ObTypeObjectType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ObTypeObjectType);
/* Create the Directory Type */
DPRINT("Creating Directory Type\n");
@@ -170,7 +170,7 @@
ObjectTypeInitializer.MaintainTypeList = FALSE;
ObjectTypeInitializer.GenericMapping = ObpDirectoryMapping;
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_DIRECTORY);
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ObDirectoryType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ObDirectoryType);
/* Create security descriptor */
RtlCreateSecurityDescriptor(&SecurityDescriptor,
Modified: trunk/reactos/ntoskrnl/ob/oblife.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ob/oblife.c?rev=22…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/oblife.c (original)
+++ trunk/reactos/ntoskrnl/ob/oblife.c Mon Jun 5 10:31:42 2006
@@ -549,132 +549,6 @@
return STATUS_SUCCESS;
}
-NTSTATUS
-NTAPI
-ObpCreateTypeObject(IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer,
- IN PUNICODE_STRING TypeName,
- OUT POBJECT_TYPE *ObjectType)
-{
- POBJECT_HEADER Header;
- POBJECT_TYPE LocalObjectType;
- ULONG HeaderSize;
- NTSTATUS Status;
- CHAR Tag[4];
- OBP_LOOKUP_CONTEXT Context;
-
- /* Allocate the Object */
- Status = ObpAllocateObject(NULL,
- TypeName,
- ObTypeObjectType,
- sizeof(OBJECT_TYPE) + sizeof(OBJECT_HEADER),
- KernelMode,
- (POBJECT_HEADER*)&Header);
- if (!NT_SUCCESS(Status)) return Status;
- LocalObjectType = (POBJECT_TYPE)&Header->Body;
-
- /* Check if this is the first Object Type */
- if (!ObTypeObjectType)
- {
- ObTypeObjectType = LocalObjectType;
- Header->Type = ObTypeObjectType;
- LocalObjectType->TotalNumberOfObjects = 1;
- LocalObjectType->Key = TAG('O', 'b', 'j',
'T');
- }
- else
- {
- /* Set Tag */
- Tag[0] = TypeName->Buffer[0];
- Tag[1] = TypeName->Buffer[1];
- Tag[2] = TypeName->Buffer[2];
- Tag[3] = TypeName->Buffer[3];
- LocalObjectType->Key = *(PULONG)Tag;
- }
-
- /* Set it up */
- LocalObjectType->TypeInfo = *ObjectTypeInitializer;
- LocalObjectType->Name = *TypeName;
- LocalObjectType->TypeInfo.PoolType = ObjectTypeInitializer->PoolType;
-
- /* These two flags need to be manually set up */
- Header->Flags |= OB_FLAG_KERNEL_MODE | OB_FLAG_PERMANENT;
-
- /* Check if we have to maintain a type list */
- if (NtGlobalFlag & FLG_MAINTAIN_OBJECT_TYPELIST)
- {
- /* Enable support */
- LocalObjectType->TypeInfo.MaintainTypeList = TRUE;
- }
-
- /* Calculate how much space our header'll take up */
- HeaderSize = sizeof(OBJECT_HEADER) + sizeof(OBJECT_HEADER_NAME_INFO) +
- (ObjectTypeInitializer->MaintainHandleCount ?
- sizeof(OBJECT_HEADER_HANDLE_INFO) : 0);
-
- /* Check the pool type */
- if (ObjectTypeInitializer->PoolType == NonPagedPool)
- {
- /* Update the NonPaged Pool charge */
- LocalObjectType->TypeInfo.DefaultNonPagedPoolCharge += HeaderSize;
- }
- else
- {
- /* Update the Paged Pool charge */
- LocalObjectType->TypeInfo.DefaultPagedPoolCharge += HeaderSize;
- }
-
- /* All objects types need a security procedure */
- if (!ObjectTypeInitializer->SecurityProcedure)
- {
- LocalObjectType->TypeInfo.SecurityProcedure = SeDefaultObjectMethod;
- }
-
- /* Select the Wait Object */
- if (LocalObjectType->TypeInfo.UseDefaultObject)
- {
- /* Add the SYNCHRONIZE access mask since it's waitable */
- LocalObjectType->TypeInfo.ValidAccessMask |= SYNCHRONIZE;
-
- /* Use the "Default Object", a simple event */
- LocalObjectType->DefaultObject = &ObpDefaultObject;
- }
- /* The File Object gets an optimized hack so it can be waited on */
- else if ((TypeName->Length == 8) && !(wcscmp(TypeName->Buffer,
L"File")))
- {
- /* Wait on the File Object's event directly */
- LocalObjectType->DefaultObject = (PVOID)FIELD_OFFSET(FILE_OBJECT,
- Event);
- }
- /* FIXME: When LPC stops sucking, add a hack for Waitable Ports */
- else
- {
- /* No default Object */
- LocalObjectType->DefaultObject = NULL;
- }
-
- /* Initialize Object Type components */
- ExInitializeResourceLite(&LocalObjectType->Mutex);
- InitializeListHead(&LocalObjectType->TypeList);
-
- /* Check if we're actually creating the directory object itself */
- if (ObpTypeDirectoryObject)
- {
- /* Insert it into the Object Directory */
- Context.Directory = ObpTypeDirectoryObject;
- Context.DirectoryLocked = TRUE;
- ObpLookupEntryDirectory(ObpTypeDirectoryObject,
- TypeName,
- OBJ_CASE_INSENSITIVE,
- FALSE,
- &Context);
- ObpInsertEntryDirectory(ObpTypeDirectoryObject, &Context, Header);
- ObReferenceObject(ObpTypeDirectoryObject);
- }
-
- /* Return the object type and creations tatus */
- *ObjectType = LocalObjectType;
- return Status;
-}
-
/* PUBLIC FUNCTIONS **********************************************************/
NTSTATUS
@@ -761,6 +635,133 @@
return Status;
}
+NTSTATUS
+NTAPI
+ObCreateObjectType(IN PUNICODE_STRING TypeName,
+ IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer,
+ IN PVOID Reserved,
+ OUT POBJECT_TYPE *ObjectType)
+{
+ POBJECT_HEADER Header;
+ POBJECT_TYPE LocalObjectType;
+ ULONG HeaderSize;
+ NTSTATUS Status;
+ CHAR Tag[4];
+ OBP_LOOKUP_CONTEXT Context;
+
+ /* Allocate the Object */
+ Status = ObpAllocateObject(NULL,
+ TypeName,
+ ObTypeObjectType,
+ sizeof(OBJECT_TYPE) + sizeof(OBJECT_HEADER),
+ KernelMode,
+ (POBJECT_HEADER*)&Header);
+ if (!NT_SUCCESS(Status)) return Status;
+ LocalObjectType = (POBJECT_TYPE)&Header->Body;
+
+ /* Check if this is the first Object Type */
+ if (!ObTypeObjectType)
+ {
+ ObTypeObjectType = LocalObjectType;
+ Header->Type = ObTypeObjectType;
+ LocalObjectType->TotalNumberOfObjects = 1;
+ LocalObjectType->Key = TAG('O', 'b', 'j',
'T');
+ }
+ else
+ {
+ /* Set Tag */
+ Tag[0] = TypeName->Buffer[0];
+ Tag[1] = TypeName->Buffer[1];
+ Tag[2] = TypeName->Buffer[2];
+ Tag[3] = TypeName->Buffer[3];
+ LocalObjectType->Key = *(PULONG)Tag;
+ }
+
+ /* Set it up */
+ LocalObjectType->TypeInfo = *ObjectTypeInitializer;
+ LocalObjectType->Name = *TypeName;
+ LocalObjectType->TypeInfo.PoolType = ObjectTypeInitializer->PoolType;
+
+ /* These two flags need to be manually set up */
+ Header->Flags |= OB_FLAG_KERNEL_MODE | OB_FLAG_PERMANENT;
+
+ /* Check if we have to maintain a type list */
+ if (NtGlobalFlag & FLG_MAINTAIN_OBJECT_TYPELIST)
+ {
+ /* Enable support */
+ LocalObjectType->TypeInfo.MaintainTypeList = TRUE;
+ }
+
+ /* Calculate how much space our header'll take up */
+ HeaderSize = sizeof(OBJECT_HEADER) + sizeof(OBJECT_HEADER_NAME_INFO) +
+ (ObjectTypeInitializer->MaintainHandleCount ?
+ sizeof(OBJECT_HEADER_HANDLE_INFO) : 0);
+
+ /* Check the pool type */
+ if (ObjectTypeInitializer->PoolType == NonPagedPool)
+ {
+ /* Update the NonPaged Pool charge */
+ LocalObjectType->TypeInfo.DefaultNonPagedPoolCharge += HeaderSize;
+ }
+ else
+ {
+ /* Update the Paged Pool charge */
+ LocalObjectType->TypeInfo.DefaultPagedPoolCharge += HeaderSize;
+ }
+
+ /* All objects types need a security procedure */
+ if (!ObjectTypeInitializer->SecurityProcedure)
+ {
+ LocalObjectType->TypeInfo.SecurityProcedure = SeDefaultObjectMethod;
+ }
+
+ /* Select the Wait Object */
+ if (LocalObjectType->TypeInfo.UseDefaultObject)
+ {
+ /* Add the SYNCHRONIZE access mask since it's waitable */
+ LocalObjectType->TypeInfo.ValidAccessMask |= SYNCHRONIZE;
+
+ /* Use the "Default Object", a simple event */
+ LocalObjectType->DefaultObject = &ObpDefaultObject;
+ }
+ /* The File Object gets an optimized hack so it can be waited on */
+ else if ((TypeName->Length == 8) && !(wcscmp(TypeName->Buffer,
L"File")))
+ {
+ /* Wait on the File Object's event directly */
+ LocalObjectType->DefaultObject = (PVOID)FIELD_OFFSET(FILE_OBJECT,
+ Event);
+ }
+ /* FIXME: When LPC stops sucking, add a hack for Waitable Ports */
+ else
+ {
+ /* No default Object */
+ LocalObjectType->DefaultObject = NULL;
+ }
+
+ /* Initialize Object Type components */
+ ExInitializeResourceLite(&LocalObjectType->Mutex);
+ InitializeListHead(&LocalObjectType->TypeList);
+
+ /* Check if we're actually creating the directory object itself */
+ if (ObpTypeDirectoryObject)
+ {
+ /* Insert it into the Object Directory */
+ Context.Directory = ObpTypeDirectoryObject;
+ Context.DirectoryLocked = TRUE;
+ ObpLookupEntryDirectory(ObpTypeDirectoryObject,
+ TypeName,
+ OBJ_CASE_INSENSITIVE,
+ FALSE,
+ &Context);
+ ObpInsertEntryDirectory(ObpTypeDirectoryObject, &Context, Header);
+ ObReferenceObject(ObpTypeDirectoryObject);
+ }
+
+ /* Return the object type and creations tatus */
+ *ObjectType = LocalObjectType;
+ return Status;
+}
+
/*++
* @name NtQueryObject
* @implemented NT4
Modified: trunk/reactos/ntoskrnl/ob/obname.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ob/obname.c?rev=22…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obname.c (original)
+++ trunk/reactos/ntoskrnl/ob/obname.c Mon Jun 5 10:31:42 2006
@@ -329,7 +329,7 @@
/* PUBLIC FUNCTIONS *********************************************************/
-NTSTATUS
+NTSTATUS
STDCALL
ObQueryNameString(IN PVOID Object,
OUT POBJECT_NAME_INFORMATION ObjectNameInfo,
Modified: trunk/reactos/ntoskrnl/ob/obref.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ob/obref.c?rev=222…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obref.c (original)
+++ trunk/reactos/ntoskrnl/ob/obref.c Mon Jun 5 10:31:42 2006
@@ -68,17 +68,6 @@
}
/* PUBLIC FUNCTIONS *********************************************************/
-
-ULONG
-NTAPI
-ObGetObjectPointerCount(PVOID Object)
-{
- PAGED_CODE();
- ASSERT(Object);
-
- /* Get the header and return the pointer count */
- return OBJECT_TO_OBJECT_HEADER(Object)->PointerCount;
-}
VOID
FASTCALL
Modified: trunk/reactos/ntoskrnl/ob/security.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ob/security.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/security.c (original)
+++ trunk/reactos/ntoskrnl/ob/security.c Mon Jun 5 10:31:42 2006
@@ -463,4 +463,69 @@
DPRINT1("ObDereferenceSecurityDescriptor is not implemented!\n");
}
+/*++
+* @name ObQueryObjectAuditingByHandle
+* @implemented NT5
+*
+* The ObDereferenceSecurityDescriptor routine <FILLMEIN>
+*
+* @param SecurityDescriptor
+* <FILLMEIN>
+*
+* @param Count
+* <FILLMEIN>
+*
+* @return STATUS_SUCCESS or appropriate error value.
+*
+* @remarks None.
+*
+*--*/
+NTSTATUS
+NTAPI
+ObQueryObjectAuditingByHandle(IN HANDLE Handle,
+ OUT PBOOLEAN GenerateOnClose)
+{
+ PHANDLE_TABLE_ENTRY HandleEntry;
+ PVOID HandleTable;
+ NTSTATUS Status = STATUS_SUCCESS;
+ PAGED_CODE();
+
+ /* Check if we're dealing with a kernel handle */
+ if (ObIsKernelHandle(Handle, ExGetPreviousMode()))
+ {
+ /* Use the kernel table and convert the handle */
+ HandleTable = ObpKernelHandleTable;
+ Handle = ObKernelHandleToHandle(Handle);
+ }
+ else
+ {
+ /* Use the process's handle table */
+ HandleTable = PsGetCurrentProcess()->ObjectTable;
+ }
+
+ /* Enter a critical region while we touch the handle table */
+ KeEnterCriticalRegion();
+
+ /* Map the handle */
+ HandleEntry = ExMapHandleToPointer(HandleTable, Handle);
+ if(HandleEntry)
+ {
+ /* Check if the flag is set */
+ *GenerateOnClose = (HandleEntry->ObAttributes &
+ EX_HANDLE_ENTRY_AUDITONCLOSE) != 0;
+
+ /* Unlock the entry */
+ ExUnlockHandleTableEntry(HandleTable, HandleEntry);
+ }
+ else
+ {
+ /* Otherwise, fail */
+ Status = STATUS_INVALID_HANDLE;
+ }
+
+ /* Leave the critical region and return the status */
+ KeLeaveCriticalRegion();
+ return Status;
+}
+
/* EOF */
Modified: trunk/reactos/ntoskrnl/ob/symlink.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ob/symlink.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/symlink.c (original)
+++ trunk/reactos/ntoskrnl/ob/symlink.c Mon Jun 5 10:31:42 2006
@@ -194,7 +194,7 @@
ObjectTypeInitializer.UseDefaultObject = TRUE;
ObjectTypeInitializer.ParseProcedure = ObpParseSymbolicLink;
ObjectTypeInitializer.DeleteProcedure = ObpDeleteSymbolicLink;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ObSymbolicLinkType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ObSymbolicLinkType);
}
/* PUBLIC FUNCTIONS **********************************************************/
Modified: trunk/reactos/ntoskrnl/ps/job.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ps/job.c?rev=22232…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/job.c (original)
+++ trunk/reactos/ntoskrnl/ps/job.c Mon Jun 5 10:31:42 2006
@@ -81,7 +81,7 @@
ObjectTypeInitializer.ValidAccessMask = JOB_OBJECT_ALL_ACCESS;
ObjectTypeInitializer.UseDefaultObject = TRUE;
ObjectTypeInitializer.DeleteProcedure = PiDeleteJob;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &PsJobType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &PsJobType);
InitializeListHead(&PsJobListHead);
ExInitializeFastMutex(&PsJobListLock);
Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ps/psmgr.c?rev=222…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/psmgr.c (original)
+++ trunk/reactos/ntoskrnl/ps/psmgr.c Mon Jun 5 10:31:42 2006
@@ -122,7 +122,7 @@
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.ValidAccessMask = THREAD_ALL_ACCESS;
ObjectTypeInitializer.DeleteProcedure = PspDeleteThread;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &PsThreadType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &PsThreadType);
PsInitializeIdleOrFirstThread(PsInitialSystemProcess, &FirstThread, NULL,
KernelMode, TRUE);
FirstThread->Tcb.State = Running;
@@ -163,7 +163,7 @@
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.ValidAccessMask = PROCESS_ALL_ACCESS;
ObjectTypeInitializer.DeleteProcedure = PspDeleteProcess;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &PsProcessType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &PsProcessType);
InitializeListHead(&PsActiveProcessHead);
ExInitializeFastMutex(&PspActiveProcessMutex);
Modified: trunk/reactos/ntoskrnl/se/token.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/se/token.c?rev=222…
==============================================================================
--- trunk/reactos/ntoskrnl/se/token.c (original)
+++ trunk/reactos/ntoskrnl/se/token.c Mon Jun 5 10:31:42 2006
@@ -591,7 +591,7 @@
ObjectTypeInitializer.ValidAccessMask = TOKEN_ALL_ACCESS;
ObjectTypeInitializer.UseDefaultObject = TRUE;
ObjectTypeInitializer.DeleteProcedure = SepDeleteToken;
- ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &SepTokenObjectType);
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&SepTokenObjectType);
}