mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:52:57 +00:00
- Hold reference to the current directory and to the current parent directory during lookups.
- Add more stubbed out cleanup code. svn path=/trunk/; revision=25397
This commit is contained in:
parent
5676292f72
commit
3a79b7cfd8
1 changed files with 59 additions and 1 deletions
|
@ -304,6 +304,7 @@ ObpLookupObjectName(IN HANDLE RootHandle,
|
||||||
KPROCESSOR_MODE AccessCheckMode;
|
KPROCESSOR_MODE AccessCheckMode;
|
||||||
OB_PARSE_METHOD ParseRoutine;
|
OB_PARSE_METHOD ParseRoutine;
|
||||||
KIRQL CalloutIrql;
|
KIRQL CalloutIrql;
|
||||||
|
POBJECT_DIRECTORY ReferencedDirectory = NULL, ReferencedParentDirectory = NULL;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
OBTRACE(OB_NAMESPACE_DEBUG,
|
OBTRACE(OB_NAMESPACE_DEBUG,
|
||||||
"%s - Finding Object: %wZ. Expecting: %p\n",
|
"%s - Finding Object: %wZ. Expecting: %p\n",
|
||||||
|
@ -535,6 +536,13 @@ ReparseNewDir:
|
||||||
if ((AccessCheckMode != KernelMode) &&
|
if ((AccessCheckMode != KernelMode) &&
|
||||||
!(AccessState->Flags & TOKEN_HAS_TRAVERSE_PRIVILEGE))
|
!(AccessState->Flags & TOKEN_HAS_TRAVERSE_PRIVILEGE))
|
||||||
{
|
{
|
||||||
|
/* We shouldn't have referenced a directory yet */
|
||||||
|
ASSERT(ReferencedDirectory == NULL);
|
||||||
|
|
||||||
|
/* Reference the directory */
|
||||||
|
ObReferenceObject(Directory);
|
||||||
|
ReferencedDirectory = Directory;
|
||||||
|
|
||||||
/* Check if we have a parent directory */
|
/* Check if we have a parent directory */
|
||||||
if (ParentDirectory)
|
if (ParentDirectory)
|
||||||
{
|
{
|
||||||
|
@ -555,6 +563,14 @@ ReparseNewDir:
|
||||||
/* Check if we don't have a remaining name yet */
|
/* Check if we don't have a remaining name yet */
|
||||||
if (!RemainingName.Length)
|
if (!RemainingName.Length)
|
||||||
{
|
{
|
||||||
|
/* Check if we don't have a referenced directory yet */
|
||||||
|
if (!ReferencedDirectory)
|
||||||
|
{
|
||||||
|
/* Reference it */
|
||||||
|
ObReferenceObject(Directory);
|
||||||
|
ReferencedDirectory = Directory;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if we are inserting an object */
|
/* Check if we are inserting an object */
|
||||||
if (InsertObject)
|
if (InsertObject)
|
||||||
{
|
{
|
||||||
|
@ -684,6 +700,26 @@ Reparse:
|
||||||
/* Increment the pointer count */
|
/* Increment the pointer count */
|
||||||
InterlockedExchangeAdd(&ObjectHeader->PointerCount, 1);
|
InterlockedExchangeAdd(&ObjectHeader->PointerCount, 1);
|
||||||
|
|
||||||
|
/* Cleanup from the first lookup */
|
||||||
|
//ObpCleanupDirectoryLookup(LookupContext, TRUE);
|
||||||
|
LookupContext->Object = NULL;
|
||||||
|
|
||||||
|
/* Check if we have a referenced directory */
|
||||||
|
if (ReferencedDirectory)
|
||||||
|
{
|
||||||
|
/* We do, dereference it */
|
||||||
|
ObDereferenceObject(ReferencedDirectory);
|
||||||
|
ReferencedDirectory = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if we have a referenced parent directory */
|
||||||
|
if (ReferencedParentDirectory)
|
||||||
|
{
|
||||||
|
/* We do, dereference it */
|
||||||
|
ObDereferenceObject(ReferencedParentDirectory);
|
||||||
|
ReferencedParentDirectory = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Call the Parse Procedure */
|
/* Call the Parse Procedure */
|
||||||
ObpCalloutStart(&CalloutIrql);
|
ObpCalloutStart(&CalloutIrql);
|
||||||
Status = ParseRoutine(Object,
|
Status = ParseRoutine(Object,
|
||||||
|
@ -804,9 +840,18 @@ Reparse:
|
||||||
/* We still have a name; check if this is a directory object */
|
/* We still have a name; check if this is a directory object */
|
||||||
if (ObjectHeader->Type == ObDirectoryType)
|
if (ObjectHeader->Type == ObDirectoryType)
|
||||||
{
|
{
|
||||||
/* Restart from this directory */
|
/* Check if we have a referenced parent directory */
|
||||||
|
if (ReferencedParentDirectory)
|
||||||
|
{
|
||||||
|
/* Dereference it */
|
||||||
|
ObDereferenceObject(ReferencedParentDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Restart the lookup from this directory */
|
||||||
|
ReferencedParentDirectory = ReferencedDirectory;
|
||||||
ParentDirectory = Directory;
|
ParentDirectory = Directory;
|
||||||
Directory = Object;
|
Directory = Object;
|
||||||
|
ReferencedDirectory = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -827,6 +872,19 @@ Reparse:
|
||||||
LookupContext->Object = NULL;
|
LookupContext->Object = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if we have a device map and dereference it if so */
|
||||||
|
//if (DeviceMap) ObfDereferenceDeviceMap(DeviceMap);
|
||||||
|
|
||||||
|
/* Check if we have a referenced directory and dereference it if so */
|
||||||
|
if (ReferencedDirectory) ObDereferenceObject(ReferencedDirectory);
|
||||||
|
|
||||||
|
/* Check if we have a referenced parent directory */
|
||||||
|
if (ReferencedParentDirectory)
|
||||||
|
{
|
||||||
|
/* We do, dereference it */
|
||||||
|
ObDereferenceObject(ReferencedParentDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
/* Set the found object and check if we got one */
|
/* Set the found object and check if we got one */
|
||||||
*FoundObject = Object;
|
*FoundObject = Object;
|
||||||
if (!Object)
|
if (!Object)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue