mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
- Fix initialiization of the object manager lookaside lists.
- Rename the variables to understandable names. - Don't leak object locks when destroying an object type. - Directory objects must be case-insensitive. - Symbolic links must be case-insensitive. - Create \KernelObjects directory during startup. svn path=/trunk/; revision=32811
This commit is contained in:
parent
43d5fa83aa
commit
24e07f0eac
3 changed files with 93 additions and 39 deletions
|
@ -123,6 +123,21 @@ typedef struct _OB_TEMP_BUFFER
|
|||
AUX_DATA AuxData;
|
||||
} OB_TEMP_BUFFER, *POB_TEMP_BUFFER;
|
||||
|
||||
//
|
||||
// Startup and Shutdown Functions
|
||||
//
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
ObInitSystem(
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
ObShutdownSystem(
|
||||
VOID
|
||||
);
|
||||
|
||||
//
|
||||
// Directory Namespace Functions
|
||||
//
|
||||
|
@ -330,6 +345,12 @@ ObpFreeObjectNameBuffer(
|
|||
IN PUNICODE_STRING Name
|
||||
);
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
ObpDeleteObjectType(
|
||||
IN PVOID Object
|
||||
);
|
||||
|
||||
//
|
||||
// DOS Devices Functions
|
||||
//
|
||||
|
@ -541,7 +562,7 @@ extern POBJECT_DIRECTORY ObpTypeDirectoryObject;
|
|||
extern PHANDLE_TABLE ObpKernelHandleTable;
|
||||
extern WORK_QUEUE_ITEM ObpReaperWorkItem;
|
||||
extern volatile PVOID ObpReaperList;
|
||||
extern NPAGED_LOOKASIDE_LIST ObpNmLookasideList, ObpCiLookasideList;
|
||||
extern GENERAL_LOOKASIDE ObpNameBufferLookasideList, ObpCreateInfoLookasideList;
|
||||
extern BOOLEAN IoCountOperations;
|
||||
extern ALIGNEDNAME ObpDosDevicesShortNamePrefix;
|
||||
extern ALIGNEDNAME ObpDosDevicesShortNameRoot;
|
||||
|
|
|
@ -61,7 +61,7 @@ ObInit2(VOID)
|
|||
{
|
||||
CCHAR i;
|
||||
PKPRCB Prcb;
|
||||
PNPAGED_LOOKASIDE_LIST CurrentList = NULL;
|
||||
PGENERAL_LOOKASIDE CurrentList = NULL;
|
||||
|
||||
/* Now allocate the per-processor lists */
|
||||
for (i = 0; i < KeNumberProcessors; i++)
|
||||
|
@ -70,54 +70,52 @@ ObInit2(VOID)
|
|||
Prcb = KiProcessorBlock[(int)i];
|
||||
|
||||
/* Set the OBJECT_CREATE_INFORMATION List */
|
||||
Prcb->PPLookasideList[LookasideCreateInfoList].L = &ObpCiLookasideList.L;
|
||||
Prcb->PPLookasideList[LookasideCreateInfoList].L = &ObpCreateInfoLookasideList;
|
||||
CurrentList = ExAllocatePoolWithTag(NonPagedPool,
|
||||
sizeof(NPAGED_LOOKASIDE_LIST),
|
||||
sizeof(GENERAL_LOOKASIDE),
|
||||
TAG('O', 'b', 'C', 'I'));
|
||||
if (CurrentList)
|
||||
{
|
||||
/* Initialize it */
|
||||
ExInitializeNPagedLookasideList(CurrentList,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
ExInitializeSystemLookasideList(CurrentList,
|
||||
NonPagedPool,
|
||||
sizeof(OBJECT_CREATE_INFORMATION),
|
||||
TAG('O', 'b', 'C', 'I'),
|
||||
32);
|
||||
32,
|
||||
&ExSystemLookasideListHead);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No list, use the static buffer */
|
||||
CurrentList = &ObpCiLookasideList;
|
||||
CurrentList = &ObpCreateInfoLookasideList;
|
||||
}
|
||||
|
||||
/* Link it */
|
||||
Prcb->PPLookasideList[LookasideCreateInfoList].P = &CurrentList->L;
|
||||
Prcb->PPLookasideList[LookasideCreateInfoList].P = CurrentList;
|
||||
|
||||
/* Set the captured UNICODE_STRING Object Name List */
|
||||
Prcb->PPLookasideList[LookasideNameBufferList].L = &ObpNmLookasideList.L;
|
||||
Prcb->PPLookasideList[LookasideNameBufferList].L = &ObpNameBufferLookasideList;
|
||||
CurrentList = ExAllocatePoolWithTag(NonPagedPool,
|
||||
sizeof(NPAGED_LOOKASIDE_LIST),
|
||||
sizeof(GENERAL_LOOKASIDE),
|
||||
TAG('O', 'b', 'N', 'M'));
|
||||
if (CurrentList)
|
||||
{
|
||||
/* Initialize it */
|
||||
ExInitializeNPagedLookasideList(CurrentList,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
ExInitializeSystemLookasideList(CurrentList,
|
||||
PagedPool,
|
||||
248,
|
||||
TAG('O', 'b', 'N', 'M'),
|
||||
16);
|
||||
16,
|
||||
&ExSystemLookasideListHead);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No list, use the static buffer */
|
||||
CurrentList = &ObpNmLookasideList;
|
||||
CurrentList = &ObpNameBufferLookasideList;
|
||||
}
|
||||
|
||||
/* Link it */
|
||||
Prcb->PPLookasideList[LookasideNameBufferList].P = &CurrentList->L;
|
||||
Prcb->PPLookasideList[LookasideNameBufferList].P = CurrentList;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -144,34 +142,32 @@ ObInit(VOID)
|
|||
if (ObpInitializationPhase != 0) goto ObPostPhase0;
|
||||
|
||||
/* Initialize the OBJECT_CREATE_INFORMATION List */
|
||||
ExInitializeNPagedLookasideList(&ObpCiLookasideList,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
ExInitializeSystemLookasideList(&ObpCreateInfoLookasideList,
|
||||
NonPagedPool,
|
||||
sizeof(OBJECT_CREATE_INFORMATION),
|
||||
TAG('O', 'b', 'C', 'I'),
|
||||
32);
|
||||
32,
|
||||
&ExSystemLookasideListHead);
|
||||
|
||||
/* Set the captured UNICODE_STRING Object Name List */
|
||||
ExInitializeNPagedLookasideList(&ObpNmLookasideList,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
ExInitializeSystemLookasideList(&ObpNameBufferLookasideList,
|
||||
PagedPool,
|
||||
248,
|
||||
TAG('O', 'b', 'N', 'M'),
|
||||
16);
|
||||
16,
|
||||
&ExSystemLookasideListHead);
|
||||
|
||||
/* Temporarily setup both pointers to the shared list */
|
||||
Prcb->PPLookasideList[LookasideCreateInfoList].L = &ObpCiLookasideList.L;
|
||||
Prcb->PPLookasideList[LookasideCreateInfoList].P = &ObpCiLookasideList.L;
|
||||
Prcb->PPLookasideList[LookasideNameBufferList].L = &ObpNmLookasideList.L;
|
||||
Prcb->PPLookasideList[LookasideNameBufferList].P = &ObpNmLookasideList.L;
|
||||
Prcb->PPLookasideList[LookasideCreateInfoList].L = &ObpCreateInfoLookasideList;
|
||||
Prcb->PPLookasideList[LookasideCreateInfoList].P = &ObpCreateInfoLookasideList;
|
||||
Prcb->PPLookasideList[LookasideNameBufferList].L = &ObpNameBufferLookasideList;
|
||||
Prcb->PPLookasideList[LookasideNameBufferList].P = &ObpNameBufferLookasideList;
|
||||
|
||||
/* Initialize the security descriptor cache */
|
||||
ObpInitSdCache();
|
||||
|
||||
/* Initialize the Default Event */
|
||||
KeInitializeEvent(&ObpDefaultObject, NotificationEvent, TRUE );
|
||||
KeInitializeEvent(&ObpDefaultObject, NotificationEvent, TRUE);
|
||||
|
||||
/* Setup default access for the system process */
|
||||
PsGetCurrentProcess()->GrantedAccess = PROCESS_ALL_ACCESS;
|
||||
|
@ -198,21 +194,22 @@ ObInit(VOID)
|
|||
ObjectTypeInitializer.GenericMapping = ObpTypeMapping;
|
||||
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_TYPE);
|
||||
ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
|
||||
ObjectTypeInitializer.DeleteProcedure = ObpDeleteObjectType;
|
||||
ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObpTypeObjectType);
|
||||
|
||||
/* Create the Directory Type */
|
||||
RtlInitUnicodeString(&Name, L"Directory");
|
||||
ObjectTypeInitializer.ValidAccessMask = DIRECTORY_ALL_ACCESS;
|
||||
ObjectTypeInitializer.UseDefaultObject = FALSE;
|
||||
ObjectTypeInitializer.CaseInsensitive = TRUE;
|
||||
ObjectTypeInitializer.MaintainTypeList = FALSE;
|
||||
ObjectTypeInitializer.GenericMapping = ObpDirectoryMapping;
|
||||
ObjectTypeInitializer.DeleteProcedure = NULL;
|
||||
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_DIRECTORY);
|
||||
ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObDirectoryType);
|
||||
|
||||
/* Create 'symbolic link' object type */
|
||||
RtlInitUnicodeString(&Name, L"SymbolicLink");
|
||||
ObjectTypeInitializer.DefaultNonPagedPoolCharge =
|
||||
sizeof(OBJECT_SYMBOLIC_LINK);
|
||||
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_SYMBOLIC_LINK);
|
||||
ObjectTypeInitializer.GenericMapping = ObpSymbolicLinkMapping;
|
||||
ObjectTypeInitializer.ValidAccessMask = SYMBOLIC_LINK_ALL_ACCESS;
|
||||
ObjectTypeInitializer.ParseProcedure = ObpParseSymbolicLink;
|
||||
|
@ -255,6 +252,24 @@ ObPostPhase0:
|
|||
Status = NtClose(Handle);
|
||||
if (!NT_SUCCESS(Status)) return FALSE;
|
||||
|
||||
/* Initialize Object Types directory attributes */
|
||||
RtlInitUnicodeString(&Name, L"\\KernelObjects");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&Name,
|
||||
OBJ_CASE_INSENSITIVE | OBJ_PERMANENT,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
/* Create the directory */
|
||||
Status = NtCreateDirectoryObject(&Handle,
|
||||
DIRECTORY_ALL_ACCESS,
|
||||
&ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status)) return FALSE;
|
||||
|
||||
/* Close the extra handle */
|
||||
Status = NtClose(Handle);
|
||||
if (!NT_SUCCESS(Status)) return FALSE;
|
||||
|
||||
/* Initialize Object Types directory attributes */
|
||||
RtlInitUnicodeString(&Name, L"\\ObjectTypes");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
|
|
|
@ -22,7 +22,7 @@ extern ULONG NtGlobalFlag;
|
|||
POBJECT_TYPE ObpTypeObjectType = NULL;
|
||||
KEVENT ObpDefaultObject;
|
||||
|
||||
NPAGED_LOOKASIDE_LIST ObpNmLookasideList, ObpCiLookasideList;
|
||||
GENERAL_LOOKASIDE ObpNameBufferLookasideList, ObpCreateInfoLookasideList;
|
||||
|
||||
WORK_QUEUE_ITEM ObpReaperWorkItem;
|
||||
volatile PVOID ObpReaperList;
|
||||
|
@ -1236,6 +1236,24 @@ ObCreateObjectType(IN PUNICODE_STRING TypeName,
|
|||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
ObpDeleteObjectType(IN PVOID Object)
|
||||
{
|
||||
ULONG i;
|
||||
POBJECT_TYPE ObjectType = (PVOID)Object;
|
||||
|
||||
/* Loop our locks */
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
/* Delete each one */
|
||||
ExDeleteResourceLite(&ObjectType->ObjectLocks[i]);
|
||||
}
|
||||
|
||||
/* Delete our main mutex */
|
||||
ExDeleteResourceLite(&ObjectType->Mutex);
|
||||
}
|
||||
|
||||
/*++
|
||||
* @name ObMakeTemporaryObject
|
||||
* @implemented NT4
|
||||
|
|
Loading…
Reference in a new issue