From c2872462a848b46697a025befd3550ac1825f148 Mon Sep 17 00:00:00 2001 From: Vadim Rozenfeld Date: Sun, 7 Sep 2014 21:12:24 +1000 Subject: [PATCH 1/2] read vga and cursor registry parameters --- qxldod/QxlDod.cpp | 63 ++++++++++++++++++++++++++++++++++++++++++---- qxldod/QxlDod.h | 5 +++- qxldod/driver.cpp | 2 +- qxldod/qxldod.inf | Bin 4140 -> 4242 bytes 4 files changed, 63 insertions(+), 7 deletions(-) diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp index 0514643..845341e 100755 --- a/qxldod/QxlDod.cpp +++ b/qxldod/QxlDod.cpp @@ -98,7 +98,8 @@ NTSTATUS QxlDod::CheckHardware() Status = STATUS_GRAPHICS_DRIVER_MISMATCH; if (Header.VendorID == REDHAT_PCI_VENDOR_ID && Header.DeviceID == 0x0100 && - Header.RevisionID == 4) + Header.RevisionID == 4 && + m_VgaCompatible == 0) { Status = STATUS_SUCCESS; } @@ -391,16 +392,18 @@ NTSTATUS QxlDod::QueryAdapterInfo(_In_ CONST DXGKARG_QUERYADAPTERINFO* pQueryAda DXGK_DRIVERCAPS* pDriverCaps = (DXGK_DRIVERCAPS*)pQueryAdapterInfo->pOutputData; - RtlZeroMemory(pDriverCaps, pQueryAdapterInfo->OutputDataSize/*sizeof(DXGK_DRIVERCAPS)*/); + RtlZeroMemory(pDriverCaps, pQueryAdapterInfo->OutputDataSize/*sizeof(DXGK_DRIVERCAPS)*/); pDriverCaps->WDDMVersion = DXGKDDI_WDDMv1_2; pDriverCaps->HighestAcceptableAddress.QuadPart = -1; + pDriverCaps->SupportNonVGA = TRUE; - if (m_pHWDevice->EnablePointer()) { + if (m_pHWDevice->EnablePointer() && m_PointerCaps) { pDriverCaps->MaxPointerWidth = POINTER_SIZE; pDriverCaps->MaxPointerHeight = POINTER_SIZE; - pDriverCaps->PointerCaps.Monochrome = 1; - pDriverCaps->PointerCaps.Color = 1; + pDriverCaps->PointerCaps.Monochrome = m_PointerCaps & 0x00000001; + pDriverCaps->PointerCaps.Color = m_PointerCaps & 0x00000002; + pDriverCaps->PointerCaps.MaskedColor = m_PointerCaps & 0x00000004; } DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s 1\n", __FUNCTION__)); return STATUS_SUCCESS; @@ -1870,6 +1873,56 @@ NTSTATUS QxlDod::RegisterHWInfo() return Status; } +NTSTATUS QxlDod::ReadConfiguration() +{ + PAGED_CODE(); + + NTSTATUS Status; + DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__)); + + HANDLE DevInstRegKeyHandle; + Status = IoOpenDeviceRegistryKey(m_pPhysicalDevice, PLUGPLAY_REGKEY_DRIVER, KEY_SET_VALUE, &DevInstRegKeyHandle); + if (!NT_SUCCESS(Status)) + { + DbgPrint(TRACE_LEVEL_ERROR, ("IoOpenDeviceRegistryKey failed for PDO: 0x%I64x, Status: 0x%I64x", m_pPhysicalDevice, Status)); + return Status; + } + UNICODE_STRING ValueName; + UCHAR Buffer[sizeof(KEY_VALUE_PARTIAL_INFORMATION)+sizeof(ULONG)]; + PKEY_VALUE_PARTIAL_INFORMATION Value = (PKEY_VALUE_PARTIAL_INFORMATION)Buffer; + ULONG ValueLength = sizeof(Buffer); + ULONG ResultLength; + ULONG Length; + + RtlInitUnicodeString(&ValueName, L"VgaCompatible"); + + Status = ZwQueryValueKey(DevInstRegKeyHandle, + &ValueName, + KeyValuePartialInformation, + Value, + ValueLength, + &ResultLength); + + if (NT_SUCCESS(Status)) { + m_VgaCompatible = *(PULONG)(Value->Data); + } + + RtlInitUnicodeString(&ValueName, L"PointerCaps"); + + Status = ZwQueryValueKey(DevInstRegKeyHandle, + &ValueName, + KeyValuePartialInformation, + Value, + ValueLength, + &ResultLength); + + if (NT_SUCCESS(Status)) { + m_PointerCaps = *(PULONG)(Value->Data); + } + + DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__)); + return Status; +} // // Non-Paged Code diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h index ae0b4c0..31145c3 100755 --- a/qxldod/QxlDod.h +++ b/qxldod/QxlDod.h @@ -417,7 +417,7 @@ public: NTSTATUS SetPowerState(DEVICE_POWER_STATE DevicePowerState, DXGK_DISPLAY_INFORMATION* pDispInfo); NTSTATUS HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION* pDispInfo); NTSTATUS HWClose(void); - BOOLEAN EnablePointer(void) { return FALSE; } + BOOLEAN EnablePointer(void) { return TRUE; } NTSTATUS ExecutePresentDisplayOnly(_In_ BYTE* DstAddr, _In_ UINT DstBitPerPixel, _In_ BYTE* SrcAddr, @@ -561,6 +561,8 @@ private: D3DDDI_VIDEO_PRESENT_SOURCE_ID m_SystemDisplaySourceId; DXGKARG_SETPOINTERSHAPE m_PointerShape; HwDeviceIntrface* m_pHWDevice; + DWORD m_VgaCompatible; + DWORD m_PointerCaps; public: QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject); ~QxlDod(void); @@ -679,6 +681,7 @@ private: NTSTATUS IsVidPnSourceModeFieldsValid(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMode) const; NTSTATUS IsVidPnPathFieldsValid(CONST D3DKMDT_VIDPN_PRESENT_PATH* pPath) const; NTSTATUS RegisterHWInfo(); + NTSTATUS ReadConfiguration(); }; NTSTATUS diff --git a/qxldod/driver.cpp b/qxldod/driver.cpp index e8f48f2..48bf346 100755 --- a/qxldod/driver.cpp +++ b/qxldod/driver.cpp @@ -28,7 +28,7 @@ DriverEntry( // Initialize DDI function pointers and dxgkrnl KMDDOD_INITIALIZATION_DATA InitialData = {0}; - InitialData.Version = DXGKDDI_INTERFACE_VERSION; + InitialData.Version = DXGKDDI_INTERFACE_VERSION; InitialData.DxgkDdiAddDevice = DodAddDevice; InitialData.DxgkDdiStartDevice = DodStartDevice; diff --git a/qxldod/qxldod.inf b/qxldod/qxldod.inf index af324eaab23226c8d7100ce947e568a478b878f6..197d6d469b81c551acf420bb4983dfa1b9da353f 100755 GIT binary patch delta 52 zcmZ3ZFiCMk7MHRIgEvDEgANcXFa$8 Date: Sun, 7 Sep 2014 21:13:22 +1000 Subject: [PATCH 2/2] add win8.1 as a build target --- qxldod.sln | 61 +++++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/qxldod.sln b/qxldod.sln index 494614b..14f4cd6 100755 --- a/qxldod.sln +++ b/qxldod.sln @@ -1,6 +1,7 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qxldod", "qxldod\qxldod.vcxproj", "{A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qxldod Package", "qxldod Package\qxldod Package.vcxproj", "{B8C04B51-4207-491D-A7DD-C54861E8B528}" @@ -10,40 +11,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qxldod Package", "qxldod Pa EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Win8.1 Debug|Win32 = Win8.1 Debug|Win32 - Win8.1 Debug|x64 = Win8.1 Debug|x64 - Win8.1 Release|Win32 = Win8.1 Release|Win32 - Win8.1 Release|x64 = Win8.1 Release|x64 Win8 Debug|Win32 = Win8 Debug|Win32 Win8 Debug|x64 = Win8 Debug|x64 Win8 Release|Win32 = Win8 Release|Win32 Win8 Release|x64 = Win8 Release|x64 + Win8.1 Debug|Win32 = Win8.1 Debug|Win32 + Win8.1 Debug|x64 = Win8.1 Debug|x64 + Win8.1 Release|Win32 = Win8.1 Release|Win32 + Win8.1 Release|x64 = Win8.1 Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|Win32.Deploy.0 = Win8.1 Debug|Win32 - {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|x64.Deploy.0 = Win8.1 Debug|x64 - {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|Win32.Deploy.0 = Win8.1 Release|Win32 - {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|x64.Deploy.0 = Win8.1 Release|x64 - {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 - {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 - {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|Win32.Deploy.0 = Win8.1 Debug|Win32 - {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|x64.Deploy.0 = Win8.1 Debug|x64 - {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 - {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 - {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|Win32.Deploy.0 = Win8.1 Release|Win32 - {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|x64.Deploy.0 = Win8.1 Release|x64 {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Debug|Win32.Deploy.0 = Win8 Debug|Win32 @@ -56,6 +33,18 @@ Global {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Release|x64.Build.0 = Win8 Release|x64 {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8 Release|x64.Deploy.0 = Win8 Release|x64 + {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 + {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 + {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|Win32.Deploy.0 = Win8.1 Debug|Win32 + {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 + {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 + {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Debug|x64.Deploy.0 = Win8.1 Debug|x64 + {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 + {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 + {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|Win32.Deploy.0 = Win8.1 Release|Win32 + {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 + {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 + {A6F48FC7-97E9-48EC-BCDF-1E4F9B43AADD}.Win8.1 Release|x64.Deploy.0 = Win8.1 Release|x64 {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Debug|Win32.Deploy.0 = Win8 Debug|Win32 @@ -68,6 +57,18 @@ Global {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Release|x64.Build.0 = Win8 Release|x64 {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8 Release|x64.Deploy.0 = Win8 Release|x64 + {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 + {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 + {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|Win32.Deploy.0 = Win8.1 Debug|Win32 + {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 + {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 + {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Debug|x64.Deploy.0 = Win8.1 Debug|x64 + {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 + {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 + {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|Win32.Deploy.0 = Win8.1 Release|Win32 + {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 + {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 + {B8C04B51-4207-491D-A7DD-C54861E8B528}.Win8.1 Release|x64.Deploy.0 = Win8.1 Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE