Skip to content

Commit aeae7a1

Browse files
DarkFire01HBelusca
andcommitted
[CODEREVIEW]
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
1 parent efe6e8b commit aeae7a1

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

win32ss/drivers/videoprt/resource.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
extern BOOLEAN VpBaseVideo;
2828

29+
static UNICODE_STRING VideoClassName = RTL_CONSTANT_STRING(L"VIDEO");
30+
2931
/* PRIVATE FUNCTIONS **********************************************************/
3032

3133
static BOOLEAN
@@ -228,7 +230,6 @@ IntVideoPortReleaseResources(
228230
}
229231
else
230232
{
231-
static UNICODE_STRING VideoClassName = RTL_CONSTANT_STRING(L"VIDEO");
232233
Status = IoReportResourceUsage(&VideoClassName,
233234
DeviceExtension->DriverObject,
234235
NULL,
@@ -302,7 +303,7 @@ IntAccessRangeIsInAllocatedResources(
302303
_In_ PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
303304
_In_ PVIDEO_ACCESS_RANGE Range)
304305
{
305-
PCM_RESOURCE_LIST Res = DeviceExtension->AllocatedResources;
306+
CM_RESOURCE_LIST *Res = DeviceExtension->AllocatedResources;
306307
CM_FULL_RESOURCE_DESCRIPTOR *Full;
307308
CM_PARTIAL_RESOURCE_DESCRIPTOR *Desc;
308309

@@ -992,8 +993,6 @@ VideoPortVerifyAccessRanges(
992993
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
993994
ULONG i;
994995
NTSTATUS Status;
995-
USHORT PciCommand;
996-
ULONG BytesRead;
997996

998997
TRACE_(VIDEOPRT, "VideoPortVerifyAccessRanges\n");
999998

@@ -1013,7 +1012,7 @@ VideoPortVerifyAccessRanges(
10131012
KeWaitForMutexObject(&VgaSyncLock, Executive, KernelMode, FALSE, NULL);
10141013
if (VgaRanges)
10151014
{
1016-
ExFreePool(VgaRanges);
1015+
ExFreePoolWithTag(VgaRanges, TAG_VIDEO_PORT);
10171016
VgaRanges = NULL;
10181017
}
10191018
NumOfVgaRanges = 0;
@@ -1029,6 +1028,9 @@ VideoPortVerifyAccessRanges(
10291028
*/
10301029
if (!DeviceExtension->IsLegacyDevice && DeviceExtension->AdapterInterfaceType == PCIBus)
10311030
{
1031+
USHORT PciCommand;
1032+
ULONG BytesRead;
1033+
10321034
BytesRead = HalGetBusDataByOffset(PCIConfiguration,
10331035
DeviceExtension->SystemIoBusNumber,
10341036
DeviceExtension->SystemIoSlotNumber,
@@ -1138,7 +1140,6 @@ VideoPortVerifyAccessRanges(
11381140
/* IntIsVgaSaveDriver() will later ignore STATUS_CONFLICTING_ADDRESSES, but we still claim it */
11391141
if (!NT_SUCCESS(Status) && IntIsVgaSaveDriver(DeviceExtension))
11401142
{
1141-
static UNICODE_STRING VideoClassName = RTL_CONSTANT_STRING(L"VIDEO");
11421143
NTSTATUS fbStatus;
11431144
BOOLEAN fbConflict = FALSE;
11441145
fbStatus = IoReportResourceUsage(&VideoClassName,
@@ -1158,7 +1159,6 @@ VideoPortVerifyAccessRanges(
11581159
}
11591160
else
11601161
{
1161-
static UNICODE_STRING VideoClassName = RTL_CONSTANT_STRING(L"VIDEO");
11621162
Status = IoReportResourceUsage(&VideoClassName,
11631163
DeviceExtension->DriverObject,
11641164
NULL,
@@ -1191,7 +1191,7 @@ VideoPortVerifyAccessRanges(
11911191
KeWaitForMutexObject(&VgaSyncLock, Executive, KernelMode, FALSE, NULL);
11921192
if (VgaRanges)
11931193
{
1194-
ExFreePool(VgaRanges);
1194+
ExFreePoolWithTag(VgaRanges, TAG_VIDEO_PORT);
11951195
VgaRanges = NULL;
11961196
NumOfVgaRanges = 0;
11971197
}

win32ss/drivers/videoprt/videoprt.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ ULONG NumOfVgaRanges = 0;
5252
static BOOLEAN
5353
IntIsVgaSaveDriverName(_In_ PDRIVER_OBJECT DriverObject)
5454
{
55-
UNICODE_STRING VgaSave = RTL_CONSTANT_STRING(L"\\Driver\\VgaSave");
55+
static const UNICODE_STRING VgaSave = RTL_CONSTANT_STRING(L"\\Driver\\VgaSave");
5656
return RtlEqualUnicodeString(&VgaSave, &DriverObject->DriverName, TRUE);
5757
}
5858

@@ -438,7 +438,7 @@ IntVideoPortFindAdapter(
438438

439439
DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
440440
DeviceExtension->IsVgaDriver = IntIsVgaSaveDriverName(DriverObject);
441-
DeviceExtension->IsVgaDetect = DeviceExtension->IsVgaDriver ? TRUE : FALSE;
441+
DeviceExtension->IsVgaDetect = DeviceExtension->IsVgaDriver;
442442
DeviceExtension->IsLegacyDetect = FALSE;
443443
DeviceExtension->ReportDevice = FALSE;
444444

@@ -487,8 +487,8 @@ IntVideoPortFindAdapter(
487487
}
488488

489489
/* If we already have a VGA miniport and are about to probe for additional adapters,
490-
release its resources temporarily so conflicts are visible during detection.
491-
We'll reclaim them later if no new adapter successfully claims them. */
490+
* release its resources temporarily so conflicts are visible during detection.
491+
* We'll reclaim them later if no new adapter successfully claims them. */
492492
KeWaitForMutexObject(&VgaSyncLock, Executive, KernelMode, FALSE, NULL);
493493
if (VgaDeviceExtension)
494494
{
@@ -630,7 +630,7 @@ IntVideoPortFindAdapter(
630630
DeviceExtension->IsLegacyDetect = FALSE;
631631

632632
/* For legacy (non-PnP) adapters we should report a detected device so that
633-
a PDO exists for higher layers to enumerate consistently (mirrors ScsiPort).*/
633+
* a PDO exists for higher layers to enumerate consistently (mirrors ScsiPort).*/
634634
if (DeviceExtension->IsLegacyDevice && !DeviceExtension->ReportDevice)
635635
{
636636
PDEVICE_OBJECT ReportedPdo = NULL;
@@ -672,7 +672,7 @@ IntVideoPortFindAdapter(
672672
{
673673
/* Another driver has taken VGA resources; drop fallback state */
674674
WARN_(VIDEOPRT, "VGA reclaim failed (vpStatus=0x%X); releasing fallback state\n", vr);
675-
ExFreePool(VgaRanges);
675+
ExFreePoolWithTag(VgaRanges, TAG_VIDEO_PORT);
676676
VgaRanges = NULL;
677677
NumOfVgaRanges = 0;
678678
VgaDeviceExtension = NULL;
@@ -692,7 +692,7 @@ IntVideoPortFindAdapter(
692692
if (DeviceExtension->NextDeviceObject)
693693
IoDetachDevice(DeviceExtension->NextDeviceObject);
694694

695-
/* explicitly reclaim VGA resources on complete failure */
695+
/* Explicitly reclaim VGA resources on complete failure */
696696
if (VgaResourcesReleased)
697697
{
698698
KeWaitForMutexObject(&VgaSyncLock, Executive, KernelMode, FALSE, NULL);

0 commit comments

Comments
 (0)