https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c05a45e17eda057d8b92b…
commit c05a45e17eda057d8b92ba76feecf3532d8324c1
Author: Oleg Dubinskiy <oleg.dubinskij2013(a)yandex.ua>
AuthorDate: Wed Dec 1 15:28:45 2021 +0000
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Dec 1 18:28:45 2021 +0300
[WIN32K:ENG] Pass correct display name to EngpFindGraphicsDevice (#4128)
It actually should look like '\\.\DISPLAY<n>' (since it comes from user
mode),
which the function expects, and not '\\Device\\Video<n>', like done in
the
kernel mode. Otherwise, passing wrong name causes a mismatch.
Fix the problem with video device access (failure with status 0xc0000022 when
trying to open it). Hence, it also fixes the following debug log spam:
'err: Could not open device \Device\Video0, 0xc0000022'.
Addendum to 77e891b8. CORE-17719 CORE-17786
---
win32ss/gdi/eng/device.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/win32ss/gdi/eng/device.c b/win32ss/gdi/eng/device.c
index 12fbcd0359b..2777143bf9f 100644
--- a/win32ss/gdi/eng/device.c
+++ b/win32ss/gdi/eng/device.c
@@ -36,7 +36,7 @@ NTSTATUS
EngpUpdateGraphicsDeviceList(VOID)
{
ULONG iDevNum, iVGACompatible = -1, ulMaxObjectNumber = 0;
- WCHAR awcDeviceName[20];
+ WCHAR awcDeviceName[20], awcWinDeviceName[20];
UNICODE_STRING ustrDeviceName;
WCHAR awcBuffer[256];
NTSTATUS Status;
@@ -74,7 +74,10 @@ EngpUpdateGraphicsDeviceList(VOID)
{
/* Create the adapter's key name */
swprintf(awcDeviceName, L"\\Device\\Video%lu", iDevNum);
- RtlInitUnicodeString(&ustrDeviceName, awcDeviceName);
+
+ /* Create the display device name */
+ swprintf(awcWinDeviceName, L"\\\\.\\DISPLAY%lu", iDevNum + 1);
+ RtlInitUnicodeString(&ustrDeviceName, awcWinDeviceName);
/* Check if the device exists already */
pGraphicsDevice = EngpFindGraphicsDevice(&ustrDeviceName, iDevNum, 0);