/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL - See COPYING in the top level directory
- * FILE: ntoskrnl/ob/namespce.c
+ * FILE: ntoskrnl/ob/obname.c
* PURPOSE: Manages all functions related to the Object Manager name-
* space, such as finding objects or querying their names.
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
/* DOS Device Prefix \??\ and \?? */
ALIGNEDNAME ObpDosDevicesShortNamePrefix = {{L'\\',L'?',L'?',L'\\'}};
ALIGNEDNAME ObpDosDevicesShortNameRoot = {{L'\\',L'?',L'?',L'\0'}};
-static UNICODE_STRING ObpDosDevicesShortName =
+UNICODE_STRING ObpDosDevicesShortName =
{
sizeof(ObpDosDevicesShortNamePrefix),
sizeof(ObpDosDevicesShortNamePrefix),
/* FIXME: Hack Hack! */
ObSystemDeviceMap = ExAllocatePoolWithTag(NonPagedPool,
sizeof(*ObSystemDeviceMap),
- TAG('O', 'b', 'D', 'm'));
+ 'mDbO');
+ if (!ObSystemDeviceMap) return STATUS_INSUFFICIENT_RESOURCES;
RtlZeroMemory(ObSystemDeviceMap, sizeof(*ObSystemDeviceMap));
/* Return status */
/* Get object structures */
ObjectHeader = OBJECT_TO_OBJECT_HEADER(Object);
- ObjectNameInfo = ObpAcquireNameInformation(ObjectHeader);
+ ObjectNameInfo = ObpReferenceNameInfo(ObjectHeader);
ObjectType = ObjectHeader->Type;
/*
!(ObjectHeader->Flags & OB_FLAG_PERMANENT))
{
/* Setup a lookup context */
- ObpInitializeDirectoryLookup(&Context);
+ ObpInitializeLookupContext(&Context);
/* Lock the directory */
ObpAcquireDirectoryLockExclusive(ObjectNameInfo->Directory, &Context);
&Context);
if (Object)
{
- /* Lock the object type */
- ObpEnterObjectTypeMutex(ObjectType);
+ /* Lock the object */
+ ObpAcquireObjectLock(ObjectHeader);
/* Make sure we can still delete the object */
if (!(ObjectHeader->HandleCount) &&
}
/* Release the lock */
- ObpLeaveObjectTypeMutex(ObjectType);
+ ObpReleaseObjectLock(ObjectHeader);
}
/* Cleanup after lookup */
- ObpCleanupDirectoryLookup(&Context);
+ ObpReleaseLookupContext(&Context);
/* Remove another query reference since we added one on top */
- ObpReleaseNameInformation(ObjectNameInfo);
+ ObpDereferenceNameInfo(ObjectNameInfo);
/* Check if we were inserted in a directory */
if (Directory)
{
/* We were, so first remove the extra reference we had added */
- ObpReleaseNameInformation(ObjectNameInfo);
+ ObpDereferenceNameInfo(ObjectNameInfo);
/* Now dereference the object as well */
ObDereferenceObject(Object);
else
{
/* Remove the reference we added */
- ObpReleaseNameInformation(ObjectNameInfo);
+ ObpDereferenceNameInfo(ObjectNameInfo);
}
}
POBJECT_HEADER ObjectHeader;
UNICODE_STRING ComponentName, RemainingName;
BOOLEAN Reparse = FALSE, SymLink = FALSE;
- PDEVICE_MAP DeviceMap = NULL;
POBJECT_DIRECTORY Directory = NULL, ParentDirectory = NULL, RootDirectory;
POBJECT_DIRECTORY ReferencedDirectory = NULL, ReferencedParentDirectory = NULL;
KIRQL CalloutIrql;
InsertObject);
/* Initialize starting state */
- ObpInitializeDirectoryLookup(LookupContext);
+ ObpInitializeLookupContext(LookupContext);
*FoundObject = NULL;
Status = STATUS_SUCCESS;
Object = NULL;
else
{
ParseFromRoot:
- /* Check if we have a device map */
- if (DeviceMap)
- {
- /* Dereference it */
- //ObfDereferenceDeviceMap(DeviceMap);
- DeviceMap = NULL;
- }
+ /* FIXME: Check if we have a device map */
/* Check if this is a possible DOS name */
if (!((ULONG_PTR)(ObjectName->Buffer) & 7))
if (ObjectNameInfo->Name.Buffer)
{
/* Free it */
- ExFreePool(ObjectNameInfo->Name.Buffer);
+ ExFreePoolWithTag(ObjectNameInfo->Name.Buffer, OB_NAME_TAG );
}
/* Write new one */
InterlockedExchangeAdd(&ObjectHeader->PointerCount, 1);
/* Cleanup from the first lookup */
- ObpCleanupDirectoryLookup(LookupContext);
+ ObpReleaseLookupContext(LookupContext);
/* Check if we have a referenced directory */
if (ReferencedDirectory)
if (!NT_SUCCESS(Status))
{
/* Cleanup after lookup */
- ObpCleanupDirectoryLookup(LookupContext);
+ ObpReleaseLookupContext(LookupContext);
}
/* Check if we have a device map and dereference it if so */