[WIN32K] Check if a graphics device already exists before trying to add it

This avoids DPRINTs alleging a failure to open a device.
Also improve another DPRINT.
This commit is contained in:
Timo Kreuzer 2021-07-13 22:24:41 +02:00
parent 39d8a822d2
commit 77e891b8ab
2 changed files with 10 additions and 1 deletions

View file

@ -37,6 +37,7 @@ EngpUpdateGraphicsDeviceList(VOID)
{
ULONG iDevNum, iVGACompatible = -1, ulMaxObjectNumber = 0;
WCHAR awcDeviceName[20];
UNICODE_STRING ustrDeviceName;
WCHAR awcBuffer[256];
NTSTATUS Status;
PGRAPHICS_DEVICE pGraphicsDevice;
@ -73,6 +74,14 @@ EngpUpdateGraphicsDeviceList(VOID)
{
/* Create the adapter's key name */
swprintf(awcDeviceName, L"\\Device\\Video%lu", iDevNum);
RtlInitUnicodeString(&ustrDeviceName, awcDeviceName);
/* Check if the device exists already */
pGraphicsDevice = EngpFindGraphicsDevice(&ustrDeviceName, iDevNum, 0);
if (pGraphicsDevice != NULL)
{
continue;
}
/* Read the reg key name */
cbValue = sizeof(awcBuffer);

View file

@ -257,7 +257,7 @@ UserEnumDisplayDevices(
if (!pGraphicsDevice)
{
/* No device found */
ERR("No GRAPHICS_DEVICE found\n");
ERR("No GRAPHICS_DEVICE found for '%wZ', iDevNum %lu\n", pustrDevice, iDevNum);
return STATUS_UNSUCCESSFUL;
}