- Add missing code to ObpLookupDirectoryEntry.

- Add calls to ObpInitailizeDirectoryLookup.
- Add calls to ObpCleanupDirectoryLookup but disable them for now.
- Add calls to ObpAcquireDirectoryLock but disable them for now.

svn path=/trunk/; revision=25395
This commit is contained in:
Alex Ionescu 2007-01-09 09:07:36 +00:00
parent fe1190c599
commit 96b09e8f09
4 changed files with 33 additions and 4 deletions

View file

@ -185,7 +185,8 @@ ObpLookupEntryDirectory(IN POBJECT_DIRECTORY Directory,
/* Check if the directory is already locked */ /* Check if the directory is already locked */
if (!Context->DirectoryLocked) if (!Context->DirectoryLocked)
{ {
/* Lock it */
ObpAcquireDirectoryLockShared(Directory, Context);
} }
/* Start looping */ /* Start looping */
@ -222,6 +223,8 @@ ObpLookupEntryDirectory(IN POBJECT_DIRECTORY Directory,
/* Check if the directory was locked */ /* Check if the directory was locked */
if (!Context->DirectoryLocked) if (!Context->DirectoryLocked)
{ {
/* Convert the lock from shared to exclusive */
ExConvertPushLockSharedToExclusive(&Directory->Lock);
} }
/* Set the Current Entry */ /* Set the Current Entry */
@ -241,6 +244,11 @@ ObpLookupEntryDirectory(IN POBJECT_DIRECTORY Directory,
/* Get the object name information */ /* Get the object name information */
ObjectHeader = OBJECT_TO_OBJECT_HEADER(FoundObject); ObjectHeader = OBJECT_TO_OBJECT_HEADER(FoundObject);
HeaderNameInfo = OBJECT_HEADER_TO_NAME_INFO(ObjectHeader); HeaderNameInfo = OBJECT_HEADER_TO_NAME_INFO(ObjectHeader);
if (HeaderNameInfo)
{
/* Add a query reference */
//ObpIncrementQueryReference(ObjectHeader, HeaderNameInfo);
}
/* Reference the object being looked up */ /* Reference the object being looked up */
//ObReferenceObject(FoundObject); //ObReferenceObject(FoundObject);
@ -248,6 +256,8 @@ ObpLookupEntryDirectory(IN POBJECT_DIRECTORY Directory,
/* Check if the directory was locked */ /* Check if the directory was locked */
if (!Context->DirectoryLocked) if (!Context->DirectoryLocked)
{ {
/* Release the lock */
ObpReleaseDirectoryLock(Directory, Context);
} }
} }
else else
@ -255,6 +265,8 @@ ObpLookupEntryDirectory(IN POBJECT_DIRECTORY Directory,
/* Check if the directory was locked */ /* Check if the directory was locked */
if (!Context->DirectoryLocked) if (!Context->DirectoryLocked)
{ {
/* Release the lock */
ObpReleaseDirectoryLock(Directory, Context);
} }
/* Check if we should scan the shadow directory */ /* Check if we should scan the shadow directory */

View file

@ -2030,6 +2030,7 @@ ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* Cleanup after lookup */ /* Cleanup after lookup */
//ObpCleanupDirectoryLookup(&TempBuffer->LookupContext, TRUE);
TempBuffer->LookupContext.Object = NULL; TempBuffer->LookupContext.Object = NULL;
goto Cleanup; goto Cleanup;
} }
@ -2062,7 +2063,9 @@ ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes,
{ {
/* Set failure code */ /* Set failure code */
Status = STATUS_INVALID_PARAMETER; Status = STATUS_INVALID_PARAMETER;
TempBuffer->LookupContext.Object = NULL;
/* Cleanup after lookup */
//ObpCleanupDirectoryLookup(&TempBuffer->LookupContext, TRUE);
} }
else else
{ {
@ -2440,12 +2443,13 @@ ObInsertObject(IN PVOID Object,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* Fail */ /* Fail */
if (ObjectNameInfo) ObpDecrementQueryReference(ObjectNameInfo);
ObDereferenceObject(Object); ObDereferenceObject(Object);
return Status; return Status;
} }
/* Setup a lookup context */ /* Setup a lookup context */
Context.Object = NULL; ObpInitializeDirectoryLookup(&Context);
InsertObject = Object; InsertObject = Object;
OpenReason = ObCreateHandle; OpenReason = ObCreateHandle;

View file

@ -278,9 +278,17 @@ ObPostPhase0:
Status = NtClose(Handle); Status = NtClose(Handle);
if (!NT_SUCCESS(Status)) return FALSE; if (!NT_SUCCESS(Status)) return FALSE;
Context.Object = NULL; /* Initialize lookup context */
ObpInitializeDirectoryLookup(&Context);
/* Lock it */
//ObpAcquireDirectoryLockExclusive(ObpTypeDirectoryObject, &Context);
/* Setup directory */
// FIXME: ObpSetLookupDirectory(Dir);?
Context.Directory = ObpTypeDirectoryObject; Context.Directory = ObpTypeDirectoryObject;
Context.DirectoryLocked = TRUE; Context.DirectoryLocked = TRUE;
Context.LockStateSignature = 0xCCCC1234;
/* Loop the object types */ /* Loop the object types */
ListHead = &ObTypeObjectType->TypeList; ListHead = &ObTypeObjectType->TypeList;
@ -317,6 +325,8 @@ ObPostPhase0:
NextEntry = NextEntry->Flink; NextEntry = NextEntry->Flink;
} }
/* Cleanup after lookup */
//ObpCleanupDirectoryLookup(&Context, TRUE);
Context.Object = NULL; Context.Object = NULL;
/* Initialize DOS Devices Directory and related Symbolic Links */ /* Initialize DOS Devices Directory and related Symbolic Links */

View file

@ -428,6 +428,9 @@ ObReferenceObjectByName(IN PUNICODE_STRING ObjectPath,
PassedAccessState, PassedAccessState,
&Context, &Context,
&Object); &Object);
/* Cleanup after lookup */
//ObpCleanupDirectoryLookup(&Context, TRUE);
Context.Object = NULL; Context.Object = NULL;
/* Check if the lookup succeeded */ /* Check if the lookup succeeded */