reactos/ntoskrnl/ob/obinit.c

438 lines
15 KiB
C
Raw Normal View History

/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL - See COPYING in the top level directory
* FILE: ntoskrnl/ob/obinit.c
* PURPOSE: Handles Object Manager Initialization and Shutdown
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
* Eric Kohl
* Thomas Weidenmueller (w3seek@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <ntoskrnl.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS *******************************************************************/
GENERIC_MAPPING ObpTypeMapping =
{
STANDARD_RIGHTS_READ,
STANDARD_RIGHTS_WRITE,
STANDARD_RIGHTS_EXECUTE,
0x000F0001
};
GENERIC_MAPPING ObpDirectoryMapping =
{
STANDARD_RIGHTS_READ | DIRECTORY_QUERY |
DIRECTORY_TRAVERSE,
STANDARD_RIGHTS_WRITE | DIRECTORY_CREATE_SUBDIRECTORY |
DIRECTORY_CREATE_OBJECT,
STANDARD_RIGHTS_EXECUTE | DIRECTORY_QUERY |
DIRECTORY_TRAVERSE,
DIRECTORY_ALL_ACCESS
};
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
GENERIC_MAPPING ObpSymbolicLinkMapping =
{
STANDARD_RIGHTS_READ | SYMBOLIC_LINK_QUERY,
STANDARD_RIGHTS_WRITE,
STANDARD_RIGHTS_EXECUTE | SYMBOLIC_LINK_QUERY,
SYMBOLIC_LINK_ALL_ACCESS
};
PDEVICE_MAP ObSystemDeviceMap = NULL;
ULONG ObpTraceLevel = 0;
CODE_SEG("INIT")
- Fix one of the oldest hacks in ReactOS: KeGetCurrentThread() and PsGetcurrentProcess used to be NULL during early boot stage. We also didn't have an official idle therad/process. Also system intialization was not in its sepearte thread. Changes: - Implemented SeAssignPrimaryToken. - Setup Boot/System Token for Idle Process in SeInit2. - Remove ROS hack in SeCaptureSubjectContextEx. - Call SeAssignPrimaryToken in PspInitializeProcessSecurty when called for the Initial Process creation. - Implement PsInitiailizeQuotaSystem and set PspDefauptQuotaBlock for the idle process so that it can be used for the initial process. - Rewrite Process Manager Phase 0 initialization from scratch, to create a new initial system process and thread which will be used for Phase 1 (in ROS, phase 2) initialization of the executive. - Fix a bug in PspCreateProcess which was using an uninitialized value of SectionObject in some cases, instead of NULL. - Call PsInitailizeQuotaSystem from ObInit, and also create the system handle table inside the idle process, and make it the ObpKernelHandleTable. - Do Executive Phase 0 Initialization at APC_LEVEL. - Start idle thread at HIGH_PRIORITY then lower it to 0 once the Initial Thread is setup, so that it can run, then keep priority to 0 at DISPATCH_LEVEL and jump into idle loop code. - Add NtYieldExecution to idle loop code since it's now being used. - Fix IoGetCurrentProcess which was previously hacked. - Remove some checks for Thread == NULL in ke_x.h, since this is now impossible. - Split Phase 0/1 initialization in ex\init.c, since one runs in a separate thread now. Also don't lower IRQL to PASSIVE_LEVEL anymore (run at APC_LEVEL). svn path=/trunk/; revision=24148
2006-09-16 20:37:49 +00:00
VOID
NTAPI
PsInitializeQuotaSystem(VOID);
ULONG ObpInitializationPhase;
ULONG ObpObjectSecurityMode = 0;
ULONG ObpProtectionMode = 0;
/* PRIVATE FUNCTIONS *********************************************************/
static
CODE_SEG("INIT")
NTSTATUS
NTAPI
ObpCreateKernelObjectsSD(OUT PSECURITY_DESCRIPTOR *SecurityDescriptor)
{
PSECURITY_DESCRIPTOR Sd = NULL;
PACL Dacl;
ULONG AclSize, SdSize;
NTSTATUS Status;
AclSize = sizeof(ACL) +
sizeof(ACE) + RtlLengthSid(SeWorldSid) +
sizeof(ACE) + RtlLengthSid(SeAliasAdminsSid) +
sizeof(ACE) + RtlLengthSid(SeLocalSystemSid);
SdSize = sizeof(SECURITY_DESCRIPTOR) + AclSize;
/* Allocate the SD and ACL */
Sd = ExAllocatePoolWithTag(PagedPool, SdSize, TAG_SD);
if (Sd == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
/* Initialize the SD */
Status = RtlCreateSecurityDescriptor(Sd,
SECURITY_DESCRIPTOR_REVISION);
if (!NT_SUCCESS(Status))
goto done;
Dacl = (PACL)((INT_PTR)Sd + sizeof(SECURITY_DESCRIPTOR));
/* Initialize the DACL */
RtlCreateAcl(Dacl, AclSize, ACL_REVISION);
/* Add the ACEs */
RtlAddAccessAllowedAce(Dacl,
ACL_REVISION,
GENERIC_READ,
SeWorldSid);
RtlAddAccessAllowedAce(Dacl,
ACL_REVISION,
GENERIC_ALL,
SeAliasAdminsSid);
RtlAddAccessAllowedAce(Dacl,
ACL_REVISION,
GENERIC_ALL,
SeLocalSystemSid);
/* Attach the DACL to the SD */
Status = RtlSetDaclSecurityDescriptor(Sd,
TRUE,
Dacl,
FALSE);
if (!NT_SUCCESS(Status))
goto done;
*SecurityDescriptor = Sd;
done:
if (!NT_SUCCESS(Status))
{
if (Sd != NULL)
ExFreePoolWithTag(Sd, TAG_SD);
}
return Status;
}
CODE_SEG("INIT")
BOOLEAN
NTAPI
ObInit2(VOID)
{
CCHAR i;
PKPRCB Prcb;
PGENERAL_LOOKASIDE CurrentList = NULL;
/* Now allocate the per-processor lists */
for (i = 0; i < KeNumberProcessors; i++)
{
/* Get the PRCB for this CPU */
Prcb = KiProcessorBlock[(int)i];
/* Set the OBJECT_CREATE_INFORMATION List */
Prcb->PPLookasideList[LookasideCreateInfoList].L = &ObpCreateInfoLookasideList;
CurrentList = ExAllocatePoolWithTag(NonPagedPool,
sizeof(GENERAL_LOOKASIDE),
'ICbO');
if (CurrentList)
{
/* Initialize it */
ExInitializeSystemLookasideList(CurrentList,
NonPagedPool,
sizeof(OBJECT_CREATE_INFORMATION),
'ICbO',
32,
&ExSystemLookasideListHead);
}
else
{
/* No list, use the static buffer */
CurrentList = &ObpCreateInfoLookasideList;
}
/* Link it */
Prcb->PPLookasideList[LookasideCreateInfoList].P = CurrentList;
/* Set the captured UNICODE_STRING Object Name List */
Prcb->PPLookasideList[LookasideNameBufferList].L = &ObpNameBufferLookasideList;
CurrentList = ExAllocatePoolWithTag(NonPagedPool,
sizeof(GENERAL_LOOKASIDE),
'MNbO');
if (CurrentList)
{
/* Initialize it */
ExInitializeSystemLookasideList(CurrentList,
PagedPool,
248,
'MNbO',
16,
&ExSystemLookasideListHead);
}
else
{
/* No list, use the static buffer */
CurrentList = &ObpNameBufferLookasideList;
}
/* Link it */
Prcb->PPLookasideList[LookasideNameBufferList].P = CurrentList;
}
return TRUE;
}
CODE_SEG("INIT")
BOOLEAN
NTAPI
ObInitSystem(VOID)
{
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING Name;
OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
OBP_LOOKUP_CONTEXT Context;
HANDLE Handle;
PKPRCB Prcb = KeGetCurrentPrcb();
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
PLIST_ENTRY ListHead, NextEntry;
POBJECT_HEADER Header;
POBJECT_HEADER_CREATOR_INFO CreatorInfo;
POBJECT_HEADER_NAME_INFO NameInfo;
PSECURITY_DESCRIPTOR KernelObjectsSD = NULL;
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
NTSTATUS Status;
/* Check if this is actually Phase 1 initialization */
if (ObpInitializationPhase != 0) goto ObPostPhase0;
/* Initialize the OBJECT_CREATE_INFORMATION List */
ExInitializeSystemLookasideList(&ObpCreateInfoLookasideList,
NonPagedPool,
sizeof(OBJECT_CREATE_INFORMATION),
'ICbO',
32,
&ExSystemLookasideListHead);
/* Set the captured UNICODE_STRING Object Name List */
ExInitializeSystemLookasideList(&ObpNameBufferLookasideList,
PagedPool,
248,
'MNbO',
16,
&ExSystemLookasideListHead);
/* Temporarily setup both pointers to the shared list */
Prcb->PPLookasideList[LookasideCreateInfoList].L = &ObpCreateInfoLookasideList;
Prcb->PPLookasideList[LookasideCreateInfoList].P = &ObpCreateInfoLookasideList;
Prcb->PPLookasideList[LookasideNameBufferList].L = &ObpNameBufferLookasideList;
Prcb->PPLookasideList[LookasideNameBufferList].P = &ObpNameBufferLookasideList;
/* Initialize the security descriptor cache */
ObpInitSdCache();
/* Initialize the Default Event */
KeInitializeEvent(&ObpDefaultObject, NotificationEvent, TRUE);
/* Initialize the Dos Device Map mutex */
KeInitializeGuardedMutex(&ObpDeviceMapLock);
/* Setup default access for the system process */
PsGetCurrentProcess()->GrantedAccess = PROCESS_ALL_ACCESS;
PsGetCurrentThread()->GrantedAccess = THREAD_ALL_ACCESS;
/* Setup the Object Reaper */
ExInitializeWorkItem(&ObpReaperWorkItem, ObpReapObject, NULL);
- Fix one of the oldest hacks in ReactOS: KeGetCurrentThread() and PsGetcurrentProcess used to be NULL during early boot stage. We also didn't have an official idle therad/process. Also system intialization was not in its sepearte thread. Changes: - Implemented SeAssignPrimaryToken. - Setup Boot/System Token for Idle Process in SeInit2. - Remove ROS hack in SeCaptureSubjectContextEx. - Call SeAssignPrimaryToken in PspInitializeProcessSecurty when called for the Initial Process creation. - Implement PsInitiailizeQuotaSystem and set PspDefauptQuotaBlock for the idle process so that it can be used for the initial process. - Rewrite Process Manager Phase 0 initialization from scratch, to create a new initial system process and thread which will be used for Phase 1 (in ROS, phase 2) initialization of the executive. - Fix a bug in PspCreateProcess which was using an uninitialized value of SectionObject in some cases, instead of NULL. - Call PsInitailizeQuotaSystem from ObInit, and also create the system handle table inside the idle process, and make it the ObpKernelHandleTable. - Do Executive Phase 0 Initialization at APC_LEVEL. - Start idle thread at HIGH_PRIORITY then lower it to 0 once the Initial Thread is setup, so that it can run, then keep priority to 0 at DISPATCH_LEVEL and jump into idle loop code. - Add NtYieldExecution to idle loop code since it's now being used. - Fix IoGetCurrentProcess which was previously hacked. - Remove some checks for Thread == NULL in ke_x.h, since this is now impossible. - Split Phase 0/1 initialization in ex\init.c, since one runs in a separate thread now. Also don't lower IRQL to PASSIVE_LEVEL anymore (run at APC_LEVEL). svn path=/trunk/; revision=24148
2006-09-16 20:37:49 +00:00
/* Initialize default Quota block */
PsInitializeQuotaSystem();
/* Create kernel handle table */
PsGetCurrentProcess()->ObjectTable = ExCreateHandleTable(NULL);
ObpKernelHandleTable = PsGetCurrentProcess()->ObjectTable;
/* Create the Type Type */
RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
RtlInitUnicodeString(&Name, L"Type");
ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
ObjectTypeInitializer.ValidAccessMask = OBJECT_TYPE_ALL_ACCESS;
ObjectTypeInitializer.UseDefaultObject = TRUE;
ObjectTypeInitializer.MaintainTypeList = TRUE;
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.GenericMapping = ObpTypeMapping;
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_TYPE);
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
ObjectTypeInitializer.DeleteProcedure = ObpDeleteObjectType;
ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObpTypeObjectType);
/* Create the Directory Type */
RtlInitUnicodeString(&Name, L"Directory");
ObjectTypeInitializer.PoolType = PagedPool;
ObjectTypeInitializer.ValidAccessMask = DIRECTORY_ALL_ACCESS;
ObjectTypeInitializer.CaseInsensitive = TRUE;
ObjectTypeInitializer.MaintainTypeList = FALSE;
ObjectTypeInitializer.GenericMapping = ObpDirectoryMapping;
ObjectTypeInitializer.DeleteProcedure = NULL;
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_DIRECTORY);
ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObpDirectoryObjectType);
ObpDirectoryObjectType->TypeInfo.ValidAccessMask &= ~SYNCHRONIZE;
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
/* Create 'symbolic link' object type */
RtlInitUnicodeString(&Name, L"SymbolicLink");
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_SYMBOLIC_LINK);
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
ObjectTypeInitializer.GenericMapping = ObpSymbolicLinkMapping;
ObjectTypeInitializer.ValidAccessMask = SYMBOLIC_LINK_ALL_ACCESS;
ObjectTypeInitializer.ParseProcedure = ObpParseSymbolicLink;
ObjectTypeInitializer.DeleteProcedure = ObpDeleteSymbolicLink;
ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObpSymbolicLinkObjectType);
ObpSymbolicLinkObjectType->TypeInfo.ValidAccessMask &= ~SYNCHRONIZE;
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
/* Phase 0 initialization complete */
ObpInitializationPhase++;
return TRUE;
ObPostPhase0:
/* Re-initialize lookaside lists */
ObInit2();
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
/* Initialize Object Types directory attributes */
RtlInitUnicodeString(&Name, L"\\");
InitializeObjectAttributes(&ObjectAttributes,
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
&Name,
OBJ_CASE_INSENSITIVE | OBJ_PERMANENT,
NULL,
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
SePublicDefaultUnrestrictedSd);
/* Create the directory */
Status = NtCreateDirectoryObject(&Handle,
DIRECTORY_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status)) return FALSE;
/* Get a handle to it */
Status = ObReferenceObjectByHandle(Handle,
0,
ObpDirectoryObjectType,
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
KernelMode,
(PVOID*)&ObpRootDirectoryObject,
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
NULL);
if (!NT_SUCCESS(Status)) return FALSE;
/* Close the extra handle */
Status = NtClose(Handle);
if (!NT_SUCCESS(Status)) return FALSE;
/* Create a custom security descriptor for the KernelObjects directory */
Status = ObpCreateKernelObjectsSD(&KernelObjectsSD);
if (!NT_SUCCESS(Status))
return FALSE;
/* Initialize the KernelObjects directory attributes */
RtlInitUnicodeString(&Name, L"\\KernelObjects");
InitializeObjectAttributes(&ObjectAttributes,
&Name,
OBJ_CASE_INSENSITIVE | OBJ_PERMANENT,
NULL,
KernelObjectsSD);
/* Create the directory */
Status = NtCreateDirectoryObject(&Handle,
DIRECTORY_ALL_ACCESS,
&ObjectAttributes);
ExFreePoolWithTag(KernelObjectsSD, TAG_SD);
if (!NT_SUCCESS(Status)) return FALSE;
/* Close the extra handle */
Status = NtClose(Handle);
if (!NT_SUCCESS(Status)) return FALSE;
/* Initialize ObjectTypes directory attributes */
RtlInitUnicodeString(&Name, L"\\ObjectTypes");
InitializeObjectAttributes(&ObjectAttributes,
&Name,
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
OBJ_CASE_INSENSITIVE | OBJ_PERMANENT,
NULL,
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
NULL);
/* Create the directory */
Status = NtCreateDirectoryObject(&Handle,
DIRECTORY_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status)) return FALSE;
/* Get a handle to it */
Status = ObReferenceObjectByHandle(Handle,
0,
ObpDirectoryObjectType,
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
KernelMode,
(PVOID*)&ObpTypeDirectoryObject,
NULL);
if (!NT_SUCCESS(Status)) return FALSE;
/* Close the extra handle */
Status = NtClose(Handle);
if (!NT_SUCCESS(Status)) return FALSE;
/* Initialize the lookup context and lock it */
ObpInitializeLookupContext(&Context);
ObpAcquireLookupContextLock(&Context, ObpTypeDirectoryObject);
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
/* Loop the object types */
ListHead = &ObpTypeObjectType->TypeList;
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
NextEntry = ListHead->Flink;
while (ListHead != NextEntry)
{
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
/* Get the creator info from the list */
CreatorInfo = CONTAINING_RECORD(NextEntry,
OBJECT_HEADER_CREATOR_INFO,
TypeList);
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
/* Recover the header and the name header from the creator info */
Header = (POBJECT_HEADER)(CreatorInfo + 1);
NameInfo = OBJECT_HEADER_TO_NAME_INFO(Header);
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
/* Make sure we have a name, and aren't inserted yet */
if ((NameInfo) && !(NameInfo->Directory))
{
/* Do the initial lookup to setup the context */
if (!ObpLookupEntryDirectory(ObpTypeDirectoryObject,
&NameInfo->Name,
OBJ_CASE_INSENSITIVE,
FALSE,
&Context))
{
/* Insert this object type */
ObpInsertEntryDirectory(ObpTypeDirectoryObject,
&Context,
Header);
}
}
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
/* Move to the next entry */
NextEntry = NextEntry->Flink;
}
/* Cleanup after lookup */
ObpReleaseLookupContext(&Context);
- Set OBJ_OPENLINK invalid for core object types. - Initialize symbolic link in-line with other core object types. - Use the SePublicDefaultUnrestrictedSd directly instead of building another SD. - Create core directory objects with Nt* functions instead of Ob*, to insure full accounting and error-handling. - Create core objects with OBJ_CASE_INSENSITIVE. - Fix the huge ObInit hack which was manually inserting Directory and Type object types in the type directory, and now loop the type list. Now we don't skip the Process, Token, Thread, Job, Section types anymore. - Support Quota Information during object allocation and deallocation isntead of ignoring it. - Use interlocked decrement when touching the object type (since it's a shared structure. We don't use the lock yet, but we won't for this anyways, since it's a simple lockable operation). - Use the right object key when freeing the object. - Modify the allocation function for a more optimized way of allocating objects instead of having to keep track of two sets of variables. - Add various accounting variables. - Make sure to properly handle allocations without object create info (ie, for object types). Now they get creator info and name info (which allowed us to cleanp the hack in ObInit). - Add checks to see if Quota informatio is needed. - Clear CreatorBackTraceIndex during allocation. - Remove CreatorUniqueProcess hack from back when the idle thread was NULL. - Do not zero out the header during allocation anymore, since this slows down the routine (instead, simply zero out the 2 fields that are NULL). - Locate and clearly display that the fact we zero objects on creation is a HACK that needs to be fixed. (The Token code makes this assumption). - Update HighWaterNumberOfObjects when needed. - If caller didn't give pool charges, use the one from the object type. - Clear the Total/HighWater* values for newly created object types instead of using random values. - Properly typecast the WCHAR tag as CHAR. - Insert each new object type in the ObTypeObjectType Type List. - Set the Index member of each new object type and insert each new object type in the ObpObjectTypes array. This is crucial for object type enumeration when implemented. - Fixup the way we insert new object types into the tree. Allow failure and don't return a type if we couldn't insert it, and only reference the type directory object if it actually exists. - Move DOS Devices\"??" initialization in its own routine and fix it: - Use Nt APIs for all operations instead of raw I/O. - Create GLOBALROOT link to \ - Create \??\Global link to \?? svn path=/trunk/; revision=24568
2006-10-19 02:20:32 +00:00
/* Initialize DOS Devices Directory and related Symbolic Links */
Status = ObpCreateDosDevicesDirectory();
if (!NT_SUCCESS(Status)) return FALSE;
return TRUE;
}
/* EOF */