2006-05-24 22:07:11 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Kernel
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
2008-08-16 17:53:28 +00:00
|
|
|
* FILE: ntoskrnl/ob/oblife.c
|
2006-05-24 22:07:11 +00:00
|
|
|
* PURPOSE: Manages the lifetime of an Object, including its creation,
|
|
|
|
* and deletion, as well as setting or querying any of its
|
|
|
|
* information while it is active. Since Object Types are also
|
|
|
|
* Objects, those are also managed here.
|
|
|
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
|
|
|
* Eric Kohl
|
|
|
|
* Thomas Weidenmueller (w3seek@reactos.org)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
|
|
|
#include <ntoskrnl.h>
|
|
|
|
#define NDEBUG
|
2008-08-30 16:31:06 +00:00
|
|
|
#include <debug.h>
|
2006-05-24 22:07:11 +00:00
|
|
|
|
|
|
|
extern ULONG NtGlobalFlag;
|
|
|
|
|
2007-02-19 18:52:23 +00:00
|
|
|
POBJECT_TYPE ObpTypeObjectType = NULL;
|
2006-05-24 22:07:11 +00:00
|
|
|
KEVENT ObpDefaultObject;
|
2011-04-25 16:08:00 +00:00
|
|
|
KGUARDED_MUTEX ObpDeviceMapLock;
|
2006-05-29 03:32:43 +00:00
|
|
|
|
2008-04-01 19:27:58 +00:00
|
|
|
GENERAL_LOOKASIDE ObpNameBufferLookasideList, ObpCreateInfoLookasideList;
|
2006-05-29 03:32:43 +00:00
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
WORK_QUEUE_ITEM ObpReaperWorkItem;
|
|
|
|
volatile PVOID ObpReaperList;
|
2006-05-24 22:07:11 +00:00
|
|
|
|
- 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
|
|
|
ULONG ObpObjectsCreated, ObpObjectsWithName, ObpObjectsWithPoolQuota;
|
|
|
|
ULONG ObpObjectsWithHandleDB, ObpObjectsWithCreatorInfo;
|
|
|
|
POBJECT_TYPE ObpObjectTypes[32];
|
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
/* PRIVATE FUNCTIONS *********************************************************/
|
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
ObpDeallocateObject(IN PVOID Object)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 00:05:07 +00:00
|
|
|
PVOID HeaderLocation;
|
|
|
|
POBJECT_HEADER Header;
|
|
|
|
POBJECT_TYPE ObjectType;
|
2006-05-24 22:07:11 +00:00
|
|
|
POBJECT_HEADER_HANDLE_INFO HandleInfo;
|
|
|
|
POBJECT_HEADER_NAME_INFO NameInfo;
|
|
|
|
POBJECT_HEADER_CREATOR_INFO CreatorInfo;
|
- 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
|
|
|
POBJECT_HEADER_QUOTA_INFO QuotaInfo;
|
|
|
|
ULONG PagedPoolCharge, NonPagedPoolCharge;
|
2006-05-29 00:05:07 +00:00
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
/* Get the header and assume this is what we'll free */
|
|
|
|
Header = OBJECT_TO_OBJECT_HEADER(Object);
|
|
|
|
ObjectType = Header->Type;
|
|
|
|
HeaderLocation = Header;
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* To find the header, walk backwards from how we allocated */
|
|
|
|
if ((CreatorInfo = OBJECT_HEADER_TO_CREATOR_INFO(Header)))
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 00:05:07 +00:00
|
|
|
HeaderLocation = CreatorInfo;
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
2006-05-29 00:05:07 +00:00
|
|
|
if ((NameInfo = OBJECT_HEADER_TO_NAME_INFO(Header)))
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 00:05:07 +00:00
|
|
|
HeaderLocation = NameInfo;
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
2006-05-29 00:05:07 +00:00
|
|
|
if ((HandleInfo = OBJECT_HEADER_TO_HANDLE_INFO(Header)))
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 00:05:07 +00:00
|
|
|
HeaderLocation = HandleInfo;
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
- 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
|
|
|
if ((QuotaInfo = OBJECT_HEADER_TO_QUOTA_INFO(Header)))
|
|
|
|
{
|
|
|
|
HeaderLocation = QuotaInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Decrease the total */
|
2006-10-20 13:19:13 +00:00
|
|
|
InterlockedDecrement((PLONG)&ObjectType->TotalNumberOfObjects);
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Check if we have create info */
|
|
|
|
if (Header->Flags & OB_FLAG_CREATE_INFO)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Double-check that it exists */
|
|
|
|
if (Header->ObjectCreateInfo)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Free it */
|
2008-06-18 12:28:29 +00:00
|
|
|
ObpFreeObjectCreateInformation(Header->ObjectCreateInfo);
|
2006-05-29 00:05:07 +00:00
|
|
|
Header->ObjectCreateInfo = NULL;
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
|
|
|
}
|
- 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
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Check if it has a quota block */
|
|
|
|
if (Header->QuotaBlockCharged)
|
|
|
|
{
|
|
|
|
/* Check if we have quota information */
|
|
|
|
if (QuotaInfo)
|
|
|
|
{
|
|
|
|
/* Get charges from quota information */
|
|
|
|
PagedPoolCharge = QuotaInfo->PagedPoolCharge +
|
|
|
|
QuotaInfo->SecurityDescriptorCharge;
|
|
|
|
NonPagedPoolCharge = QuotaInfo->NonPagedPoolCharge;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Get charges from object type */
|
|
|
|
PagedPoolCharge = ObjectType->TypeInfo.DefaultPagedPoolCharge;
|
|
|
|
NonPagedPoolCharge = ObjectType->
|
|
|
|
TypeInfo.DefaultNonPagedPoolCharge;
|
|
|
|
|
|
|
|
/* Add the SD charge too */
|
2006-10-19 03:09:19 +00:00
|
|
|
if (Header->Flags & OB_FLAG_SECURITY) PagedPoolCharge += 2048;
|
- 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
|
|
|
}
|
2011-04-25 16:08:00 +00:00
|
|
|
|
[NTOS]: Remove useless variables in kernel code that were set, but never actually used (dead code, tests, copy/pasters). If a variable was set but not used because of missing/#if'ed out code, a note was added instead.
[NTOS]: In the process, fix bugs in the Event dispatcher code that used Win32 EVENT_TYPE instead of NT KOBJECTS enumeration.
[NTOS]: Fix a bug in ObpInsertHandleCount, where the object access check was being done with the previous mode, instead of honoring the probe mode, which is defined by OBJ_FORCE_ACCESS_CHECK.
[NTOS]: Fix a bug in a section function which was always returning STATUS_SUCCESS, now it returns the result of the previous Status = function assignment. If this isn't desired, then don't check for the Status anymore.
[NTOS]: Note that MDL code does not support SkipBytes argument. If it is used, MDL could be invalid.
[NTOS]: Add checks for VerifierAllocation and set it when needed (WIP).
[NTOS]: Clarify what _WORKING_LINKER_ is, and the legal risks in continuing to use a linker that builds non-Microsoft drivers when used with headers whose EULA specify that they can only be used for Microsoft drivers.
svn path=/trunk/; revision=48692
2010-09-04 08:17:17 +00:00
|
|
|
/* Return the quota */
|
|
|
|
DPRINT("FIXME: Should return quotas: %lx %lx\n", PagedPoolCharge, NonPagedPoolCharge);
|
|
|
|
#if 0
|
|
|
|
PsReturnSharedPoolQuota(ObjectHeader->QuotaBlockCharged,
|
|
|
|
PagedPoolCharge,
|
|
|
|
NonPagedPoolCharge);
|
|
|
|
#endif
|
2011-04-25 16:08:00 +00:00
|
|
|
|
- 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
|
|
|
}
|
|
|
|
}
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Check if a handle database was active */
|
2006-06-29 19:03:24 +00:00
|
|
|
if ((HandleInfo) && !(Header->Flags & OB_FLAG_SINGLE_PROCESS))
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Free it */
|
|
|
|
ExFreePool(HandleInfo->HandleCountDatabase);
|
|
|
|
HandleInfo->HandleCountDatabase = NULL;
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
2006-05-29 00:05:07 +00:00
|
|
|
|
|
|
|
/* Check if we have a name */
|
|
|
|
if ((NameInfo) && (NameInfo->Name.Buffer))
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Free it */
|
|
|
|
ExFreePool(NameInfo->Name.Buffer);
|
|
|
|
NameInfo->Name.Buffer = NULL;
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
|
|
|
|
2007-01-08 07:51:07 +00:00
|
|
|
/* Catch invalid access */
|
2018-01-01 14:24:05 +00:00
|
|
|
Header->Type = (POBJECT_TYPE)(ULONG_PTR)0xBAADB0B0BAADB0B0ULL;
|
2007-01-08 07:51:07 +00:00
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Free the object using the same allocation tag */
|
- 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
|
|
|
ExFreePoolWithTag(HeaderLocation, ObjectType->Key);
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
VOID
|
- Fix critical bugs in exception handling: Unwinding was completely broken, using the wrong SEH protector to detect collided unwinding. The correct protector itself also had a broken check.
- Fix architectural bug in the entire TrapFrame<->Context conversion system and Ring Privilege Transitions (Inter-ring and intra-ring) which was lacking proper sanitation and validation of segments, flags and debug registers. Among other things, IOPL is now respected, CS is not KGDT_R0_CODE | RPL_MASK anymore, and the GPF code is now properly being called. This completely fixes exception handling being totally broken and crashing firefox installer, mirc, and other applications.
- Rewrite the page fault handler base code in assembly instead of relying on a broken C routine. Detect VDM, V8086, detecting expected/normal fault in ExpInterlockedPopEntrySList and faults in the system handler code. Rewrite MmAccessFault to be the main function that calls out to other sub-fault functions, and use the same prototype as NT.
- Fix the KGDT boot table to have proper granularity and big flags, and extend it to 256 entries.
- Create proper thread context in RtlInitializeContext and cleanup Rtl Thread routines.
- Remove all int3 and breakpoints from trap handlers, and replace them with a much better "UNHANDLED_PATH" macro which freezes the system, beeps, and displays a message with the line of code that's unhandled. This is to clearly tell the user that something is unhandled, instead of nesting infinite exceptions due to the int3.
- Fix a bug in INT_PROLOG.
- Sanitize EFLAGS and Code Segments in KeContextToTrapFrame and KeTrapFrameToContext.
- Implement KiUpdateDr7 and KiRecordDr7 as well as DR_MASK and other DR-validation macros and functions to protect against DR-vulnerabilites as well as to properly account for each active hardware breakpoint in a per-thread fashion by using the dispatcher header.
- Allow CR0_EM when running in a VDM.
- Fix FPU/NPX Register handling in KeContextToTrapFrame and KeTrapFrameToContext, and also speed it up by manual copying instead of a memory move.
- Properly give IOPL 3 to user-mode threads if they requested it.
- Detect GPF during GPF.
- Detect pagefault with a trap-frame spread over two or more pages and nested.
- Properly sanitize and set correct trap frame in KiInitailizeUserApc.
- Return STATUS_ACCESS_VIOLATION during page faults instead of STATUS_UNSUCESSFUL.
- Fix assert in VdmSwapContext, as well as Code Selector check which was broken.
- Fix delayed object deletion (ObDeferDeleteObject) and the Ob Repear Routine and list.
- Update Kernel Fun.
- BUGBUG: Temporaily hack VMWare to detection to always detect VMWare.
svn path=/trunk/; revision=25238
2006-12-29 18:49:00 +00:00
|
|
|
NTAPI
|
|
|
|
ObpDeleteObject(IN PVOID Object,
|
|
|
|
IN BOOLEAN CalledFromWorkerThread)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 00:05:07 +00:00
|
|
|
POBJECT_HEADER Header;
|
|
|
|
POBJECT_TYPE ObjectType;
|
|
|
|
POBJECT_HEADER_NAME_INFO NameInfo;
|
|
|
|
POBJECT_HEADER_CREATOR_INFO CreatorInfo;
|
2007-01-08 07:51:07 +00:00
|
|
|
KIRQL CalloutIrql;
|
2006-05-29 00:05:07 +00:00
|
|
|
PAGED_CODE();
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Get the header and type */
|
|
|
|
Header = OBJECT_TO_OBJECT_HEADER(Object);
|
|
|
|
ObjectType = Header->Type;
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Get creator and name information */
|
|
|
|
NameInfo = OBJECT_HEADER_TO_NAME_INFO(Header);
|
|
|
|
CreatorInfo = OBJECT_HEADER_TO_CREATOR_INFO(Header);
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Check if the object is on a type list */
|
|
|
|
if ((CreatorInfo) && !(IsListEmpty(&CreatorInfo->TypeList)))
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2007-01-08 07:51:07 +00:00
|
|
|
/* Lock the object type */
|
|
|
|
ObpEnterObjectTypeMutex(ObjectType);
|
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Remove the object from the type list */
|
|
|
|
RemoveEntryList(&CreatorInfo->TypeList);
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2007-01-08 07:51:07 +00:00
|
|
|
/* Release the lock */
|
|
|
|
ObpLeaveObjectTypeMutex(ObjectType);
|
|
|
|
}
|
2006-10-19 02:54:48 +00:00
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Check if we have a name */
|
|
|
|
if ((NameInfo) && (NameInfo->Name.Buffer))
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Free it */
|
|
|
|
ExFreePool(NameInfo->Name.Buffer);
|
2007-01-08 07:51:07 +00:00
|
|
|
RtlInitEmptyUnicodeString(&NameInfo->Name, NULL, 0);
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Check if we have a security descriptor */
|
|
|
|
if (Header->SecurityDescriptor)
|
|
|
|
{
|
- 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
|
|
|
/* Call the security procedure to delete it */
|
2007-01-08 07:51:07 +00:00
|
|
|
ObpCalloutStart(&CalloutIrql);
|
2006-05-29 00:05:07 +00:00
|
|
|
ObjectType->TypeInfo.SecurityProcedure(Object,
|
|
|
|
DeleteSecurityDescriptor,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&Header->SecurityDescriptor,
|
|
|
|
0,
|
|
|
|
NULL);
|
2007-01-08 07:51:07 +00:00
|
|
|
ObpCalloutEnd(CalloutIrql, "Security", ObjectType, Object);
|
2006-05-29 00:05:07 +00:00
|
|
|
}
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Check if we have a delete procedure */
|
|
|
|
if (ObjectType->TypeInfo.DeleteProcedure)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2007-01-15 20:54:40 +00:00
|
|
|
/* Save whether we were deleted from worker thread or not */
|
|
|
|
if (!CalledFromWorkerThread) Header->Flags |= OB_FLAG_DEFER_DELETE;
|
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Call it */
|
2007-01-08 07:51:07 +00:00
|
|
|
ObpCalloutStart(&CalloutIrql);
|
2006-05-29 00:05:07 +00:00
|
|
|
ObjectType->TypeInfo.DeleteProcedure(Object);
|
2007-01-08 07:51:07 +00:00
|
|
|
ObpCalloutEnd(CalloutIrql, "Delete", ObjectType, Object);
|
2006-05-29 00:05:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Now de-allocate all object members */
|
|
|
|
ObpDeallocateObject(Object);
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObpReapObject(IN PVOID Parameter)
|
|
|
|
{
|
2007-01-15 20:54:40 +00:00
|
|
|
POBJECT_HEADER ReapObject, NextObject;
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Start reaping */
|
- Fix critical bugs in exception handling: Unwinding was completely broken, using the wrong SEH protector to detect collided unwinding. The correct protector itself also had a broken check.
- Fix architectural bug in the entire TrapFrame<->Context conversion system and Ring Privilege Transitions (Inter-ring and intra-ring) which was lacking proper sanitation and validation of segments, flags and debug registers. Among other things, IOPL is now respected, CS is not KGDT_R0_CODE | RPL_MASK anymore, and the GPF code is now properly being called. This completely fixes exception handling being totally broken and crashing firefox installer, mirc, and other applications.
- Rewrite the page fault handler base code in assembly instead of relying on a broken C routine. Detect VDM, V8086, detecting expected/normal fault in ExpInterlockedPopEntrySList and faults in the system handler code. Rewrite MmAccessFault to be the main function that calls out to other sub-fault functions, and use the same prototype as NT.
- Fix the KGDT boot table to have proper granularity and big flags, and extend it to 256 entries.
- Create proper thread context in RtlInitializeContext and cleanup Rtl Thread routines.
- Remove all int3 and breakpoints from trap handlers, and replace them with a much better "UNHANDLED_PATH" macro which freezes the system, beeps, and displays a message with the line of code that's unhandled. This is to clearly tell the user that something is unhandled, instead of nesting infinite exceptions due to the int3.
- Fix a bug in INT_PROLOG.
- Sanitize EFLAGS and Code Segments in KeContextToTrapFrame and KeTrapFrameToContext.
- Implement KiUpdateDr7 and KiRecordDr7 as well as DR_MASK and other DR-validation macros and functions to protect against DR-vulnerabilites as well as to properly account for each active hardware breakpoint in a per-thread fashion by using the dispatcher header.
- Allow CR0_EM when running in a VDM.
- Fix FPU/NPX Register handling in KeContextToTrapFrame and KeTrapFrameToContext, and also speed it up by manual copying instead of a memory move.
- Properly give IOPL 3 to user-mode threads if they requested it.
- Detect GPF during GPF.
- Detect pagefault with a trap-frame spread over two or more pages and nested.
- Properly sanitize and set correct trap frame in KiInitailizeUserApc.
- Return STATUS_ACCESS_VIOLATION during page faults instead of STATUS_UNSUCESSFUL.
- Fix assert in VdmSwapContext, as well as Code Selector check which was broken.
- Fix delayed object deletion (ObDeferDeleteObject) and the Ob Repear Routine and list.
- Update Kernel Fun.
- BUGBUG: Temporaily hack VMWare to detection to always detect VMWare.
svn path=/trunk/; revision=25238
2006-12-29 18:49:00 +00:00
|
|
|
do
|
2006-05-29 00:05:07 +00:00
|
|
|
{
|
- Fix critical bugs in exception handling: Unwinding was completely broken, using the wrong SEH protector to detect collided unwinding. The correct protector itself also had a broken check.
- Fix architectural bug in the entire TrapFrame<->Context conversion system and Ring Privilege Transitions (Inter-ring and intra-ring) which was lacking proper sanitation and validation of segments, flags and debug registers. Among other things, IOPL is now respected, CS is not KGDT_R0_CODE | RPL_MASK anymore, and the GPF code is now properly being called. This completely fixes exception handling being totally broken and crashing firefox installer, mirc, and other applications.
- Rewrite the page fault handler base code in assembly instead of relying on a broken C routine. Detect VDM, V8086, detecting expected/normal fault in ExpInterlockedPopEntrySList and faults in the system handler code. Rewrite MmAccessFault to be the main function that calls out to other sub-fault functions, and use the same prototype as NT.
- Fix the KGDT boot table to have proper granularity and big flags, and extend it to 256 entries.
- Create proper thread context in RtlInitializeContext and cleanup Rtl Thread routines.
- Remove all int3 and breakpoints from trap handlers, and replace them with a much better "UNHANDLED_PATH" macro which freezes the system, beeps, and displays a message with the line of code that's unhandled. This is to clearly tell the user that something is unhandled, instead of nesting infinite exceptions due to the int3.
- Fix a bug in INT_PROLOG.
- Sanitize EFLAGS and Code Segments in KeContextToTrapFrame and KeTrapFrameToContext.
- Implement KiUpdateDr7 and KiRecordDr7 as well as DR_MASK and other DR-validation macros and functions to protect against DR-vulnerabilites as well as to properly account for each active hardware breakpoint in a per-thread fashion by using the dispatcher header.
- Allow CR0_EM when running in a VDM.
- Fix FPU/NPX Register handling in KeContextToTrapFrame and KeTrapFrameToContext, and also speed it up by manual copying instead of a memory move.
- Properly give IOPL 3 to user-mode threads if they requested it.
- Detect GPF during GPF.
- Detect pagefault with a trap-frame spread over two or more pages and nested.
- Properly sanitize and set correct trap frame in KiInitailizeUserApc.
- Return STATUS_ACCESS_VIOLATION during page faults instead of STATUS_UNSUCESSFUL.
- Fix assert in VdmSwapContext, as well as Code Selector check which was broken.
- Fix delayed object deletion (ObDeferDeleteObject) and the Ob Repear Routine and list.
- Update Kernel Fun.
- BUGBUG: Temporaily hack VMWare to detection to always detect VMWare.
svn path=/trunk/; revision=25238
2006-12-29 18:49:00 +00:00
|
|
|
/* Get the reap object */
|
2007-01-15 20:54:40 +00:00
|
|
|
ReapObject = InterlockedExchangePointer(&ObpReaperList, (PVOID)1);
|
- Fix critical bugs in exception handling: Unwinding was completely broken, using the wrong SEH protector to detect collided unwinding. The correct protector itself also had a broken check.
- Fix architectural bug in the entire TrapFrame<->Context conversion system and Ring Privilege Transitions (Inter-ring and intra-ring) which was lacking proper sanitation and validation of segments, flags and debug registers. Among other things, IOPL is now respected, CS is not KGDT_R0_CODE | RPL_MASK anymore, and the GPF code is now properly being called. This completely fixes exception handling being totally broken and crashing firefox installer, mirc, and other applications.
- Rewrite the page fault handler base code in assembly instead of relying on a broken C routine. Detect VDM, V8086, detecting expected/normal fault in ExpInterlockedPopEntrySList and faults in the system handler code. Rewrite MmAccessFault to be the main function that calls out to other sub-fault functions, and use the same prototype as NT.
- Fix the KGDT boot table to have proper granularity and big flags, and extend it to 256 entries.
- Create proper thread context in RtlInitializeContext and cleanup Rtl Thread routines.
- Remove all int3 and breakpoints from trap handlers, and replace them with a much better "UNHANDLED_PATH" macro which freezes the system, beeps, and displays a message with the line of code that's unhandled. This is to clearly tell the user that something is unhandled, instead of nesting infinite exceptions due to the int3.
- Fix a bug in INT_PROLOG.
- Sanitize EFLAGS and Code Segments in KeContextToTrapFrame and KeTrapFrameToContext.
- Implement KiUpdateDr7 and KiRecordDr7 as well as DR_MASK and other DR-validation macros and functions to protect against DR-vulnerabilites as well as to properly account for each active hardware breakpoint in a per-thread fashion by using the dispatcher header.
- Allow CR0_EM when running in a VDM.
- Fix FPU/NPX Register handling in KeContextToTrapFrame and KeTrapFrameToContext, and also speed it up by manual copying instead of a memory move.
- Properly give IOPL 3 to user-mode threads if they requested it.
- Detect GPF during GPF.
- Detect pagefault with a trap-frame spread over two or more pages and nested.
- Properly sanitize and set correct trap frame in KiInitailizeUserApc.
- Return STATUS_ACCESS_VIOLATION during page faults instead of STATUS_UNSUCESSFUL.
- Fix assert in VdmSwapContext, as well as Code Selector check which was broken.
- Fix delayed object deletion (ObDeferDeleteObject) and the Ob Repear Routine and list.
- Update Kernel Fun.
- BUGBUG: Temporaily hack VMWare to detection to always detect VMWare.
svn path=/trunk/; revision=25238
2006-12-29 18:49:00 +00:00
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Start deletion loop */
|
|
|
|
do
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Get the next object */
|
|
|
|
NextObject = ReapObject->NextToFree;
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Delete the object */
|
- Fix critical bugs in exception handling: Unwinding was completely broken, using the wrong SEH protector to detect collided unwinding. The correct protector itself also had a broken check.
- Fix architectural bug in the entire TrapFrame<->Context conversion system and Ring Privilege Transitions (Inter-ring and intra-ring) which was lacking proper sanitation and validation of segments, flags and debug registers. Among other things, IOPL is now respected, CS is not KGDT_R0_CODE | RPL_MASK anymore, and the GPF code is now properly being called. This completely fixes exception handling being totally broken and crashing firefox installer, mirc, and other applications.
- Rewrite the page fault handler base code in assembly instead of relying on a broken C routine. Detect VDM, V8086, detecting expected/normal fault in ExpInterlockedPopEntrySList and faults in the system handler code. Rewrite MmAccessFault to be the main function that calls out to other sub-fault functions, and use the same prototype as NT.
- Fix the KGDT boot table to have proper granularity and big flags, and extend it to 256 entries.
- Create proper thread context in RtlInitializeContext and cleanup Rtl Thread routines.
- Remove all int3 and breakpoints from trap handlers, and replace them with a much better "UNHANDLED_PATH" macro which freezes the system, beeps, and displays a message with the line of code that's unhandled. This is to clearly tell the user that something is unhandled, instead of nesting infinite exceptions due to the int3.
- Fix a bug in INT_PROLOG.
- Sanitize EFLAGS and Code Segments in KeContextToTrapFrame and KeTrapFrameToContext.
- Implement KiUpdateDr7 and KiRecordDr7 as well as DR_MASK and other DR-validation macros and functions to protect against DR-vulnerabilites as well as to properly account for each active hardware breakpoint in a per-thread fashion by using the dispatcher header.
- Allow CR0_EM when running in a VDM.
- Fix FPU/NPX Register handling in KeContextToTrapFrame and KeTrapFrameToContext, and also speed it up by manual copying instead of a memory move.
- Properly give IOPL 3 to user-mode threads if they requested it.
- Detect GPF during GPF.
- Detect pagefault with a trap-frame spread over two or more pages and nested.
- Properly sanitize and set correct trap frame in KiInitailizeUserApc.
- Return STATUS_ACCESS_VIOLATION during page faults instead of STATUS_UNSUCESSFUL.
- Fix assert in VdmSwapContext, as well as Code Selector check which was broken.
- Fix delayed object deletion (ObDeferDeleteObject) and the Ob Repear Routine and list.
- Update Kernel Fun.
- BUGBUG: Temporaily hack VMWare to detection to always detect VMWare.
svn path=/trunk/; revision=25238
2006-12-29 18:49:00 +00:00
|
|
|
ObpDeleteObject(&ReapObject->Body, TRUE);
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-05-29 00:05:07 +00:00
|
|
|
/* Move to the next one */
|
|
|
|
ReapObject = NextObject;
|
2007-01-15 20:54:40 +00:00
|
|
|
} while ((ReapObject) && (ReapObject != (PVOID)1));
|
- Fix critical bugs in exception handling: Unwinding was completely broken, using the wrong SEH protector to detect collided unwinding. The correct protector itself also had a broken check.
- Fix architectural bug in the entire TrapFrame<->Context conversion system and Ring Privilege Transitions (Inter-ring and intra-ring) which was lacking proper sanitation and validation of segments, flags and debug registers. Among other things, IOPL is now respected, CS is not KGDT_R0_CODE | RPL_MASK anymore, and the GPF code is now properly being called. This completely fixes exception handling being totally broken and crashing firefox installer, mirc, and other applications.
- Rewrite the page fault handler base code in assembly instead of relying on a broken C routine. Detect VDM, V8086, detecting expected/normal fault in ExpInterlockedPopEntrySList and faults in the system handler code. Rewrite MmAccessFault to be the main function that calls out to other sub-fault functions, and use the same prototype as NT.
- Fix the KGDT boot table to have proper granularity and big flags, and extend it to 256 entries.
- Create proper thread context in RtlInitializeContext and cleanup Rtl Thread routines.
- Remove all int3 and breakpoints from trap handlers, and replace them with a much better "UNHANDLED_PATH" macro which freezes the system, beeps, and displays a message with the line of code that's unhandled. This is to clearly tell the user that something is unhandled, instead of nesting infinite exceptions due to the int3.
- Fix a bug in INT_PROLOG.
- Sanitize EFLAGS and Code Segments in KeContextToTrapFrame and KeTrapFrameToContext.
- Implement KiUpdateDr7 and KiRecordDr7 as well as DR_MASK and other DR-validation macros and functions to protect against DR-vulnerabilites as well as to properly account for each active hardware breakpoint in a per-thread fashion by using the dispatcher header.
- Allow CR0_EM when running in a VDM.
- Fix FPU/NPX Register handling in KeContextToTrapFrame and KeTrapFrameToContext, and also speed it up by manual copying instead of a memory move.
- Properly give IOPL 3 to user-mode threads if they requested it.
- Detect GPF during GPF.
- Detect pagefault with a trap-frame spread over two or more pages and nested.
- Properly sanitize and set correct trap frame in KiInitailizeUserApc.
- Return STATUS_ACCESS_VIOLATION during page faults instead of STATUS_UNSUCESSFUL.
- Fix assert in VdmSwapContext, as well as Code Selector check which was broken.
- Fix delayed object deletion (ObDeferDeleteObject) and the Ob Repear Routine and list.
- Update Kernel Fun.
- BUGBUG: Temporaily hack VMWare to detection to always detect VMWare.
svn path=/trunk/; revision=25238
2006-12-29 18:49:00 +00:00
|
|
|
} while ((ObpReaperList != (PVOID)1) ||
|
|
|
|
(InterlockedCompareExchange((PLONG)&ObpReaperList, 0, 1) != 1));
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
|
|
|
|
2006-06-08 18:24:37 +00:00
|
|
|
/*++
|
|
|
|
* @name ObpSetPermanentObject
|
|
|
|
*
|
|
|
|
* The ObpSetPermanentObject routine makes an sets or clears the permanent
|
|
|
|
* flag of an object, thus making it either permanent or temporary.
|
|
|
|
*
|
|
|
|
* @param ObjectBody
|
|
|
|
* Pointer to the object to make permanent or temporary.
|
|
|
|
*
|
|
|
|
* @param Permanent
|
|
|
|
* Flag specifying which operation to perform.
|
|
|
|
*
|
|
|
|
* @return None.
|
|
|
|
*
|
|
|
|
* @remarks If the object is being made temporary, then it will be checked
|
|
|
|
* as a candidate for immediate removal from the namespace.
|
|
|
|
*
|
|
|
|
*--*/
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
ObpSetPermanentObject(IN PVOID ObjectBody,
|
|
|
|
IN BOOLEAN Permanent)
|
|
|
|
{
|
|
|
|
POBJECT_HEADER ObjectHeader;
|
|
|
|
|
|
|
|
/* Get the header */
|
|
|
|
ObjectHeader = OBJECT_TO_OBJECT_HEADER(ObjectBody);
|
2007-01-08 07:51:07 +00:00
|
|
|
|
2008-04-01 20:07:36 +00:00
|
|
|
/* Acquire object lock */
|
|
|
|
ObpAcquireObjectLock(ObjectHeader);
|
2007-01-08 07:51:07 +00:00
|
|
|
|
|
|
|
/* Check what we're doing to it */
|
2006-06-08 18:24:37 +00:00
|
|
|
if (Permanent)
|
|
|
|
{
|
|
|
|
/* Set it to permanent */
|
|
|
|
ObjectHeader->Flags |= OB_FLAG_PERMANENT;
|
2007-01-08 07:51:07 +00:00
|
|
|
|
|
|
|
/* Release the lock */
|
2008-04-01 20:07:36 +00:00
|
|
|
ObpReleaseObjectLock(ObjectHeader);
|
2006-06-08 18:24:37 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Remove the flag */
|
|
|
|
ObjectHeader->Flags &= ~OB_FLAG_PERMANENT;
|
|
|
|
|
2007-01-08 07:51:07 +00:00
|
|
|
/* Release the lock */
|
2008-04-01 20:07:36 +00:00
|
|
|
ObpReleaseObjectLock(ObjectHeader);
|
2007-01-08 07:51:07 +00:00
|
|
|
|
2006-06-08 18:24:37 +00:00
|
|
|
/* Check if we should delete the object now */
|
|
|
|
ObpDeleteNameCheck(ObjectBody);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-08 21:02:22 +00:00
|
|
|
PWCHAR
|
|
|
|
NTAPI
|
|
|
|
ObpAllocateObjectNameBuffer(IN ULONG Length,
|
|
|
|
IN BOOLEAN UseLookaside,
|
|
|
|
IN OUT PUNICODE_STRING ObjectName)
|
|
|
|
{
|
|
|
|
ULONG MaximumLength;
|
|
|
|
PVOID Buffer;
|
|
|
|
|
|
|
|
/* Set the maximum length to the length plus the terminator */
|
|
|
|
MaximumLength = Length + sizeof(UNICODE_NULL);
|
|
|
|
|
|
|
|
/* Check if we should use the lookaside buffer */
|
2008-07-25 13:42:05 +00:00
|
|
|
if (!(UseLookaside) || (MaximumLength > OBP_NAME_LOOKASIDE_MAX_SIZE))
|
2007-01-08 21:02:22 +00:00
|
|
|
{
|
|
|
|
/* Nope, allocate directly from pool */
|
2008-07-25 14:04:37 +00:00
|
|
|
/* Since we later use MaximumLength to detect that we're not allocating
|
|
|
|
* from a list, we need at least MaximumLength + sizeof(UNICODE_NULL)
|
|
|
|
* here.
|
|
|
|
*
|
|
|
|
* People do call this with UseLookasideList FALSE so the distinction
|
|
|
|
* is critical.
|
|
|
|
*/
|
|
|
|
if (MaximumLength <= OBP_NAME_LOOKASIDE_MAX_SIZE)
|
|
|
|
{
|
|
|
|
MaximumLength = OBP_NAME_LOOKASIDE_MAX_SIZE + sizeof(UNICODE_NULL);
|
|
|
|
}
|
2007-01-08 21:02:22 +00:00
|
|
|
Buffer = ExAllocatePoolWithTag(PagedPool,
|
|
|
|
MaximumLength,
|
|
|
|
OB_NAME_TAG);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Allocate from the lookaside */
|
2008-07-25 14:04:37 +00:00
|
|
|
MaximumLength = OBP_NAME_LOOKASIDE_MAX_SIZE;
|
2008-06-18 12:28:29 +00:00
|
|
|
Buffer = ObpAllocateObjectCreateInfoBuffer(LookasideNameBufferList);
|
2007-01-08 21:02:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup the string */
|
|
|
|
ObjectName->MaximumLength = (USHORT)MaximumLength;
|
2008-07-25 13:42:05 +00:00
|
|
|
ObjectName->Length = (USHORT)Length;
|
2007-01-08 21:02:22 +00:00
|
|
|
ObjectName->Buffer = Buffer;
|
|
|
|
return Buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObpFreeObjectNameBuffer(IN PUNICODE_STRING Name)
|
|
|
|
{
|
|
|
|
PVOID Buffer = Name->Buffer;
|
|
|
|
|
|
|
|
/* We know this is a pool-allocation if the size doesn't match */
|
2008-07-25 13:42:05 +00:00
|
|
|
if (Name->MaximumLength != OBP_NAME_LOOKASIDE_MAX_SIZE)
|
2007-01-08 21:02:22 +00:00
|
|
|
{
|
2017-06-19 16:29:44 +00:00
|
|
|
/*
|
|
|
|
* Free it from the pool.
|
|
|
|
*
|
|
|
|
* We cannot use here ExFreePoolWithTag(..., OB_NAME_TAG); , because
|
|
|
|
* the object name may have been massaged during operation by different
|
|
|
|
* object parse routines. If the latter ones have to resolve a symbolic
|
|
|
|
* link (e.g. as is done by CmpParseKey() and CmpGetSymbolicLink()),
|
|
|
|
* the original object name is freed and re-allocated from the pool,
|
|
|
|
* possibly with a different pool tag. At the end of the day, the new
|
|
|
|
* object name can be reallocated and completely different, but we
|
|
|
|
* should still be able to free it!
|
|
|
|
*/
|
|
|
|
ExFreePool(Buffer);
|
2007-01-08 21:02:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Otherwise, free from the lookaside */
|
|
|
|
ObpFreeCapturedAttributes(Buffer, LookasideNameBufferList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
NTSTATUS
|
2006-05-29 03:32:43 +00:00
|
|
|
NTAPI
|
2006-05-24 22:07:11 +00:00
|
|
|
ObpCaptureObjectName(IN OUT PUNICODE_STRING CapturedName,
|
|
|
|
IN PUNICODE_STRING ObjectName,
|
2006-05-29 03:32:43 +00:00
|
|
|
IN KPROCESSOR_MODE AccessMode,
|
2007-01-08 21:02:22 +00:00
|
|
|
IN BOOLEAN UseLookaside)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
2007-01-08 21:02:22 +00:00
|
|
|
ULONG StringLength;
|
2015-03-01 16:33:43 +00:00
|
|
|
PWCHAR _SEH2_VOLATILE StringBuffer = NULL;
|
2007-01-08 21:02:22 +00:00
|
|
|
UNICODE_STRING LocalName;
|
2006-05-29 03:32:43 +00:00
|
|
|
PAGED_CODE();
|
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
/* Initialize the Input String */
|
2006-05-29 03:32:43 +00:00
|
|
|
RtlInitEmptyUnicodeString(CapturedName, NULL, 0);
|
2006-05-24 22:07:11 +00:00
|
|
|
|
|
|
|
/* Protect everything */
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_TRY
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 03:32:43 +00:00
|
|
|
/* Check if we came from user mode */
|
2006-05-24 22:07:11 +00:00
|
|
|
if (AccessMode != KernelMode)
|
|
|
|
{
|
2006-05-29 03:32:43 +00:00
|
|
|
/* First Probe the String */
|
2009-01-04 01:50:37 +00:00
|
|
|
LocalName = ProbeForReadUnicodeString(ObjectName);
|
- 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
|
|
|
ProbeForRead(LocalName.Buffer, LocalName.Length, sizeof(WCHAR));
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* No probing needed */
|
|
|
|
LocalName = *ObjectName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure there really is a string */
|
2017-06-19 16:30:17 +00:00
|
|
|
StringLength = LocalName.Length;
|
|
|
|
if (StringLength)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
|
|
|
/* Check that the size is a valid WCHAR multiple */
|
|
|
|
if ((StringLength & (sizeof(WCHAR) - 1)) ||
|
|
|
|
/* Check that the NULL-termination below will work */
|
2006-05-29 03:32:43 +00:00
|
|
|
(StringLength == (MAXUSHORT - sizeof(UNICODE_NULL) + 1)))
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
|
|
|
/* PS: Please keep the checks above expanded for clarity */
|
|
|
|
Status = STATUS_OBJECT_NAME_INVALID;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-01-08 21:02:22 +00:00
|
|
|
/* Allocate the string buffer */
|
|
|
|
StringBuffer = ObpAllocateObjectNameBuffer(StringLength,
|
|
|
|
UseLookaside,
|
|
|
|
CapturedName);
|
|
|
|
if (!StringBuffer)
|
2006-05-29 03:32:43 +00:00
|
|
|
{
|
2007-01-08 21:02:22 +00:00
|
|
|
/* Set failure code */
|
|
|
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
2006-05-29 03:32:43 +00:00
|
|
|
}
|
2007-01-08 21:02:22 +00:00
|
|
|
else
|
2006-05-29 03:32:43 +00:00
|
|
|
{
|
2007-01-08 21:02:22 +00:00
|
|
|
/* Copy the name */
|
2007-02-14 17:51:48 +00:00
|
|
|
RtlCopyMemory(StringBuffer, LocalName.Buffer, StringLength);
|
2006-05-24 22:07:11 +00:00
|
|
|
StringBuffer[StringLength / sizeof(WCHAR)] = UNICODE_NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
- 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
|
|
|
/* Handle exception and free the string buffer */
|
2008-11-24 13:40:26 +00:00
|
|
|
Status = _SEH2_GetExceptionCode();
|
2008-07-25 14:04:37 +00:00
|
|
|
if (StringBuffer)
|
|
|
|
{
|
|
|
|
ObpFreeObjectNameBuffer(CapturedName);
|
|
|
|
}
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_END;
|
2006-05-29 03:32:43 +00:00
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
/* Return */
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
2006-05-29 03:32:43 +00:00
|
|
|
NTAPI
|
2008-06-18 12:28:29 +00:00
|
|
|
ObpCaptureObjectCreateInformation(IN POBJECT_ATTRIBUTES ObjectAttributes,
|
2012-01-30 07:48:49 +00:00
|
|
|
IN KPROCESSOR_MODE AccessMode,
|
|
|
|
IN KPROCESSOR_MODE CreatorMode,
|
|
|
|
IN BOOLEAN AllocateFromLookaside,
|
|
|
|
IN POBJECT_CREATE_INFORMATION ObjectCreateInfo,
|
|
|
|
OUT PUNICODE_STRING ObjectName)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2018-10-27 17:35:45 +00:00
|
|
|
ULONG SdCharge, QuotaInfoSize;
|
2006-05-24 22:07:11 +00:00
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
PSECURITY_DESCRIPTOR SecurityDescriptor;
|
|
|
|
PSECURITY_QUALITY_OF_SERVICE SecurityQos;
|
2009-01-07 10:13:43 +00:00
|
|
|
PUNICODE_STRING LocalObjectName = NULL;
|
2006-05-29 03:32:43 +00:00
|
|
|
PAGED_CODE();
|
2006-05-24 22:07:11 +00:00
|
|
|
|
|
|
|
/* Zero out the Capture Data */
|
|
|
|
RtlZeroMemory(ObjectCreateInfo, sizeof(OBJECT_CREATE_INFORMATION));
|
2006-05-29 03:32:43 +00:00
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
/* SEH everything here for protection */
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_TRY
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 03:32:43 +00:00
|
|
|
/* Check if we got attributes */
|
2006-05-24 22:07:11 +00:00
|
|
|
if (ObjectAttributes)
|
|
|
|
{
|
2006-05-29 03:32:43 +00:00
|
|
|
/* Check if we're in user mode */
|
2006-05-24 22:07:11 +00:00
|
|
|
if (AccessMode != KernelMode)
|
|
|
|
{
|
2006-05-29 03:32:43 +00:00
|
|
|
/* Probe the attributes */
|
2006-05-24 22:07:11 +00:00
|
|
|
ProbeForRead(ObjectAttributes,
|
|
|
|
sizeof(OBJECT_ATTRIBUTES),
|
|
|
|
sizeof(ULONG));
|
|
|
|
}
|
2006-05-29 03:32:43 +00:00
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
/* Validate the Size and Attributes */
|
|
|
|
if ((ObjectAttributes->Length != sizeof(OBJECT_ATTRIBUTES)) ||
|
2015-09-24 03:32:08 +00:00
|
|
|
(ObjectAttributes->Attributes & ~OBJ_VALID_KERNEL_ATTRIBUTES))
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 03:32:43 +00:00
|
|
|
/* Invalid combination, fail */
|
2009-08-26 17:31:02 +00:00
|
|
|
_SEH2_YIELD(return STATUS_INVALID_PARAMETER);
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
2006-05-29 03:32:43 +00:00
|
|
|
|
2012-01-30 07:48:49 +00:00
|
|
|
/* Set some Create Info and do not allow user-mode kernel handles */
|
2006-05-24 22:07:11 +00:00
|
|
|
ObjectCreateInfo->RootDirectory = ObjectAttributes->RootDirectory;
|
2015-09-24 03:32:08 +00:00
|
|
|
ObjectCreateInfo->Attributes = ObjectAttributes->Attributes & OBJ_VALID_KERNEL_ATTRIBUTES;
|
2012-01-30 07:48:49 +00:00
|
|
|
if (CreatorMode != KernelMode) ObjectCreateInfo->Attributes &= ~OBJ_KERNEL_HANDLE;
|
2006-05-24 22:07:11 +00:00
|
|
|
LocalObjectName = ObjectAttributes->ObjectName;
|
|
|
|
SecurityDescriptor = ObjectAttributes->SecurityDescriptor;
|
|
|
|
SecurityQos = ObjectAttributes->SecurityQualityOfService;
|
2006-05-29 03:32:43 +00:00
|
|
|
|
|
|
|
/* Check if we have a security descriptor */
|
2006-05-24 22:07:11 +00:00
|
|
|
if (SecurityDescriptor)
|
|
|
|
{
|
2015-03-01 16:33:43 +00:00
|
|
|
/* Capture it. Note: This has an implicit memory barrier due
|
|
|
|
to the function call, so cleanup is safe here.) */
|
2006-05-24 22:07:11 +00:00
|
|
|
Status = SeCaptureSecurityDescriptor(SecurityDescriptor,
|
|
|
|
AccessMode,
|
|
|
|
NonPagedPool,
|
|
|
|
TRUE,
|
2006-05-29 03:32:43 +00:00
|
|
|
&ObjectCreateInfo->
|
|
|
|
SecurityDescriptor);
|
2009-08-26 17:31:02 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 03:32:43 +00:00
|
|
|
/* Capture failed, quit */
|
2008-07-25 14:04:37 +00:00
|
|
|
ObjectCreateInfo->SecurityDescriptor = NULL;
|
2009-08-26 17:31:02 +00:00
|
|
|
_SEH2_YIELD(return Status);
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
2006-05-29 03:32:43 +00:00
|
|
|
|
2018-10-27 17:35:45 +00:00
|
|
|
/*
|
|
|
|
* By default, assume a SD size of 1024 and allow twice its
|
|
|
|
* size.
|
|
|
|
* If SD size happen to be bigger than that, then allow it
|
|
|
|
*/
|
|
|
|
SdCharge = 2048;
|
|
|
|
SeComputeQuotaInformationSize(ObjectCreateInfo->SecurityDescriptor,
|
|
|
|
&QuotaInfoSize);
|
|
|
|
if ((2 * QuotaInfoSize) > 2048)
|
|
|
|
{
|
|
|
|
SdCharge = 2 * QuotaInfoSize;
|
|
|
|
}
|
|
|
|
|
2006-05-29 03:32:43 +00:00
|
|
|
/* Save the probe mode and security descriptor size */
|
2018-10-27 17:35:45 +00:00
|
|
|
ObjectCreateInfo->SecurityDescriptorCharge = SdCharge;
|
2006-05-24 22:07:11 +00:00
|
|
|
ObjectCreateInfo->ProbeMode = AccessMode;
|
|
|
|
}
|
2006-05-29 03:32:43 +00:00
|
|
|
|
|
|
|
/* Check if we have QoS */
|
2006-05-24 22:07:11 +00:00
|
|
|
if (SecurityQos)
|
|
|
|
{
|
2006-05-29 03:32:43 +00:00
|
|
|
/* Check if we came from user mode */
|
2006-05-24 22:07:11 +00:00
|
|
|
if (AccessMode != KernelMode)
|
|
|
|
{
|
2006-05-29 03:32:43 +00:00
|
|
|
/* Validate the QoS */
|
2006-05-24 22:07:11 +00:00
|
|
|
ProbeForRead(SecurityQos,
|
|
|
|
sizeof(SECURITY_QUALITY_OF_SERVICE),
|
|
|
|
sizeof(ULONG));
|
|
|
|
}
|
2006-05-29 03:32:43 +00:00
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
/* Save Info */
|
|
|
|
ObjectCreateInfo->SecurityQualityOfService = *SecurityQos;
|
2006-05-29 03:32:43 +00:00
|
|
|
ObjectCreateInfo->SecurityQos =
|
|
|
|
&ObjectCreateInfo->SecurityQualityOfService;
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-29 03:32:43 +00:00
|
|
|
/* We don't have a name */
|
2006-05-24 22:07:11 +00:00
|
|
|
LocalObjectName = NULL;
|
|
|
|
}
|
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2009-08-26 17:31:02 +00:00
|
|
|
/* Cleanup and return the exception code */
|
|
|
|
ObpReleaseObjectCreateInformation(ObjectCreateInfo);
|
|
|
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_END;
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2009-08-26 17:31:02 +00:00
|
|
|
/* Now check if the Object Attributes had an Object Name */
|
|
|
|
if (LocalObjectName)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2009-08-26 17:31:02 +00:00
|
|
|
Status = ObpCaptureObjectName(ObjectName,
|
|
|
|
LocalObjectName,
|
|
|
|
AccessMode,
|
|
|
|
AllocateFromLookaside);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Clear the string */
|
|
|
|
RtlInitEmptyUnicodeString(ObjectName, NULL, 0);
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2017-06-19 14:48:59 +00:00
|
|
|
/* It cannot have specified a Root Directory */
|
2009-08-26 17:31:02 +00:00
|
|
|
if (ObjectCreateInfo->RootDirectory)
|
|
|
|
{
|
|
|
|
Status = STATUS_OBJECT_NAME_INVALID;
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-29 03:32:43 +00:00
|
|
|
/* Cleanup if we failed */
|
2008-07-25 13:42:05 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2009-08-26 17:31:02 +00:00
|
|
|
ObpReleaseObjectCreateInformation(ObjectCreateInfo);
|
2008-07-25 13:42:05 +00:00
|
|
|
}
|
2006-05-29 03:32:43 +00:00
|
|
|
|
|
|
|
/* Return status to caller */
|
|
|
|
return Status;
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
|
|
|
|
- Fix SleepEx.
- Put volatile statements in EX_RUNDOWN_REF, IRP, DEVICE_OBJECT, ERESOURCE, FILE_OBJECT, IO_REMOVE_LOCK, WORK_QUEUE_ITEM where required (thanks to Microsoft's changes in the WDK to mark the fields properly).
- Update FILE_OBJECT definition.
- Add some asserts to some I/O functions.
- Add stub support for File Objects created by XP+ Drivers which have File Object Extensions.
- Add some fixes to IopDeleteFile, including proper reference counting for the DO and VPB, as well as cleanup when the file is closed without a handle.
- Fix a bug in IopSecurityFile.
- Queue and unqueue IRPs in all I/O functions.
- Fully support IRP cancellation now.
- Fix critical bugs in NtDeviceIoControlFile and NtDeviceFsControlFile which were causing double queueing of IRPs and freeing of invalid memory, as well as invalid paramter checking for user-mode buffers.
- Add exhaustive validation checks to IoCreateFile, add more failure cases, and validate the EA buffer. Also support IO_ATTACH_DEVICE_API flag.
- Implement IoCreateStreamFileObjectEx and IoCreateStreamFileObjectLite and fix several bugs in the original implementation of IoCreateStreamFileObject.
- Fix a bug in RtlRaiseException.
- Update Io*ShareAccess routines to support XP+ style semantics related to special File Object flags which disable their use.
- Add validation to all Query/Set routines so that information clasess, lengths, buffers and alignment are properly checked.
- Also add an array for the proper acess rights that each query/set operation requires.
- Check backup/restore privileges during I/O File operations.
- Check traverse access during I/O File Operations.
- Check access privileges to the device during I/O file operations.
- Rename IopReferenceDeviceObject and also verify if an exclusive DO is trying to be invalidly opened.
- Support various extra security checks during I/O File/Device Parse Routine.
- Fix a bug during IopCleanupIrp so that we don't dereference the File OBject if this was a create operation.
- Fix some bogus asserts in IofCompleteRequest, and save the IRP Flags before signalling it's event, since the driver might've freed it behind our back.
- Fix a large bug in ObInsertObject which affected the insert of unnamed objects with forced security options (Such as process/threads).
- Fix the creation of the Process/Thread/Job Obejct Types to that security information is forced.
- Remove "Fix PS!!!" messages since the bug is now fixed and these objects now get proper security descriptors.
- Fix another bug in ObInsertObjet which wasn't properly validating user-mode objects and always assumed kernel mode.
- Silence multiple trace/checkpoint messages that have accumulated throughout time for various debugging purposes.
svn path=/trunk/; revision=25118
2006-12-10 18:40:30 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObFreeObjectCreateInfoBuffer(IN POBJECT_CREATE_INFORMATION ObjectCreateInfo)
|
|
|
|
{
|
|
|
|
/* Call the macro. We use this function to isolate Ob internals from Io */
|
|
|
|
ObpFreeCapturedAttributes(ObjectCreateInfo, LookasideCreateInfoList);
|
|
|
|
}
|
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
NTSTATUS
|
2006-05-29 00:18:36 +00:00
|
|
|
NTAPI
|
|
|
|
ObpAllocateObject(IN POBJECT_CREATE_INFORMATION ObjectCreateInfo,
|
|
|
|
IN PUNICODE_STRING ObjectName,
|
|
|
|
IN POBJECT_TYPE ObjectType,
|
|
|
|
IN ULONG ObjectSize,
|
|
|
|
IN KPROCESSOR_MODE PreviousMode,
|
|
|
|
IN POBJECT_HEADER *ObjectHeader)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
|
|
|
POBJECT_HEADER 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
|
|
|
ULONG QuotaSize, HandleSize, NameSize, CreatorSize;
|
2006-05-24 22:07:11 +00:00
|
|
|
POBJECT_HEADER_HANDLE_INFO HandleInfo;
|
|
|
|
POBJECT_HEADER_NAME_INFO NameInfo;
|
|
|
|
POBJECT_HEADER_CREATOR_INFO CreatorInfo;
|
- 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
|
|
|
POBJECT_HEADER_QUOTA_INFO QuotaInfo;
|
2006-05-24 22:07:11 +00:00
|
|
|
POOL_TYPE PoolType;
|
- 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
|
|
|
ULONG FinalSize;
|
2006-05-24 22:07:11 +00:00
|
|
|
ULONG Tag;
|
2006-05-29 00:18:36 +00:00
|
|
|
PAGED_CODE();
|
2006-06-05 00:16:14 +00:00
|
|
|
|
- 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
|
|
|
/* Accounting */
|
|
|
|
ObpObjectsCreated++;
|
|
|
|
|
|
|
|
/* Check if we don't have an Object Type yet */
|
|
|
|
if (!ObjectType)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
- 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
|
|
|
/* Use default tag and non-paged pool */
|
2006-05-24 22:07:11 +00:00
|
|
|
PoolType = NonPagedPool;
|
2009-08-24 18:19:53 +00:00
|
|
|
Tag = 'TjbO';
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
- 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
|
|
|
/* Use the pool and tag given */
|
2006-05-24 22:07:11 +00:00
|
|
|
PoolType = ObjectType->TypeInfo.PoolType;
|
|
|
|
Tag = ObjectType->Key;
|
|
|
|
}
|
2006-06-05 00:16:14 +00:00
|
|
|
|
- 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
|
|
|
/* Check if we have no create information (ie: we're an object type) */
|
|
|
|
if (!ObjectCreateInfo)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
- 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
|
|
|
/* Use defaults */
|
|
|
|
QuotaSize = HandleSize = 0;
|
|
|
|
NameSize = sizeof(OBJECT_HEADER_NAME_INFO);
|
|
|
|
CreatorSize = sizeof(OBJECT_HEADER_CREATOR_INFO);
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
- 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
|
|
|
else
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
- 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
|
|
|
/* Check if we have quota */
|
2007-02-14 17:51:48 +00:00
|
|
|
if ((((ObjectCreateInfo->PagedPoolCharge !=
|
|
|
|
ObjectType->TypeInfo.DefaultPagedPoolCharge) ||
|
|
|
|
(ObjectCreateInfo->NonPagedPoolCharge !=
|
|
|
|
ObjectType->TypeInfo.DefaultNonPagedPoolCharge) ||
|
|
|
|
(ObjectCreateInfo->SecurityDescriptorCharge > 2048)) &&
|
|
|
|
(PsGetCurrentProcess() != PsInitialSystemProcess)) ||
|
- 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
|
|
|
(ObjectCreateInfo->Attributes & OBJ_EXCLUSIVE))
|
|
|
|
{
|
|
|
|
/* Set quota size */
|
|
|
|
QuotaSize = sizeof(OBJECT_HEADER_QUOTA_INFO);
|
|
|
|
ObpObjectsWithPoolQuota++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* No Quota */
|
|
|
|
QuotaSize = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if we have a handle database */
|
2006-05-24 22:07:11 +00:00
|
|
|
if (ObjectType->TypeInfo.MaintainHandleCount)
|
|
|
|
{
|
- 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
|
|
|
/* Set handle database size */
|
|
|
|
HandleSize = sizeof(OBJECT_HEADER_HANDLE_INFO);
|
|
|
|
ObpObjectsWithHandleDB++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* None */
|
|
|
|
HandleSize = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if the Object has a name */
|
|
|
|
if (ObjectName->Buffer)
|
|
|
|
{
|
|
|
|
/* Set name size */
|
|
|
|
NameSize = sizeof(OBJECT_HEADER_NAME_INFO);
|
|
|
|
ObpObjectsWithName++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* No name */
|
|
|
|
NameSize = 0;
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
- 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
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
/* Check if the Object maintains type lists */
|
- 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
|
|
|
if (ObjectType->TypeInfo.MaintainTypeList)
|
|
|
|
{
|
|
|
|
/* Set owner/creator size */
|
|
|
|
CreatorSize = sizeof(OBJECT_HEADER_CREATOR_INFO);
|
|
|
|
ObpObjectsWithCreatorInfo++;
|
|
|
|
}
|
|
|
|
else
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
- 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
|
|
|
/* No info */
|
|
|
|
CreatorSize = 0;
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- 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
|
|
|
/* Set final header size */
|
|
|
|
FinalSize = QuotaSize +
|
|
|
|
HandleSize +
|
|
|
|
NameSize +
|
|
|
|
CreatorSize +
|
|
|
|
FIELD_OFFSET(OBJECT_HEADER, Body);
|
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
/* Allocate memory for the Object and 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
|
|
|
Header = ExAllocatePoolWithTag(PoolType, FinalSize + ObjectSize, Tag);
|
2006-05-29 00:18:36 +00:00
|
|
|
if (!Header) return STATUS_INSUFFICIENT_RESOURCES;
|
2006-06-05 00:16:14 +00:00
|
|
|
|
2007-01-08 07:51:07 +00:00
|
|
|
/* Check if we have a quota 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
|
|
|
if (QuotaSize)
|
|
|
|
{
|
2007-01-08 07:51:07 +00:00
|
|
|
/* Initialize quota info */
|
- 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
|
|
|
QuotaInfo = (POBJECT_HEADER_QUOTA_INFO)Header;
|
|
|
|
QuotaInfo->PagedPoolCharge = ObjectCreateInfo->PagedPoolCharge;
|
|
|
|
QuotaInfo->NonPagedPoolCharge = ObjectCreateInfo->NonPagedPoolCharge;
|
|
|
|
QuotaInfo->SecurityDescriptorCharge = ObjectCreateInfo->SecurityDescriptorCharge;
|
|
|
|
QuotaInfo->ExclusiveProcess = NULL;
|
|
|
|
Header = (POBJECT_HEADER)(QuotaInfo + 1);
|
|
|
|
}
|
|
|
|
|
2007-01-08 07:51:07 +00:00
|
|
|
/* Check if we have a handle database 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
|
|
|
if (HandleSize)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2007-01-08 07:51:07 +00:00
|
|
|
/* Initialize Handle Info */
|
2006-05-24 22:07:11 +00:00
|
|
|
HandleInfo = (POBJECT_HEADER_HANDLE_INFO)Header;
|
|
|
|
HandleInfo->SingleEntry.HandleCount = 0;
|
|
|
|
Header = (POBJECT_HEADER)(HandleInfo + 1);
|
|
|
|
}
|
2006-06-05 00:16:14 +00:00
|
|
|
|
2007-01-08 07:51:07 +00:00
|
|
|
/* Check if we have a name 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
|
|
|
if (NameSize)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2007-01-08 07:51:07 +00:00
|
|
|
/* Initialize the Object Name Info */
|
2006-05-24 22:07:11 +00:00
|
|
|
NameInfo = (POBJECT_HEADER_NAME_INFO)Header;
|
|
|
|
NameInfo->Name = *ObjectName;
|
|
|
|
NameInfo->Directory = NULL;
|
2007-01-08 07:51:07 +00:00
|
|
|
NameInfo->QueryReferences = 1;
|
|
|
|
|
|
|
|
/* Check if this is a call with the special protection flag */
|
|
|
|
if ((PreviousMode == KernelMode) &&
|
|
|
|
(ObjectCreateInfo) &&
|
2015-09-24 02:40:30 +00:00
|
|
|
(ObjectCreateInfo->Attributes & OBJ_KERNEL_EXCLUSIVE))
|
2007-01-08 07:51:07 +00:00
|
|
|
{
|
|
|
|
/* Set flag which will make the object protected from user-mode */
|
2015-09-24 02:40:30 +00:00
|
|
|
NameInfo->QueryReferences |= OB_FLAG_KERNEL_EXCLUSIVE;
|
2007-01-08 07:51:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the header pointer */
|
2006-05-24 22:07:11 +00:00
|
|
|
Header = (POBJECT_HEADER)(NameInfo + 1);
|
|
|
|
}
|
2006-06-05 00:16:14 +00:00
|
|
|
|
2007-01-08 07:51:07 +00:00
|
|
|
/* Check if we have a creator 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
|
|
|
if (CreatorSize)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2007-01-08 07:51:07 +00:00
|
|
|
/* Initialize Creator Info */
|
2006-05-24 22:07:11 +00:00
|
|
|
CreatorInfo = (POBJECT_HEADER_CREATOR_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
|
|
|
CreatorInfo->CreatorBackTraceIndex = 0;
|
|
|
|
CreatorInfo->CreatorUniqueProcess = PsGetCurrentProcessId();
|
2006-05-24 22:07:11 +00:00
|
|
|
InitializeListHead(&CreatorInfo->TypeList);
|
|
|
|
Header = (POBJECT_HEADER)(CreatorInfo + 1);
|
|
|
|
}
|
2006-06-05 00:16:14 +00:00
|
|
|
|
- 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
|
|
|
/* Check for quota information */
|
|
|
|
if (QuotaSize)
|
|
|
|
{
|
|
|
|
/* Set the offset */
|
|
|
|
Header->QuotaInfoOffset = (UCHAR)(QuotaSize +
|
|
|
|
HandleSize +
|
|
|
|
NameSize +
|
|
|
|
CreatorSize);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* No offset */
|
|
|
|
Header->QuotaInfoOffset = 0;
|
|
|
|
}
|
2006-06-05 00:16:14 +00:00
|
|
|
|
- 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
|
|
|
/* Check for handle information */
|
|
|
|
if (HandleSize)
|
|
|
|
{
|
|
|
|
/* Set the offset */
|
|
|
|
Header->HandleInfoOffset = (UCHAR)(HandleSize +
|
|
|
|
NameSize +
|
|
|
|
CreatorSize);
|
|
|
|
}
|
|
|
|
else
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
- 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
|
|
|
/* No offset */
|
|
|
|
Header->HandleInfoOffset = 0;
|
|
|
|
}
|
2006-05-29 00:18:36 +00:00
|
|
|
|
- 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
|
|
|
/* Check for name information */
|
|
|
|
if (NameSize)
|
|
|
|
{
|
|
|
|
/* Set the offset */
|
|
|
|
Header->NameInfoOffset = (UCHAR)(NameSize + CreatorSize);
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
- 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
|
|
|
else
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
- 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
|
|
|
/* No Name */
|
|
|
|
Header->NameInfoOffset = 0;
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
- 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
|
|
|
|
|
|
|
/* Set the new object flag */
|
|
|
|
Header->Flags = OB_FLAG_CREATE_INFO;
|
|
|
|
|
|
|
|
/* Remember if we have creator info */
|
|
|
|
if (CreatorSize) Header->Flags |= OB_FLAG_CREATOR_INFO;
|
|
|
|
|
|
|
|
/* Remember if we have handle info */
|
|
|
|
if (HandleSize) Header->Flags |= OB_FLAG_SINGLE_PROCESS;
|
|
|
|
|
|
|
|
/* Initialize the object header */
|
|
|
|
Header->PointerCount = 1;
|
|
|
|
Header->HandleCount = 0;
|
|
|
|
Header->Type = ObjectType;
|
|
|
|
Header->ObjectCreateInfo = ObjectCreateInfo;
|
|
|
|
Header->SecurityDescriptor = NULL;
|
|
|
|
|
|
|
|
/* Check if this is a permanent object */
|
2006-05-29 00:18:36 +00:00
|
|
|
if ((ObjectCreateInfo) && (ObjectCreateInfo->Attributes & OBJ_PERMANENT))
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 00:18:36 +00:00
|
|
|
/* Set the needed flag so we can check */
|
2006-05-24 22:07:11 +00:00
|
|
|
Header->Flags |= OB_FLAG_PERMANENT;
|
|
|
|
}
|
- 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
|
|
|
|
|
|
|
/* Check if this is an exclusive object */
|
2006-05-29 00:18:36 +00:00
|
|
|
if ((ObjectCreateInfo) && (ObjectCreateInfo->Attributes & OBJ_EXCLUSIVE))
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-05-29 00:18:36 +00:00
|
|
|
/* Set the needed flag so we can check */
|
2006-05-24 22:07:11 +00:00
|
|
|
Header->Flags |= OB_FLAG_EXCLUSIVE;
|
|
|
|
}
|
- 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
|
|
|
|
|
|
|
/* Set kernel-mode flag */
|
|
|
|
if (PreviousMode == KernelMode) Header->Flags |= OB_FLAG_KERNEL_MODE;
|
|
|
|
|
|
|
|
/* Check if we have a type */
|
|
|
|
if (ObjectType)
|
2006-05-29 00:18:36 +00:00
|
|
|
{
|
- 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
|
|
|
/* Increase the number of objects of this type */
|
2007-01-10 22:52:07 +00:00
|
|
|
InterlockedIncrement((PLONG)&ObjectType->TotalNumberOfObjects);
|
- 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
|
|
|
|
|
|
|
/* Update the high water */
|
|
|
|
ObjectType->HighWaterNumberOfObjects = max(ObjectType->
|
|
|
|
TotalNumberOfObjects,
|
|
|
|
ObjectType->
|
|
|
|
HighWaterNumberOfObjects);
|
2006-05-29 00:18:36 +00:00
|
|
|
}
|
2006-06-05 00:16:14 +00:00
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
/* Return Header */
|
|
|
|
*ObjectHeader = Header;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2007-01-25 01:50:40 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ObQueryTypeInfo(IN POBJECT_TYPE ObjectType,
|
|
|
|
OUT POBJECT_TYPE_INFORMATION ObjectTypeInfo,
|
|
|
|
IN ULONG Length,
|
|
|
|
OUT PULONG ReturnLength)
|
|
|
|
{
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
PWSTR InfoBuffer;
|
|
|
|
|
|
|
|
/* Enter SEH */
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_TRY
|
2007-01-25 01:50:40 +00:00
|
|
|
{
|
|
|
|
/* Set return length aligned to 4-byte boundary */
|
|
|
|
*ReturnLength += sizeof(*ObjectTypeInfo) +
|
|
|
|
ALIGN_UP(ObjectType->Name.MaximumLength, ULONG);
|
|
|
|
|
|
|
|
/* Check if thats too much though. */
|
2007-05-08 10:32:16 +00:00
|
|
|
if (Length < *ReturnLength)
|
|
|
|
{
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_YIELD(return STATUS_INFO_LENGTH_MISMATCH);
|
2007-05-08 10:32:16 +00:00
|
|
|
}
|
2007-01-25 01:50:40 +00:00
|
|
|
|
|
|
|
/* Build the data */
|
|
|
|
ObjectTypeInfo->TotalNumberOfHandles =
|
|
|
|
ObjectType->TotalNumberOfHandles;
|
|
|
|
ObjectTypeInfo->TotalNumberOfObjects =
|
|
|
|
ObjectType->TotalNumberOfObjects;
|
|
|
|
ObjectTypeInfo->HighWaterNumberOfHandles =
|
|
|
|
ObjectType->HighWaterNumberOfHandles;
|
|
|
|
ObjectTypeInfo->HighWaterNumberOfObjects =
|
|
|
|
ObjectType->HighWaterNumberOfObjects;
|
|
|
|
ObjectTypeInfo->PoolType =
|
|
|
|
ObjectType->TypeInfo.PoolType;
|
|
|
|
ObjectTypeInfo->DefaultNonPagedPoolCharge =
|
|
|
|
ObjectType->TypeInfo.DefaultNonPagedPoolCharge;
|
|
|
|
ObjectTypeInfo->DefaultPagedPoolCharge =
|
|
|
|
ObjectType->TypeInfo.DefaultPagedPoolCharge;
|
|
|
|
ObjectTypeInfo->ValidAccessMask =
|
|
|
|
ObjectType->TypeInfo.ValidAccessMask;
|
|
|
|
ObjectTypeInfo->SecurityRequired =
|
|
|
|
ObjectType->TypeInfo.SecurityRequired;
|
|
|
|
ObjectTypeInfo->InvalidAttributes =
|
|
|
|
ObjectType->TypeInfo.InvalidAttributes;
|
|
|
|
ObjectTypeInfo->GenericMapping =
|
|
|
|
ObjectType->TypeInfo.GenericMapping;
|
|
|
|
ObjectTypeInfo->MaintainHandleCount =
|
|
|
|
ObjectType->TypeInfo.MaintainHandleCount;
|
|
|
|
|
|
|
|
/* Setup the name buffer */
|
|
|
|
InfoBuffer = (PWSTR)(ObjectTypeInfo + 1);
|
|
|
|
ObjectTypeInfo->TypeName.Buffer = InfoBuffer;
|
|
|
|
ObjectTypeInfo->TypeName.MaximumLength = ObjectType->Name.MaximumLength;
|
|
|
|
ObjectTypeInfo->TypeName.Length = ObjectType->Name.Length;
|
|
|
|
|
|
|
|
/* Copy it */
|
|
|
|
RtlCopyMemory(InfoBuffer,
|
|
|
|
ObjectType->Name.Buffer,
|
|
|
|
ObjectType->Name.Length);
|
|
|
|
|
|
|
|
/* Null-terminate it */
|
|
|
|
(InfoBuffer)[ObjectType->Name.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
2007-01-25 01:50:40 +00:00
|
|
|
{
|
|
|
|
/* Otherwise, get the exception code */
|
2008-11-24 13:40:26 +00:00
|
|
|
Status = _SEH2_GetExceptionCode();
|
2007-01-25 01:50:40 +00:00
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_END;
|
2007-01-25 01:50:40 +00:00
|
|
|
|
|
|
|
/* Return status to caller */
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-05 06:31:42 +00:00
|
|
|
/* PUBLIC FUNCTIONS **********************************************************/
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
- 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
|
|
|
ObCreateObject(IN KPROCESSOR_MODE ProbeMode OPTIONAL,
|
2006-06-05 06:31:42 +00:00
|
|
|
IN POBJECT_TYPE Type,
|
|
|
|
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
|
|
|
|
IN KPROCESSOR_MODE AccessMode,
|
|
|
|
IN OUT PVOID ParseContext OPTIONAL,
|
|
|
|
IN ULONG ObjectSize,
|
|
|
|
IN ULONG PagedPoolCharge OPTIONAL,
|
|
|
|
IN ULONG NonPagedPoolCharge OPTIONAL,
|
|
|
|
OUT PVOID *Object)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
POBJECT_CREATE_INFORMATION ObjectCreateInfo;
|
|
|
|
UNICODE_STRING ObjectName;
|
|
|
|
POBJECT_HEADER Header;
|
|
|
|
|
|
|
|
/* Allocate a capture buffer */
|
2008-06-18 12:28:29 +00:00
|
|
|
ObjectCreateInfo = ObpAllocateObjectCreateInfoBuffer(LookasideCreateInfoList);
|
2006-06-05 06:31:42 +00:00
|
|
|
if (!ObjectCreateInfo) return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
|
|
|
|
/* Capture all the info */
|
2008-06-18 12:28:29 +00:00
|
|
|
Status = ObpCaptureObjectCreateInformation(ObjectAttributes,
|
|
|
|
ProbeMode,
|
2012-01-30 07:48:49 +00:00
|
|
|
AccessMode,
|
2008-06-18 12:28:29 +00:00
|
|
|
FALSE,
|
|
|
|
ObjectCreateInfo,
|
|
|
|
&ObjectName);
|
2006-06-05 06:31:42 +00:00
|
|
|
if (NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
/* Validate attributes */
|
- 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
|
|
|
if (Type->TypeInfo.InvalidAttributes & ObjectCreateInfo->Attributes)
|
2006-06-05 06:31:42 +00:00
|
|
|
{
|
|
|
|
/* Fail */
|
|
|
|
Status = STATUS_INVALID_PARAMETER;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
- 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
|
|
|
/* Check if we have a paged charge */
|
|
|
|
if (!PagedPoolCharge)
|
|
|
|
{
|
|
|
|
/* Save it */
|
2006-10-19 02:54:48 +00:00
|
|
|
PagedPoolCharge = Type->TypeInfo.DefaultPagedPoolCharge;
|
- 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
|
|
|
}
|
|
|
|
|
|
|
|
/* Check for nonpaged charge */
|
|
|
|
if (!NonPagedPoolCharge)
|
|
|
|
{
|
|
|
|
/* Save it */
|
2006-10-19 02:54:48 +00:00
|
|
|
NonPagedPoolCharge = Type->TypeInfo.DefaultNonPagedPoolCharge;
|
- 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
|
|
|
}
|
|
|
|
|
|
|
|
/* Write the pool charges */
|
2006-06-05 06:31:42 +00:00
|
|
|
ObjectCreateInfo->PagedPoolCharge = PagedPoolCharge;
|
|
|
|
ObjectCreateInfo->NonPagedPoolCharge = NonPagedPoolCharge;
|
|
|
|
|
|
|
|
/* Allocate the Object */
|
|
|
|
Status = ObpAllocateObject(ObjectCreateInfo,
|
|
|
|
&ObjectName,
|
|
|
|
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
|
|
|
ObjectSize,
|
2006-06-05 06:31:42 +00:00
|
|
|
AccessMode,
|
|
|
|
&Header);
|
|
|
|
if (NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
/* Return the Object */
|
|
|
|
*Object = &Header->Body;
|
|
|
|
|
|
|
|
/* Check if this is a permanent object */
|
|
|
|
if (Header->Flags & OB_FLAG_PERMANENT)
|
|
|
|
{
|
|
|
|
/* Do the privilege check */
|
|
|
|
if (!SeSinglePrivilegeCheck(SeCreatePermanentPrivilege,
|
- 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
|
|
|
ProbeMode))
|
2006-06-05 06:31:42 +00:00
|
|
|
{
|
|
|
|
/* Fail */
|
|
|
|
ObpDeallocateObject(*Object);
|
|
|
|
Status = STATUS_PRIVILEGE_NOT_HELD;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return status */
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Release the Capture Info, we don't need it */
|
2008-06-18 12:28:29 +00:00
|
|
|
ObpFreeObjectCreateInformation(ObjectCreateInfo);
|
2007-01-08 21:02:22 +00:00
|
|
|
if (ObjectName.Buffer) ObpFreeObjectNameBuffer(&ObjectName);
|
2006-06-05 06:31:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* We failed, so release the Buffer */
|
|
|
|
ObpFreeCapturedAttributes(ObjectCreateInfo, LookasideCreateInfoList);
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
2006-06-05 06:31:42 +00:00
|
|
|
ObCreateObjectType(IN PUNICODE_STRING TypeName,
|
|
|
|
IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer,
|
|
|
|
IN PVOID Reserved,
|
|
|
|
OUT POBJECT_TYPE *ObjectType)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
|
|
|
POBJECT_HEADER Header;
|
|
|
|
POBJECT_TYPE LocalObjectType;
|
|
|
|
ULONG HeaderSize;
|
|
|
|
NTSTATUS Status;
|
2006-05-29 00:18:36 +00:00
|
|
|
OBP_LOOKUP_CONTEXT Context;
|
2006-06-29 19:03:24 +00:00
|
|
|
PWCHAR p;
|
|
|
|
ULONG i;
|
|
|
|
UNICODE_STRING ObjectName;
|
2012-09-02 22:06:42 +00:00
|
|
|
ANSI_STRING AnsiName;
|
- 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
|
|
|
POBJECT_HEADER_CREATOR_INFO CreatorInfo;
|
2006-06-29 19:03:24 +00:00
|
|
|
|
|
|
|
/* Verify parameters */
|
|
|
|
if (!(TypeName) ||
|
|
|
|
!(TypeName->Length) ||
|
2007-02-14 17:51:48 +00:00
|
|
|
(TypeName->Length % sizeof(WCHAR)) ||
|
2006-06-29 19:03:24 +00:00
|
|
|
!(ObjectTypeInitializer) ||
|
|
|
|
(ObjectTypeInitializer->Length != sizeof(*ObjectTypeInitializer)) ||
|
2015-09-24 03:32:08 +00:00
|
|
|
(ObjectTypeInitializer->InvalidAttributes & ~OBJ_VALID_KERNEL_ATTRIBUTES) ||
|
2006-06-29 19:03:24 +00:00
|
|
|
(ObjectTypeInitializer->MaintainHandleCount &&
|
|
|
|
(!(ObjectTypeInitializer->OpenProcedure) &&
|
|
|
|
!ObjectTypeInitializer->CloseProcedure)) ||
|
|
|
|
((!ObjectTypeInitializer->UseDefaultObject) &&
|
|
|
|
(ObjectTypeInitializer->PoolType != NonPagedPool)))
|
|
|
|
{
|
|
|
|
/* Fail */
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure the name doesn't have a separator */
|
|
|
|
p = TypeName->Buffer;
|
|
|
|
i = TypeName->Length / sizeof(WCHAR);
|
|
|
|
while (i--)
|
|
|
|
{
|
|
|
|
/* Check for one and fail */
|
|
|
|
if (*p++ == OBJ_NAME_PATH_SEPARATOR) return STATUS_OBJECT_NAME_INVALID;
|
|
|
|
}
|
|
|
|
|
2007-01-09 21:48:26 +00:00
|
|
|
/* Setup a lookup context */
|
2008-06-18 12:28:29 +00:00
|
|
|
ObpInitializeLookupContext(&Context);
|
2007-01-08 07:51:07 +00:00
|
|
|
|
2006-06-29 19:03:24 +00:00
|
|
|
/* Check if we've already created the directory of types */
|
|
|
|
if (ObpTypeDirectoryObject)
|
|
|
|
{
|
2007-01-09 21:48:26 +00:00
|
|
|
/* Acquire the directory lock */
|
2007-01-10 01:00:46 +00:00
|
|
|
ObpAcquireDirectoryLockExclusive(ObpTypeDirectoryObject, &Context);
|
2007-01-09 21:48:26 +00:00
|
|
|
|
|
|
|
/* Do the lookup */
|
2006-06-29 19:03:24 +00:00
|
|
|
if (ObpLookupEntryDirectory(ObpTypeDirectoryObject,
|
|
|
|
TypeName,
|
|
|
|
OBJ_CASE_INSENSITIVE,
|
|
|
|
FALSE,
|
|
|
|
&Context))
|
|
|
|
{
|
|
|
|
/* We have already created it, so fail */
|
2008-06-18 12:28:29 +00:00
|
|
|
ObpReleaseLookupContext(&Context);
|
2006-06-29 19:03:24 +00:00
|
|
|
return STATUS_OBJECT_NAME_COLLISION;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now make a copy of the object name */
|
|
|
|
ObjectName.Buffer = ExAllocatePoolWithTag(PagedPool,
|
|
|
|
TypeName->MaximumLength,
|
|
|
|
OB_NAME_TAG);
|
|
|
|
if (!ObjectName.Buffer)
|
|
|
|
{
|
|
|
|
/* Out of memory, fail */
|
2008-06-18 12:28:29 +00:00
|
|
|
ObpReleaseLookupContext(&Context);
|
2006-06-29 19:03:24 +00:00
|
|
|
return STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the length and copy the name */
|
|
|
|
ObjectName.MaximumLength = TypeName->MaximumLength;
|
|
|
|
RtlCopyUnicodeString(&ObjectName, TypeName);
|
2006-05-24 22:07:11 +00:00
|
|
|
|
|
|
|
/* Allocate the Object */
|
2006-06-05 00:16:14 +00:00
|
|
|
Status = ObpAllocateObject(NULL,
|
2006-06-29 19:03:24 +00:00
|
|
|
&ObjectName,
|
2007-02-19 18:52:23 +00:00
|
|
|
ObpTypeObjectType,
|
- 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
|
|
|
sizeof(OBJECT_TYPE),
|
2006-05-29 00:18:36 +00:00
|
|
|
KernelMode,
|
2011-09-11 11:47:28 +00:00
|
|
|
&Header);
|
2006-06-29 19:24:10 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
/* Free the name and fail */
|
2008-06-18 12:28:29 +00:00
|
|
|
ObpReleaseLookupContext(&Context);
|
2006-06-29 19:24:10 +00:00
|
|
|
ExFreePool(ObjectName.Buffer);
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup the flags and name */
|
2006-05-24 22:07:11 +00:00
|
|
|
LocalObjectType = (POBJECT_TYPE)&Header->Body;
|
2006-06-29 19:24:10 +00:00
|
|
|
LocalObjectType->Name = ObjectName;
|
|
|
|
Header->Flags |= OB_FLAG_KERNEL_MODE | OB_FLAG_PERMANENT;
|
2006-06-05 00:16:14 +00:00
|
|
|
|
- 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
|
|
|
/* Clear accounting data */
|
|
|
|
LocalObjectType->TotalNumberOfObjects =
|
|
|
|
LocalObjectType->TotalNumberOfHandles =
|
|
|
|
LocalObjectType->HighWaterNumberOfObjects =
|
|
|
|
LocalObjectType->HighWaterNumberOfHandles = 0;
|
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
/* Check if this is the first Object Type */
|
2007-02-19 18:52:23 +00:00
|
|
|
if (!ObpTypeObjectType)
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
- 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
|
|
|
/* It is, so set this as the type object */
|
2007-02-19 18:52:23 +00:00
|
|
|
ObpTypeObjectType = LocalObjectType;
|
|
|
|
Header->Type = ObpTypeObjectType;
|
- 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
|
|
|
|
|
|
|
/* Set the hard-coded key and object count */
|
2006-05-29 00:18:36 +00:00
|
|
|
LocalObjectType->TotalNumberOfObjects = 1;
|
2009-08-24 18:19:53 +00:00
|
|
|
LocalObjectType->Key = 'TjbO';
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
|
|
|
else
|
2006-06-05 00:16:14 +00:00
|
|
|
{
|
2012-09-02 22:06:42 +00:00
|
|
|
/* Convert the tag to ASCII */
|
|
|
|
Status = RtlUnicodeStringToAnsiString(&AnsiName, TypeName, TRUE);
|
|
|
|
if (NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
/* For every missing character, use a space */
|
|
|
|
for (i = 3; i >= AnsiName.Length; i--) AnsiName.Buffer[i] = ' ';
|
|
|
|
|
|
|
|
/* Set the key and free the converted name */
|
|
|
|
LocalObjectType->Key = *(PULONG)AnsiName.Buffer;
|
2014-08-07 00:16:21 +00:00
|
|
|
RtlFreeAnsiString(&AnsiName);
|
2012-09-02 22:06:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Just copy the characters */
|
|
|
|
LocalObjectType->Key = *(PULONG)TypeName->Buffer;
|
|
|
|
}
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
2006-06-05 00:16:14 +00:00
|
|
|
|
2006-06-29 19:24:10 +00:00
|
|
|
/* Set up the type information */
|
2006-05-24 22:07:11 +00:00
|
|
|
LocalObjectType->TypeInfo = *ObjectTypeInitializer;
|
|
|
|
LocalObjectType->TypeInfo.PoolType = ObjectTypeInitializer->PoolType;
|
|
|
|
|
|
|
|
/* 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 */
|
- 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
|
|
|
HeaderSize = sizeof(OBJECT_HEADER) +
|
|
|
|
sizeof(OBJECT_HEADER_NAME_INFO) +
|
2007-10-19 23:21:45 +00:00
|
|
|
(ObjectTypeInitializer->MaintainHandleCount ?
|
- 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
|
|
|
sizeof(OBJECT_HEADER_HANDLE_INFO) : 0);
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-06-05 00:16:14 +00:00
|
|
|
/* Check the pool type */
|
2006-05-24 22:07:11 +00:00
|
|
|
if (ObjectTypeInitializer->PoolType == NonPagedPool)
|
|
|
|
{
|
2006-06-05 00:16:14 +00:00
|
|
|
/* Update the NonPaged Pool charge */
|
2006-05-24 22:07:11 +00:00
|
|
|
LocalObjectType->TypeInfo.DefaultNonPagedPoolCharge += HeaderSize;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-06-05 00:16:14 +00:00
|
|
|
/* Update the Paged Pool charge */
|
2006-05-24 22:07:11 +00:00
|
|
|
LocalObjectType->TypeInfo.DefaultPagedPoolCharge += HeaderSize;
|
|
|
|
}
|
2006-06-05 00:16:14 +00:00
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
/* 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;
|
|
|
|
}
|
2006-06-05 00:16:14 +00:00
|
|
|
/* The File Object gets an optimized hack so it can be waited on */
|
|
|
|
else if ((TypeName->Length == 8) && !(wcscmp(TypeName->Buffer, L"File")))
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-06-05 00:16:14 +00:00
|
|
|
/* Wait on the File Object's event directly */
|
2018-01-01 14:24:05 +00:00
|
|
|
LocalObjectType->DefaultObject = UlongToPtr(FIELD_OFFSET(FILE_OBJECT,
|
|
|
|
Event));
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
2007-02-14 17:51:48 +00:00
|
|
|
else if ((TypeName->Length == 24) && !(wcscmp(TypeName->Buffer, L"WaitablePort")))
|
|
|
|
{
|
|
|
|
/* Wait on the LPC Port's object directly */
|
2018-01-01 14:24:05 +00:00
|
|
|
LocalObjectType->DefaultObject = UlongToPtr(FIELD_OFFSET(LPCP_PORT_OBJECT,
|
|
|
|
WaitEvent));
|
2007-02-14 17:51:48 +00:00
|
|
|
}
|
2006-05-24 22:07:11 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* No default Object */
|
|
|
|
LocalObjectType->DefaultObject = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize Object Type components */
|
|
|
|
ExInitializeResourceLite(&LocalObjectType->Mutex);
|
2007-02-14 17:51:48 +00:00
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
/* Initialize the object locks */
|
|
|
|
ExInitializeResourceLite(&LocalObjectType->ObjectLocks[i]);
|
|
|
|
}
|
2006-05-24 22:07:11 +00:00
|
|
|
InitializeListHead(&LocalObjectType->TypeList);
|
|
|
|
|
2006-10-19 02:54:48 +00:00
|
|
|
/* Lock the object type */
|
2014-08-07 00:16:21 +00:00
|
|
|
ObpEnterObjectTypeMutex(ObpTypeObjectType);
|
2006-10-19 02:54:48 +00:00
|
|
|
|
- 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 creator info and insert it into the type list */
|
|
|
|
CreatorInfo = OBJECT_HEADER_TO_CREATOR_INFO(Header);
|
2014-08-07 13:02:59 +00:00
|
|
|
if (CreatorInfo)
|
|
|
|
{
|
|
|
|
InsertTailList(&ObpTypeObjectType->TypeList,
|
|
|
|
&CreatorInfo->TypeList);
|
|
|
|
|
|
|
|
/* CORE-8423: Avoid inserting this a second time if someone creates a
|
|
|
|
* handle to the object type (bug in Windows 2003) */
|
|
|
|
Header->Flags &= ~OB_FLAG_CREATE_INFO;
|
|
|
|
}
|
- 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
|
|
|
|
|
|
|
/* Set the index and the entry into the object type array */
|
2007-02-19 18:52:23 +00:00
|
|
|
LocalObjectType->Index = ObpTypeObjectType->TotalNumberOfObjects;
|
2013-10-11 19:37:29 +00:00
|
|
|
|
2015-09-01 01:45:59 +00:00
|
|
|
ASSERT(LocalObjectType->Index != 0);
|
2013-10-11 19:37:29 +00:00
|
|
|
|
2017-06-19 14:48:59 +00:00
|
|
|
if (LocalObjectType->Index < RTL_NUMBER_OF(ObpObjectTypes))
|
- 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
|
|
|
{
|
|
|
|
/* It fits, insert it */
|
|
|
|
ObpObjectTypes[LocalObjectType->Index - 1] = LocalObjectType;
|
|
|
|
}
|
|
|
|
|
2006-10-19 02:54:48 +00:00
|
|
|
/* Release the object type */
|
2014-08-07 00:16:21 +00:00
|
|
|
ObpLeaveObjectTypeMutex(ObpTypeObjectType);
|
2006-10-19 02:54:48 +00:00
|
|
|
|
2006-06-05 00:16:14 +00:00
|
|
|
/* Check if we're actually creating the directory object itself */
|
- 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
|
|
|
if (!(ObpTypeDirectoryObject) ||
|
|
|
|
(ObpInsertEntryDirectory(ObpTypeDirectoryObject, &Context, Header)))
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
- 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
|
|
|
/* Check if the type directory exists */
|
|
|
|
if (ObpTypeDirectoryObject)
|
|
|
|
{
|
|
|
|
/* Reference it */
|
|
|
|
ObReferenceObject(ObpTypeDirectoryObject);
|
|
|
|
}
|
|
|
|
|
2007-01-10 01:00:46 +00:00
|
|
|
/* Cleanup the lookup context */
|
2008-06-18 12:28:29 +00:00
|
|
|
ObpReleaseLookupContext(&Context);
|
2007-01-08 07:51:07 +00:00
|
|
|
|
- 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
|
|
|
/* Return the object type and success */
|
|
|
|
*ObjectType = LocalObjectType;
|
|
|
|
return STATUS_SUCCESS;
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
|
|
|
|
- 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
|
|
|
/* If we got here, then we failed */
|
2008-06-18 12:28:29 +00:00
|
|
|
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
|
|
|
return STATUS_INSUFFICIENT_RESOURCES;
|
2006-05-24 22:07:11 +00:00
|
|
|
}
|
|
|
|
|
2013-09-21 19:52:44 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObDeleteCapturedInsertInfo(IN PVOID Object)
|
|
|
|
{
|
2013-11-20 21:52:50 +00:00
|
|
|
POBJECT_HEADER ObjectHeader;
|
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
/* Check if there is anything to free */
|
|
|
|
ObjectHeader = OBJECT_TO_OBJECT_HEADER(Object);
|
|
|
|
if ((ObjectHeader->Flags & OB_FLAG_CREATE_INFO) &&
|
|
|
|
(ObjectHeader->ObjectCreateInfo != NULL))
|
|
|
|
{
|
|
|
|
/* Free the create info */
|
|
|
|
ObpFreeObjectCreateInformation(ObjectHeader->ObjectCreateInfo);
|
|
|
|
ObjectHeader->ObjectCreateInfo = NULL;
|
|
|
|
}
|
2013-09-21 19:52:44 +00:00
|
|
|
}
|
|
|
|
|
2008-04-01 19:27:58 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObpDeleteObjectType(IN PVOID Object)
|
|
|
|
{
|
|
|
|
ULONG i;
|
|
|
|
POBJECT_TYPE ObjectType = (PVOID)Object;
|
2011-04-25 16:08:00 +00:00
|
|
|
|
2008-04-01 19:27:58 +00:00
|
|
|
/* Loop our locks */
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
/* Delete each one */
|
|
|
|
ExDeleteResourceLite(&ObjectType->ObjectLocks[i]);
|
|
|
|
}
|
2011-04-25 16:08:00 +00:00
|
|
|
|
2008-04-01 19:27:58 +00:00
|
|
|
/* Delete our main mutex */
|
|
|
|
ExDeleteResourceLite(&ObjectType->Mutex);
|
|
|
|
}
|
|
|
|
|
2006-06-08 18:24:37 +00:00
|
|
|
/*++
|
|
|
|
* @name ObMakeTemporaryObject
|
|
|
|
* @implemented NT4
|
|
|
|
*
|
|
|
|
* The ObMakeTemporaryObject routine <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @param ObjectBody
|
|
|
|
* <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @return None.
|
|
|
|
*
|
|
|
|
* @remarks None.
|
|
|
|
*
|
|
|
|
*--*/
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ObMakeTemporaryObject(IN PVOID ObjectBody)
|
|
|
|
{
|
2007-01-08 07:51:07 +00:00
|
|
|
PAGED_CODE();
|
|
|
|
|
2006-06-08 18:24:37 +00:00
|
|
|
/* Call the internal API */
|
- 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
|
|
|
ObpSetPermanentObject(ObjectBody, FALSE);
|
2006-06-08 18:24:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*++
|
|
|
|
* @name NtMakeTemporaryObject
|
|
|
|
* @implemented NT4
|
|
|
|
*
|
|
|
|
* The NtMakeTemporaryObject routine <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @param ObjectHandle
|
|
|
|
* <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @return STATUS_SUCCESS or appropriate error value.
|
|
|
|
*
|
|
|
|
* @remarks None.
|
|
|
|
*
|
|
|
|
*--*/
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
NtMakeTemporaryObject(IN HANDLE ObjectHandle)
|
|
|
|
{
|
|
|
|
PVOID ObjectBody;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
/* Reference the object for DELETE access */
|
|
|
|
Status = ObReferenceObjectByHandle(ObjectHandle,
|
|
|
|
DELETE,
|
|
|
|
NULL,
|
|
|
|
KeGetPreviousMode(),
|
|
|
|
&ObjectBody,
|
|
|
|
NULL);
|
|
|
|
if (Status != STATUS_SUCCESS) return Status;
|
|
|
|
|
|
|
|
/* Set it as temporary and dereference it */
|
|
|
|
ObpSetPermanentObject(ObjectBody, FALSE);
|
|
|
|
ObDereferenceObject(ObjectBody);
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*++
|
|
|
|
* @name NtMakePermanentObject
|
|
|
|
* @implemented NT4
|
|
|
|
*
|
|
|
|
* The NtMakePermanentObject routine <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @param ObjectHandle
|
|
|
|
* <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @return STATUS_SUCCESS or appropriate error value.
|
|
|
|
*
|
|
|
|
* @remarks None.
|
|
|
|
*
|
|
|
|
*--*/
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
NtMakePermanentObject(IN HANDLE ObjectHandle)
|
|
|
|
{
|
|
|
|
PVOID ObjectBody;
|
|
|
|
NTSTATUS Status;
|
|
|
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
/* Make sure that the caller has SeCreatePermanentPrivilege */
|
|
|
|
Status = SeSinglePrivilegeCheck(SeCreatePermanentPrivilege,
|
|
|
|
PreviousMode);
|
|
|
|
if (!NT_SUCCESS(Status)) return STATUS_PRIVILEGE_NOT_HELD;
|
|
|
|
|
|
|
|
/* Reference the object */
|
|
|
|
Status = ObReferenceObjectByHandle(ObjectHandle,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
PreviousMode,
|
|
|
|
&ObjectBody,
|
|
|
|
NULL);
|
|
|
|
if (Status != STATUS_SUCCESS) return Status;
|
|
|
|
|
|
|
|
/* Set it as permanent and dereference it */
|
|
|
|
ObpSetPermanentObject(ObjectBody, TRUE);
|
|
|
|
ObDereferenceObject(ObjectBody);
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
/*++
|
|
|
|
* @name NtQueryObject
|
|
|
|
* @implemented NT4
|
|
|
|
*
|
|
|
|
* The NtQueryObject routine <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @param ObjectHandle
|
|
|
|
* <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @param ObjectInformationClass
|
|
|
|
* <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @param ObjectInformation
|
|
|
|
* <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @param Length
|
|
|
|
* <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @param ResultLength
|
|
|
|
* <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @return STATUS_SUCCESS or appropriate error value.
|
|
|
|
*
|
|
|
|
* @remarks None.
|
|
|
|
*
|
|
|
|
*--*/
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
NtQueryObject(IN HANDLE ObjectHandle,
|
|
|
|
IN OBJECT_INFORMATION_CLASS ObjectInformationClass,
|
|
|
|
OUT PVOID ObjectInformation,
|
|
|
|
IN ULONG Length,
|
|
|
|
OUT PULONG ResultLength OPTIONAL)
|
|
|
|
{
|
|
|
|
OBJECT_HANDLE_INFORMATION HandleInfo;
|
2006-06-05 00:04:36 +00:00
|
|
|
POBJECT_HEADER ObjectHeader = NULL;
|
|
|
|
POBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleFlags;
|
|
|
|
POBJECT_BASIC_INFORMATION BasicInfo;
|
[NTOSKRNL]
Coverity code defects fixes :
- Cache: CID 701441
- Config: CIDs 716570, 716669, 716760
- Dbgk: Kdbg: CIDs 716571, 515128/9, 500432
- Ex: CIDs 500156/7, 515122, 716200/67, 701301, 514669
- Fsrtl: Fstub: CIDs 701341/2, 701288, 716770, 701302, and CIDs 716576/7/8 + 514636 + 716805 thanks to Thomas Faber
- Io: CIDs 514576, 514643, 514672/3, 716203, 716269, 716581, 716591, 716713
- Ke: CIDs 515125, 716592
- Ps: CIDs 716603/4, 701422
- Ob: Po: CIDs 514671/680, 701419/420/421, 716763, 716601/2
All the details are given in the different bug reports.
CORE-6677 CORE-6679 CORE-6680 CORE-6683 CORE-6686 CORE-6692 CORE-6693 CORE-6694 CORE-6695 CORE-6696 #comment Committed in rev.57400 #resolve #close
svn path=/trunk/; revision=57400
2012-09-27 17:16:31 +00:00
|
|
|
ULONG InfoLength = 0;
|
2009-01-07 10:13:43 +00:00
|
|
|
PVOID Object = NULL;
|
2009-08-26 17:31:02 +00:00
|
|
|
NTSTATUS Status;
|
2018-11-10 09:02:34 +00:00
|
|
|
POBJECT_HEADER_QUOTA_INFO ObjectQuota;
|
2018-11-10 09:31:03 +00:00
|
|
|
SECURITY_INFORMATION SecurityInformation;
|
|
|
|
POBJECT_TYPE ObjectType;
|
2006-06-29 05:05:27 +00:00
|
|
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
2006-05-24 22:07:11 +00:00
|
|
|
PAGED_CODE();
|
|
|
|
|
2006-06-29 05:05:27 +00:00
|
|
|
/* Check if the caller is from user mode */
|
|
|
|
if (PreviousMode != KernelMode)
|
|
|
|
{
|
|
|
|
/* Protect validation with SEH */
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_TRY
|
2006-06-29 05:05:27 +00:00
|
|
|
{
|
|
|
|
/* Probe the input structure */
|
|
|
|
ProbeForWrite(ObjectInformation, Length, sizeof(UCHAR));
|
|
|
|
|
|
|
|
/* If we have a result length, probe it too */
|
|
|
|
if (ResultLength) ProbeForWriteUlong(ResultLength);
|
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
2006-06-29 05:05:27 +00:00
|
|
|
{
|
2009-08-26 17:31:02 +00:00
|
|
|
/* Return the exception code */
|
|
|
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
2006-06-29 05:05:27 +00:00
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_END;
|
2006-06-29 05:05:27 +00:00
|
|
|
}
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-06-05 00:04:36 +00:00
|
|
|
/*
|
|
|
|
* Make sure this isn't a generic type query, since the caller doesn't
|
|
|
|
* have to give a handle for it
|
|
|
|
*/
|
2007-08-04 08:26:58 +00:00
|
|
|
if (ObjectInformationClass != ObjectTypesInformation)
|
2006-06-05 00:04:36 +00:00
|
|
|
{
|
|
|
|
/* Reference the object */
|
|
|
|
Status = ObReferenceObjectByHandle(ObjectHandle,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
KeGetPreviousMode(),
|
|
|
|
&Object,
|
|
|
|
&HandleInfo);
|
|
|
|
if (!NT_SUCCESS (Status)) return Status;
|
|
|
|
|
|
|
|
/* Get the object header */
|
|
|
|
ObjectHeader = OBJECT_TO_OBJECT_HEADER(Object);
|
2018-11-10 09:31:03 +00:00
|
|
|
ObjectType = ObjectHeader->Type;
|
2006-06-05 00:04:36 +00:00
|
|
|
}
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_TRY
|
2006-05-24 22:07:11 +00:00
|
|
|
{
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Check the information class */
|
|
|
|
switch (ObjectInformationClass)
|
|
|
|
{
|
|
|
|
/* Basic info */
|
|
|
|
case ObjectBasicInformation:
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Validate length */
|
|
|
|
InfoLength = sizeof(OBJECT_BASIC_INFORMATION);
|
|
|
|
if (Length != sizeof(OBJECT_BASIC_INFORMATION))
|
|
|
|
{
|
|
|
|
/* Fail */
|
|
|
|
Status = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
break;
|
|
|
|
}
|
2006-06-05 00:04:36 +00:00
|
|
|
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Fill out the basic information */
|
|
|
|
BasicInfo = (POBJECT_BASIC_INFORMATION)ObjectInformation;
|
|
|
|
BasicInfo->Attributes = HandleInfo.HandleAttributes;
|
|
|
|
BasicInfo->GrantedAccess = HandleInfo.GrantedAccess;
|
|
|
|
BasicInfo->HandleCount = ObjectHeader->HandleCount;
|
|
|
|
BasicInfo->PointerCount = ObjectHeader->PointerCount;
|
2006-06-05 00:04:36 +00:00
|
|
|
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Permanent/Exclusive Flags are NOT in Handle attributes! */
|
|
|
|
if (ObjectHeader->Flags & OB_FLAG_EXCLUSIVE)
|
|
|
|
{
|
|
|
|
/* Set the flag */
|
|
|
|
BasicInfo->Attributes |= OBJ_EXCLUSIVE;
|
|
|
|
}
|
|
|
|
if (ObjectHeader->Flags & OB_FLAG_PERMANENT)
|
|
|
|
{
|
|
|
|
/* Set the flag */
|
|
|
|
BasicInfo->Attributes |= OBJ_PERMANENT;
|
|
|
|
}
|
2006-06-05 00:04:36 +00:00
|
|
|
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Copy quota information */
|
2018-11-10 09:02:34 +00:00
|
|
|
ObjectQuota = OBJECT_HEADER_TO_QUOTA_INFO(ObjectHeader);
|
|
|
|
if (ObjectQuota != NULL)
|
|
|
|
{
|
|
|
|
BasicInfo->PagedPoolCharge = ObjectQuota->PagedPoolCharge;
|
|
|
|
BasicInfo->NonPagedPoolCharge = ObjectQuota->NonPagedPoolCharge;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
BasicInfo->PagedPoolCharge = 0;
|
|
|
|
BasicInfo->NonPagedPoolCharge = 0;
|
|
|
|
}
|
2006-06-05 00:04:36 +00:00
|
|
|
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Copy name information */
|
2007-08-04 08:26:58 +00:00
|
|
|
BasicInfo->NameInfoSize = 0; /* FIXME*/
|
|
|
|
BasicInfo->TypeInfoSize = 0; /* FIXME*/
|
2006-06-05 00:04:36 +00:00
|
|
|
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Check if this is a symlink */
|
2018-02-13 20:33:04 +00:00
|
|
|
if (ObjectHeader->Type == ObpSymbolicLinkObjectType)
|
2006-10-22 09:06:58 +00:00
|
|
|
{
|
|
|
|
/* Return the creation time */
|
2007-08-04 08:26:58 +00:00
|
|
|
BasicInfo->CreationTime.QuadPart =
|
2006-10-22 09:06:58 +00:00
|
|
|
((POBJECT_SYMBOLIC_LINK)Object)->CreationTime.QuadPart;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Otherwise return 0 */
|
2007-08-04 08:26:58 +00:00
|
|
|
BasicInfo->CreationTime.QuadPart = (ULONGLONG)0;
|
2006-10-22 09:06:58 +00:00
|
|
|
}
|
2006-06-05 00:04:36 +00:00
|
|
|
|
2018-11-10 09:31:03 +00:00
|
|
|
/* Copy security information */
|
|
|
|
BasicInfo->SecurityDescriptorSize = 0;
|
|
|
|
if (BooleanFlagOn(HandleInfo.GrantedAccess, READ_CONTROL) &&
|
|
|
|
ObjectHeader->SecurityDescriptor != NULL)
|
|
|
|
{
|
|
|
|
SecurityInformation = OWNER_SECURITY_INFORMATION |
|
|
|
|
GROUP_SECURITY_INFORMATION |
|
|
|
|
DACL_SECURITY_INFORMATION |
|
|
|
|
SACL_SECURITY_INFORMATION;
|
|
|
|
|
|
|
|
ObjectType->TypeInfo.SecurityProcedure(Object,
|
|
|
|
QuerySecurityDescriptor,
|
|
|
|
&SecurityInformation,
|
|
|
|
NULL,
|
|
|
|
&BasicInfo->SecurityDescriptorSize,
|
|
|
|
&ObjectHeader->SecurityDescriptor,
|
|
|
|
ObjectType->TypeInfo.PoolType,
|
|
|
|
&ObjectType->TypeInfo.GenericMapping);
|
|
|
|
}
|
|
|
|
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Break out with success */
|
|
|
|
Status = STATUS_SUCCESS;
|
2006-06-05 00:04:36 +00:00
|
|
|
break;
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Name information */
|
|
|
|
case ObjectNameInformation:
|
2006-06-05 00:04:36 +00:00
|
|
|
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Call the helper and break out */
|
|
|
|
Status = ObQueryNameString(Object,
|
|
|
|
(POBJECT_NAME_INFORMATION)
|
|
|
|
ObjectInformation,
|
|
|
|
Length,
|
|
|
|
&InfoLength);
|
|
|
|
break;
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Information about this type */
|
|
|
|
case ObjectTypeInformation:
|
2007-01-25 01:50:40 +00:00
|
|
|
|
|
|
|
/* Call the helper and break out */
|
|
|
|
Status = ObQueryTypeInfo(ObjectHeader->Type,
|
|
|
|
(POBJECT_TYPE_INFORMATION)
|
|
|
|
ObjectInformation,
|
|
|
|
Length,
|
|
|
|
&InfoLength);
|
2006-10-22 09:06:58 +00:00
|
|
|
break;
|
2006-06-05 00:04:36 +00:00
|
|
|
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Information about all types */
|
2007-08-04 08:26:58 +00:00
|
|
|
case ObjectTypesInformation:
|
2006-10-22 09:06:58 +00:00
|
|
|
DPRINT1("NOT IMPLEMENTED!\n");
|
2010-12-15 20:12:03 +00:00
|
|
|
InfoLength = Length;
|
2006-10-22 09:06:58 +00:00
|
|
|
Status = STATUS_NOT_IMPLEMENTED;
|
|
|
|
break;
|
2006-06-29 05:05:27 +00:00
|
|
|
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Information about the handle flags */
|
2007-08-04 08:26:58 +00:00
|
|
|
case ObjectHandleFlagInformation:
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Validate length */
|
|
|
|
InfoLength = sizeof (OBJECT_HANDLE_ATTRIBUTE_INFORMATION);
|
|
|
|
if (Length != sizeof (OBJECT_HANDLE_ATTRIBUTE_INFORMATION))
|
|
|
|
{
|
|
|
|
Status = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
break;
|
|
|
|
}
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2006-10-22 09:06:58 +00:00
|
|
|
/* Get the structure */
|
|
|
|
HandleFlags = (POBJECT_HANDLE_ATTRIBUTE_INFORMATION)
|
|
|
|
ObjectInformation;
|
|
|
|
|
|
|
|
/* Set the flags */
|
2007-01-22 08:15:17 +00:00
|
|
|
HandleFlags->Inherit = HandleInfo.HandleAttributes & OBJ_INHERIT;
|
2006-10-22 09:06:58 +00:00
|
|
|
HandleFlags->ProtectFromClose = (HandleInfo.HandleAttributes &
|
2007-01-22 08:15:17 +00:00
|
|
|
OBJ_PROTECT_CLOSE) != 0;
|
2006-10-22 09:06:58 +00:00
|
|
|
|
|
|
|
/* Break out with success */
|
|
|
|
Status = STATUS_SUCCESS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Anything else */
|
|
|
|
default:
|
|
|
|
|
|
|
|
/* Fail it */
|
2010-12-15 20:12:03 +00:00
|
|
|
InfoLength = Length;
|
2006-10-22 09:06:58 +00:00
|
|
|
Status = STATUS_INVALID_INFO_CLASS;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if the caller wanted the return length */
|
|
|
|
if (ResultLength)
|
2006-06-29 05:05:27 +00:00
|
|
|
{
|
|
|
|
/* Write the length */
|
2010-12-15 20:12:03 +00:00
|
|
|
*ResultLength = InfoLength;
|
2006-06-29 05:05:27 +00:00
|
|
|
}
|
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
2006-10-22 09:06:58 +00:00
|
|
|
{
|
|
|
|
/* Otherwise, get the exception code */
|
2008-11-24 13:40:26 +00:00
|
|
|
Status = _SEH2_GetExceptionCode();
|
2006-10-22 09:06:58 +00:00
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_END;
|
2006-10-22 09:06:58 +00:00
|
|
|
|
|
|
|
/* Dereference the object if we had referenced it */
|
2012-02-15 06:48:39 +00:00
|
|
|
if (Object) ObDereferenceObject(Object);
|
2006-06-29 05:05:27 +00:00
|
|
|
|
|
|
|
/* Return status */
|
2006-05-24 22:07:11 +00:00
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*++
|
|
|
|
* @name NtSetInformationObject
|
|
|
|
* @implemented NT4
|
|
|
|
*
|
|
|
|
* The NtSetInformationObject routine <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @param ObjectHandle
|
|
|
|
* <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @param ObjectInformationClass
|
|
|
|
* <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @param ObjectInformation
|
|
|
|
* <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @param Length
|
|
|
|
* <FILLMEIN>
|
|
|
|
*
|
|
|
|
* @return STATUS_SUCCESS or appropriate error value.
|
|
|
|
*
|
|
|
|
* @remarks None.
|
|
|
|
*
|
|
|
|
*--*/
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
NtSetInformationObject(IN HANDLE ObjectHandle,
|
|
|
|
IN OBJECT_INFORMATION_CLASS ObjectInformationClass,
|
|
|
|
IN PVOID ObjectInformation,
|
|
|
|
IN ULONG Length)
|
|
|
|
{
|
2009-08-26 17:31:02 +00:00
|
|
|
NTSTATUS Status;
|
2006-06-05 00:04:36 +00:00
|
|
|
OBP_SET_HANDLE_ATTRIBUTES_CONTEXT Context;
|
|
|
|
PVOID ObjectTable;
|
|
|
|
KAPC_STATE ApcState;
|
2012-02-15 06:48:39 +00:00
|
|
|
POBJECT_DIRECTORY Directory;
|
|
|
|
KPROCESSOR_MODE PreviousMode;
|
2006-06-05 00:04:36 +00:00
|
|
|
BOOLEAN AttachedToProcess = FALSE;
|
2006-05-24 22:07:11 +00:00
|
|
|
PAGED_CODE();
|
|
|
|
|
2006-06-05 00:04:36 +00:00
|
|
|
/* Validate the information class */
|
2012-02-15 06:48:39 +00:00
|
|
|
switch (ObjectInformationClass)
|
2006-06-05 00:04:36 +00:00
|
|
|
{
|
2012-02-15 06:48:39 +00:00
|
|
|
case ObjectHandleFlagInformation:
|
2013-11-18 14:27:01 +00:00
|
|
|
|
2012-02-15 06:48:39 +00:00
|
|
|
/* Validate the length */
|
|
|
|
if (Length != sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION))
|
|
|
|
{
|
|
|
|
/* Invalid length */
|
|
|
|
return STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
2013-11-18 14:27:01 +00:00
|
|
|
|
2012-02-15 06:48:39 +00:00
|
|
|
/* Save the previous mode */
|
|
|
|
Context.PreviousMode = ExGetPreviousMode();
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2012-02-15 06:48:39 +00:00
|
|
|
/* Check if we were called from user mode */
|
|
|
|
if (Context.PreviousMode != KernelMode)
|
|
|
|
{
|
|
|
|
/* Enter SEH */
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
/* Probe and capture the attribute buffer */
|
|
|
|
ProbeForRead(ObjectInformation,
|
|
|
|
sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION),
|
|
|
|
sizeof(BOOLEAN));
|
|
|
|
Context.Information = *(POBJECT_HANDLE_ATTRIBUTE_INFORMATION)
|
|
|
|
ObjectInformation;
|
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
/* Return the exception code */
|
|
|
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Just copy the buffer directly */
|
|
|
|
Context.Information = *(POBJECT_HANDLE_ATTRIBUTE_INFORMATION)
|
|
|
|
ObjectInformation;
|
|
|
|
}
|
2006-10-22 09:06:58 +00:00
|
|
|
|
2012-02-15 06:48:39 +00:00
|
|
|
/* Check if this is a kernel handle */
|
2013-11-18 14:27:01 +00:00
|
|
|
if (ObpIsKernelHandle(ObjectHandle, Context.PreviousMode))
|
2012-02-15 06:48:39 +00:00
|
|
|
{
|
|
|
|
/* Get the actual handle */
|
|
|
|
ObjectHandle = ObKernelHandleToHandle(ObjectHandle);
|
|
|
|
ObjectTable = ObpKernelHandleTable;
|
2006-05-24 22:07:11 +00:00
|
|
|
|
2012-02-15 06:48:39 +00:00
|
|
|
/* Check if we're not in the system process */
|
|
|
|
if (PsGetCurrentProcess() != PsInitialSystemProcess)
|
|
|
|
{
|
|
|
|
/* Attach to it */
|
|
|
|
KeStackAttachProcess(&PsInitialSystemProcess->Pcb, &ApcState);
|
|
|
|
AttachedToProcess = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Use the current table */
|
|
|
|
ObjectTable = PsGetCurrentProcess()->ObjectTable;
|
|
|
|
}
|
2006-06-05 00:04:36 +00:00
|
|
|
|
2012-02-15 06:48:39 +00:00
|
|
|
/* Change the handle attributes */
|
|
|
|
if (!ExChangeHandle(ObjectTable,
|
|
|
|
ObjectHandle,
|
|
|
|
ObpSetHandleAttributes,
|
|
|
|
(ULONG_PTR)&Context))
|
|
|
|
{
|
|
|
|
/* Some failure */
|
|
|
|
Status = STATUS_ACCESS_DENIED;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* We are done */
|
|
|
|
Status = STATUS_SUCCESS;
|
|
|
|
}
|
2006-06-05 00:04:36 +00:00
|
|
|
|
2012-02-15 06:48:39 +00:00
|
|
|
/* De-attach if we were attached, and return status */
|
|
|
|
if (AttachedToProcess) KeUnstackDetachProcess(&ApcState);
|
|
|
|
break;
|
2013-11-18 14:27:01 +00:00
|
|
|
|
2012-02-15 06:48:39 +00:00
|
|
|
case ObjectSessionInformation:
|
2013-11-18 14:27:01 +00:00
|
|
|
|
2012-02-15 06:48:39 +00:00
|
|
|
/* Only a system process can do this */
|
|
|
|
PreviousMode = ExGetPreviousMode();
|
|
|
|
if (!SeSinglePrivilegeCheck(SeTcbPrivilege, PreviousMode))
|
|
|
|
{
|
|
|
|
/* Fail */
|
|
|
|
DPRINT1("Privilege not held\n");
|
|
|
|
Status = STATUS_PRIVILEGE_NOT_HELD;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Get the object directory */
|
2013-11-18 14:27:01 +00:00
|
|
|
Status = ObReferenceObjectByHandle(ObjectHandle,
|
|
|
|
0,
|
2018-02-13 20:33:04 +00:00
|
|
|
ObpDirectoryObjectType,
|
2012-02-15 06:48:39 +00:00
|
|
|
PreviousMode,
|
|
|
|
(PVOID*)&Directory,
|
|
|
|
NULL);
|
|
|
|
if (NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
/* FIXME: Missng locks */
|
|
|
|
/* Set its session ID */
|
|
|
|
Directory->SessionId = PsGetCurrentProcessSessionId();
|
|
|
|
ObDereferenceObject(Directory);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2013-11-18 14:27:01 +00:00
|
|
|
|
2012-02-15 06:48:39 +00:00
|
|
|
default:
|
|
|
|
/* Unsupported class */
|
|
|
|
Status = STATUS_INVALID_INFO_CLASS;
|
|
|
|
break;
|
2009-08-26 17:31:02 +00:00
|
|
|
}
|
2006-05-24 22:07:11 +00:00
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|
2006-06-05 00:04:36 +00:00
|
|
|
|
2006-05-24 22:07:11 +00:00
|
|
|
/* EOF */
|