From 6dd94572e5eb4bdfe529c807e341b3c149af5e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Thu, 7 Oct 2021 21:39:06 +0200 Subject: [PATCH] [VBEMP] Correctly report legacy resources (VGA I/O ports and memory) CORE-17789 --- win32ss/drivers/miniport/vbe/vbemp.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/win32ss/drivers/miniport/vbe/vbemp.c b/win32ss/drivers/miniport/vbe/vbemp.c index 68692647f6e..c577902366d 100644 --- a/win32ss/drivers/miniport/vbe/vbemp.c +++ b/win32ss/drivers/miniport/vbe/vbemp.c @@ -36,6 +36,13 @@ #define LOWORD(l) ((USHORT)((ULONG_PTR)(l))) #define HIWORD(l) ((USHORT)(((ULONG_PTR)(l)>>16)&0xFFFF)) +VIDEO_ACCESS_RANGE VBEAccessRange[] = +{ + { {{0x3b0}}, 0x3bb - 0x3b0 + 1, 1, 1, 0 }, + { {{0x3c0}}, 0x3df - 0x3c0 + 1, 1, 1, 0 }, + { {{0xa0000}}, 0x20000, 0, 1, 0 }, +}; + /* PUBLIC AND PRIVATE FUNCTIONS ***********************************************/ ULONG NTAPI @@ -53,6 +60,8 @@ DriverEntry(IN PVOID Context1, IN PVOID Context2) InitData.HwSetPowerState = VBESetPowerState; InitData.HwGetVideoChildDescriptor = VBEGetVideoChildDescriptor; InitData.HwDeviceExtensionSize = sizeof(VBE_DEVICE_EXTENSION); + InitData.HwLegacyResourceList = VBEAccessRange; + InitData.HwLegacyResourceCount = ARRAYSIZE(VBEAccessRange); return VideoPortInitialize(Context1, Context2, &InitData, NULL); } @@ -76,8 +85,11 @@ VBEFindAdapter( if (VideoPortIsNoVesa()) return ERROR_DEV_NOT_EXIST; - ConfigInfo->VdmPhysicalVideoMemoryAddress.QuadPart = 0xa000; - ConfigInfo->VdmPhysicalVideoMemoryLength = 0x2000; + if (ConfigInfo->Length < sizeof(VIDEO_PORT_CONFIG_INFO)) + return ERROR_INVALID_PARAMETER; + + ConfigInfo->VdmPhysicalVideoMemoryAddress = VBEAccessRange[2].RangeStart; + ConfigInfo->VdmPhysicalVideoMemoryLength = VBEAccessRange[2].RangeLength; return NO_ERROR; }