https://git.reactos.org/?p=reactos.git;a=commitdiff;h=12ef61ba101100b967935…
commit 12ef61ba101100b9679356ccc2567260f859e7d9
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Thu Nov 10 22:20:46 2022 +0100
Commit: Hervé Poussineau <hpoussin(a)reactos.org>
CommitDate: Tue Nov 15 23:16:10 2022 +0100
[WIN32SS:ENG] Set VGA device as child of primary device
That way, we don't have anymore the VGA device together with primary device in
device list.
Change also EngpUnlinkGraphicsDevice() function to add back VGA device to device list
when removing its parent from device list.
CORE-18522
---
win32ss/gdi/eng/device.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/win32ss/gdi/eng/device.c b/win32ss/gdi/eng/device.c
index 1e2a46a0a17..ed6c00435e2 100644
--- a/win32ss/gdi/eng/device.c
+++ b/win32ss/gdi/eng/device.c
@@ -152,6 +152,10 @@ EngpUnlinkGraphicsDevice(
}
else
{
+ /* At first, link again associated VGA Device */
+ if (pGraphicsDevice->pVgaDevice)
+ EngpLinkGraphicsDevice(pGraphicsDevice->pVgaDevice);
+
/* We need to remove current device */
pGraphicsDevice = pGraphicsDevice->pNextGraphicsDevice;
@@ -247,7 +251,7 @@ EngpUpdateGraphicsDeviceList(VOID)
bFoundNewDevice = TRUE;
/* Set the first one as primary device */
- if (!gpPrimaryGraphicsDevice)
+ if (!gpPrimaryGraphicsDevice || EngpHasVgaDriver(gpPrimaryGraphicsDevice))
{
gpPrimaryGraphicsDevice = pGraphicsDevice;
TRACE("gpPrimaryGraphicsDevice = %p\n", gpPrimaryGraphicsDevice);
@@ -257,6 +261,18 @@ EngpUpdateGraphicsDeviceList(VOID)
/* Close the device map registry key */
ZwClose(hkey);
+ /* Can we link VGA device to primary device? */
+ if (gpPrimaryGraphicsDevice &&
+ gpVgaGraphicsDevice &&
+ gpPrimaryGraphicsDevice != gpVgaGraphicsDevice &&
+ !gpPrimaryGraphicsDevice->pVgaDevice)
+ {
+ /* Yes. Remove VGA device from global list, and attach it to primary device */
+ TRACE("Linking VGA device %S to primary device %S\n",
gpVgaGraphicsDevice->szNtDeviceName, gpPrimaryGraphicsDevice->szNtDeviceName);
+ EngpUnlinkGraphicsDevice(gpVgaGraphicsDevice);
+ gpPrimaryGraphicsDevice->pVgaDevice = gpVgaGraphicsDevice;
+ }
+
if (bFoundNewDevice && gbBaseVideo)
{
PGRAPHICS_DEVICE pToDelete;