mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[VIDEOPRT] Honour NumAccessRanges == 0 / AccessRanges == NULL in VideoPortVerifyAccessRanges()
These are specified for releasing the hardware resources previously acquired by either a previous call to VideoPortVerifyAccessRanges() or a call to VideoPortGetAccessRanges().
This commit is contained in:
parent
de6313d89e
commit
3121aee56e
2 changed files with 46 additions and 5 deletions
|
@ -190,6 +190,31 @@ IntVideoPortFilterResourceRequirements(
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
IntVideoPortReleaseResources(
|
||||||
|
_In_ PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
BOOLEAN ConflictDetected;
|
||||||
|
// An empty CM_RESOURCE_LIST
|
||||||
|
UCHAR EmptyResourceList[FIELD_OFFSET(CM_RESOURCE_LIST, List)] = {0};
|
||||||
|
|
||||||
|
Status = IoReportResourceForDetection(
|
||||||
|
DeviceExtension->DriverObject,
|
||||||
|
NULL, 0, /* Driver List */
|
||||||
|
DeviceExtension->PhysicalDeviceObject,
|
||||||
|
(PCM_RESOURCE_LIST)EmptyResourceList,
|
||||||
|
sizeof(EmptyResourceList),
|
||||||
|
&ConflictDetected);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("VideoPortReleaseResources IoReportResource failed with 0x%08lx ; ConflictDetected: %s\n",
|
||||||
|
Status, ConflictDetected ? "TRUE" : "FALSE");
|
||||||
|
}
|
||||||
|
/* Ignore the returned status however... */
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
IntVideoPortMapPhysicalMemory(
|
IntVideoPortMapPhysicalMemory(
|
||||||
IN HANDLE Process,
|
IN HANDLE Process,
|
||||||
|
@ -844,20 +869,31 @@ VideoPortVerifyAccessRanges(
|
||||||
{
|
{
|
||||||
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
BOOLEAN ConflictDetected;
|
BOOLEAN ConflictDetected;
|
||||||
ULONG i;
|
|
||||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
|
|
||||||
PCM_RESOURCE_LIST ResourceList;
|
|
||||||
ULONG ResourceListSize;
|
ULONG ResourceListSize;
|
||||||
|
PCM_RESOURCE_LIST ResourceList;
|
||||||
|
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
|
||||||
|
ULONG i;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
TRACE_(VIDEOPRT, "VideoPortVerifyAccessRanges\n");
|
TRACE_(VIDEOPRT, "VideoPortVerifyAccessRanges\n");
|
||||||
|
|
||||||
|
/* Verify parameters */
|
||||||
|
if (NumAccessRanges && !AccessRanges)
|
||||||
|
return ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
|
DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
|
||||||
|
|
||||||
|
if (NumAccessRanges == 0)
|
||||||
|
{
|
||||||
|
/* Release the resources and do nothing more for now... */
|
||||||
|
IntVideoPortReleaseResources(DeviceExtension);
|
||||||
|
return NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create the resource list */
|
/* Create the resource list */
|
||||||
ResourceListSize = sizeof(CM_RESOURCE_LIST)
|
ResourceListSize = sizeof(CM_RESOURCE_LIST)
|
||||||
+ (NumAccessRanges - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
+ (NumAccessRanges - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||||
ResourceList = ExAllocatePool(PagedPool, ResourceListSize);
|
ResourceList = ExAllocatePoolWithTag(PagedPool, ResourceListSize, TAG_VIDEO_PORT);
|
||||||
if (!ResourceList)
|
if (!ResourceList)
|
||||||
{
|
{
|
||||||
WARN_(VIDEOPRT, "ExAllocatePool() failed\n");
|
WARN_(VIDEOPRT, "ExAllocatePool() failed\n");
|
||||||
|
@ -904,7 +940,8 @@ VideoPortVerifyAccessRanges(
|
||||||
DeviceExtension->PhysicalDeviceObject,
|
DeviceExtension->PhysicalDeviceObject,
|
||||||
ResourceList, ResourceListSize,
|
ResourceList, ResourceListSize,
|
||||||
&ConflictDetected);
|
&ConflictDetected);
|
||||||
ExFreePool(ResourceList);
|
|
||||||
|
ExFreePoolWithTag(ResourceList, TAG_VIDEO_PORT);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status) || ConflictDetected)
|
if (!NT_SUCCESS(Status) || ConflictDetected)
|
||||||
return ERROR_INVALID_PARAMETER;
|
return ERROR_INVALID_PARAMETER;
|
||||||
|
|
|
@ -237,6 +237,10 @@ IntVideoPortFilterResourceRequirements(
|
||||||
IN PIO_STACK_LOCATION IrpStack,
|
IN PIO_STACK_LOCATION IrpStack,
|
||||||
IN PIRP Irp);
|
IN PIRP Irp);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
IntVideoPortReleaseResources(
|
||||||
|
_In_ PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension);
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
IntVideoPortMapPhysicalMemory(
|
IntVideoPortMapPhysicalMemory(
|
||||||
IN HANDLE Process,
|
IN HANDLE Process,
|
||||||
|
|
Loading…
Reference in a new issue