mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 09:00:27 +00:00
[NTOSKRNL] Implement support for device maps in ObpLookupObjectName
This allows getting rid of the ?? hack in the kernel but this doesn't allow enabling LUID device maps as ReactOS can no longer open a session with them enabled. So, we must remain with device maps at root CORE-16114
This commit is contained in:
parent
f529033555
commit
f13b6e025f
2 changed files with 48 additions and 25 deletions
|
@ -443,6 +443,12 @@ ObIsLUIDDeviceMapsEnabled(
|
||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
PDEVICE_MAP
|
||||||
|
NTAPI
|
||||||
|
ObpReferenceDeviceMap(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Security descriptor cache functions
|
// Security descriptor cache functions
|
||||||
//
|
//
|
||||||
|
|
|
@ -214,26 +214,6 @@ ObpCreateDosDevicesDirectory(VOID)
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
/*********************************************\
|
|
||||||
|*** HACK until we support device mappings ***|
|
|
||||||
|*** Add a symlink \??\ <--> \GLOBAL??\ ***|
|
|
||||||
\*********************************************/
|
|
||||||
RtlInitUnicodeString(&LinkName, L"\\??");
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
|
||||||
&LinkName,
|
|
||||||
OBJ_PERMANENT,
|
|
||||||
NULL,
|
|
||||||
&DosDevicesSD);
|
|
||||||
Status = NtCreateSymbolicLinkObject(&SymHandle,
|
|
||||||
SYMBOLIC_LINK_ALL_ACCESS,
|
|
||||||
&ObjectAttributes,
|
|
||||||
&RootName);
|
|
||||||
if (NT_SUCCESS(Status)) NtClose(SymHandle);
|
|
||||||
/*********************************************\
|
|
||||||
\*********************************************/
|
|
||||||
|
|
||||||
// FIXME: Create a device mapping for the global \?? directory
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the \??\GLOBALROOT symbolic link
|
* Initialize the \??\GLOBALROOT symbolic link
|
||||||
* pointing to the root directory \ .
|
* pointing to the root directory \ .
|
||||||
|
@ -490,6 +470,8 @@ ObpLookupObjectName(IN HANDLE RootHandle OPTIONAL,
|
||||||
PWCHAR NewName;
|
PWCHAR NewName;
|
||||||
POBJECT_HEADER_NAME_INFO ObjectNameInfo;
|
POBJECT_HEADER_NAME_INFO ObjectNameInfo;
|
||||||
ULONG MaxReparse = 30;
|
ULONG MaxReparse = 30;
|
||||||
|
PDEVICE_MAP DeviceMap = NULL;
|
||||||
|
UNICODE_STRING LocalName;
|
||||||
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",
|
||||||
|
@ -642,6 +624,8 @@ ObpLookupObjectName(IN HANDLE RootHandle OPTIONAL,
|
||||||
*FoundObject = Object;
|
*FoundObject = Object;
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LocalName = *ObjectName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -695,7 +679,14 @@ ObpLookupObjectName(IN HANDLE RootHandle OPTIONAL,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ParseFromRoot:
|
ParseFromRoot:
|
||||||
/* FIXME: Check if we have a device map */
|
LocalName = *ObjectName;
|
||||||
|
|
||||||
|
/* Deference the device map if we already have one */
|
||||||
|
if (DeviceMap != NULL)
|
||||||
|
{
|
||||||
|
ObfDereferenceDeviceMap(DeviceMap);
|
||||||
|
DeviceMap = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if this is a possible DOS name */
|
/* Check if this is a possible DOS name */
|
||||||
if (!((ULONG_PTR)(ObjectName->Buffer) & 7))
|
if (!((ULONG_PTR)(ObjectName->Buffer) & 7))
|
||||||
|
@ -713,7 +704,17 @@ ParseFromRoot:
|
||||||
(*(PULONGLONG)(ObjectName->Buffer) ==
|
(*(PULONGLONG)(ObjectName->Buffer) ==
|
||||||
ObpDosDevicesShortNamePrefix.Alignment.QuadPart))
|
ObpDosDevicesShortNamePrefix.Alignment.QuadPart))
|
||||||
{
|
{
|
||||||
/* FIXME! */
|
DeviceMap = ObpReferenceDeviceMap();
|
||||||
|
/* We have a local mapping, drop the ?? prefix */
|
||||||
|
if (DeviceMap != NULL && DeviceMap->DosDevicesDirectory != NULL)
|
||||||
|
{
|
||||||
|
LocalName.Length -= ObpDosDevicesShortName.Length;
|
||||||
|
LocalName.MaximumLength -= ObpDosDevicesShortName.Length;
|
||||||
|
LocalName.Buffer += (ObpDosDevicesShortName.Length / sizeof(WCHAR));
|
||||||
|
|
||||||
|
/* We'll browse that local directory */
|
||||||
|
Directory = DeviceMap->DosDevicesDirectory;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ((ObjectName->Length == ObpDosDevicesShortName.Length -
|
else if ((ObjectName->Length == ObpDosDevicesShortName.Length -
|
||||||
sizeof(WCHAR)) &&
|
sizeof(WCHAR)) &&
|
||||||
|
@ -722,7 +723,23 @@ ParseFromRoot:
|
||||||
(*((PWCHAR)(ObjectName->Buffer) + 2) ==
|
(*((PWCHAR)(ObjectName->Buffer) + 2) ==
|
||||||
(WCHAR)(ObpDosDevicesShortNameRoot.Alignment.HighPart)))
|
(WCHAR)(ObpDosDevicesShortNameRoot.Alignment.HighPart)))
|
||||||
{
|
{
|
||||||
/* FIXME! */
|
DeviceMap = ObpReferenceDeviceMap();
|
||||||
|
|
||||||
|
/* Caller is looking for the directory itself */
|
||||||
|
if (DeviceMap != NULL && DeviceMap->DosDevicesDirectory != NULL)
|
||||||
|
{
|
||||||
|
Status = ObReferenceObjectByPointer(DeviceMap->DosDevicesDirectory,
|
||||||
|
0,
|
||||||
|
ObjectType,
|
||||||
|
AccessMode);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
*FoundObject = DeviceMap->DosDevicesDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
ObfDereferenceDeviceMap(DeviceMap);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -740,7 +757,7 @@ ParseFromRoot:
|
||||||
while (Reparse && MaxReparse)
|
while (Reparse && MaxReparse)
|
||||||
{
|
{
|
||||||
/* Get the name */
|
/* Get the name */
|
||||||
RemainingName = *ObjectName;
|
RemainingName = LocalName;
|
||||||
|
|
||||||
/* Disable reparsing again */
|
/* Disable reparsing again */
|
||||||
Reparse = FALSE;
|
Reparse = FALSE;
|
||||||
|
@ -1149,7 +1166,7 @@ ReparseObject:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we have a device map and dereference it if so */
|
/* Check if we have a device map and dereference it if so */
|
||||||
//if (DeviceMap) ObfDereferenceDeviceMap(DeviceMap);
|
if (DeviceMap) ObfDereferenceDeviceMap(DeviceMap);
|
||||||
|
|
||||||
/* Check if we have a referenced directory and dereference it if so */
|
/* Check if we have a referenced directory and dereference it if so */
|
||||||
if (ReferencedDirectory) ObDereferenceObject(ReferencedDirectory);
|
if (ReferencedDirectory) ObDereferenceObject(ReferencedDirectory);
|
||||||
|
|
Loading…
Reference in a new issue