Implement device map inheritance
This commit is contained in:
@@ -19,11 +19,14 @@ namespace OB
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
STATIC KPUSH_LOCK DeviceMapLock;
|
STATIC KPUSH_LOCK DeviceMapLock;
|
||||||
|
STATIC PDEVICE_MAP SystemDeviceMap;
|
||||||
STATIC BOOLEAN UniqueDeviceMaps;
|
STATIC BOOLEAN UniqueDeviceMaps;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
STATIC XTAPI POBJECT_DIRECTORY GetGlobalDevicesDirectory(IN POBJECT_DIRECTORY Directory);
|
STATIC XTAPI POBJECT_DIRECTORY GetGlobalDevicesDirectory(IN POBJECT_DIRECTORY Directory);
|
||||||
STATIC XTAPI BOOLEAN GetUniqueDeviceMaps(VOID);
|
STATIC XTAPI BOOLEAN GetUniqueDeviceMaps(VOID);
|
||||||
|
STATIC VOID InheritDeviceMap(IN PEPROCESS NewProcess,
|
||||||
|
IN PEPROCESS ParentProcess);
|
||||||
STATIC XTAPI XTSTATUS InitializeDeviceMap(VOID);
|
STATIC XTAPI XTSTATUS InitializeDeviceMap(VOID);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
/* Synchronizes shared read and exclusive write access to system device map structures */
|
/* Synchronizes shared read and exclusive write access to system device map structures */
|
||||||
KPUSH_LOCK OB::DeviceMap::DeviceMapLock;
|
KPUSH_LOCK OB::DeviceMap::DeviceMapLock;
|
||||||
|
|
||||||
|
/* Pointer to the system device map */
|
||||||
|
PDEVICE_MAP OB::DeviceMap::SystemDeviceMap = NULLPTR;
|
||||||
|
|
||||||
/* Indicates whether the system employs unique device maps */
|
/* Indicates whether the system employs unique device maps */
|
||||||
BOOLEAN OB::DeviceMap::UniqueDeviceMaps;
|
BOOLEAN OB::DeviceMap::UniqueDeviceMaps;
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,51 @@ OB::DeviceMap::GetUniqueDeviceMaps(VOID)
|
|||||||
return UniqueDeviceMaps;
|
return UniqueDeviceMaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inherits the device map from a parent process or assigns the system default.
|
||||||
|
*
|
||||||
|
* @param NewProcess
|
||||||
|
* Supplies the newly created process that will inherit the device map.
|
||||||
|
*
|
||||||
|
* @param ParentProcess
|
||||||
|
* Supplies the optional parent process to inherit the device map from.
|
||||||
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
OB::DeviceMap::InheritDeviceMap(IN PEPROCESS NewProcess,
|
||||||
|
IN PEPROCESS ParentProcess)
|
||||||
|
{
|
||||||
|
PDEVICE_MAP TargetDeviceMap;
|
||||||
|
|
||||||
|
/* Acquire the device map lock */
|
||||||
|
KE::PushLockExclusiveGuard PushLock(&DeviceMapLock);
|
||||||
|
|
||||||
|
/* Determine the source of the device map */
|
||||||
|
if(ParentProcess)
|
||||||
|
{
|
||||||
|
/* Inherit the device map from the provided parent process */
|
||||||
|
TargetDeviceMap = (PDEVICE_MAP)ParentProcess->DeviceMap;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* No parent process provided, use system device map */
|
||||||
|
TargetDeviceMap = SystemDeviceMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if a valid device map was resolved */
|
||||||
|
if(TargetDeviceMap)
|
||||||
|
{
|
||||||
|
/* Increment the reference count of the target device map */
|
||||||
|
TargetDeviceMap->ReferenceCount++;
|
||||||
|
|
||||||
|
/* Assign the device map to the process */
|
||||||
|
NewProcess->DeviceMap = TargetDeviceMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the Object Manager's device map subsystem.
|
* Initializes the Object Manager's device map subsystem.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user