mirror of
https://github.com/reactos/reactos.git
synced 2024-06-19 19:28:22 +00:00
[VIDEOPRT] Honour UseNewKey setting in registry
This changes: - which device key is written to DEVICEMAP\Video - which registry key is used in VideoPortSetRegistryParameters() CORE-17896
This commit is contained in:
parent
ff9301e9db
commit
b80d806e05
|
@ -668,7 +668,12 @@ IntCreateRegistryPath(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Valid)
|
if (!VideoPortUseNewKey)
|
||||||
|
{
|
||||||
|
INFO_(VIDEOPRT, "Using old registry key as 'UseNewKey' is FALSE\n");
|
||||||
|
Valid = FALSE;
|
||||||
|
}
|
||||||
|
else if (Valid)
|
||||||
{
|
{
|
||||||
DeviceRegistryPath->MaximumLength = DriverRegistryPath->Length + sizeof(Insert1) + sizeof(Insert2)
|
DeviceRegistryPath->MaximumLength = DriverRegistryPath->Length + sizeof(Insert1) + sizeof(Insert2)
|
||||||
+ DeviceNumberString.Length;
|
+ DeviceNumberString.Length;
|
||||||
|
|
|
@ -38,6 +38,7 @@ BOOLEAN VpNoVesa = FALSE;
|
||||||
|
|
||||||
PKPROCESS CsrProcess = NULL;
|
PKPROCESS CsrProcess = NULL;
|
||||||
static ULONG VideoPortMaxObjectNumber = -1;
|
static ULONG VideoPortMaxObjectNumber = -1;
|
||||||
|
BOOLEAN VideoPortUseNewKey = FALSE;
|
||||||
KMUTEX VideoPortInt10Mutex;
|
KMUTEX VideoPortInt10Mutex;
|
||||||
KSPIN_LOCK HwResetAdaptersLock;
|
KSPIN_LOCK HwResetAdaptersLock;
|
||||||
RTL_STATIC_LIST_HEAD(HwResetAdaptersList);
|
RTL_STATIC_LIST_HEAD(HwResetAdaptersList);
|
||||||
|
@ -58,6 +59,7 @@ NTSTATUS
|
||||||
IntVideoPortAddDeviceMapLink(
|
IntVideoPortAddDeviceMapLink(
|
||||||
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
|
||||||
{
|
{
|
||||||
|
PUNICODE_STRING RegistryPath;
|
||||||
WCHAR DeviceBuffer[20];
|
WCHAR DeviceBuffer[20];
|
||||||
UNICODE_STRING DeviceName;
|
UNICODE_STRING DeviceName;
|
||||||
WCHAR SymlinkBuffer[20];
|
WCHAR SymlinkBuffer[20];
|
||||||
|
@ -69,13 +71,18 @@ IntVideoPortAddDeviceMapLink(
|
||||||
DeviceNumber = DeviceExtension->DeviceNumber;
|
DeviceNumber = DeviceExtension->DeviceNumber;
|
||||||
swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
|
swprintf(DeviceBuffer, L"\\Device\\Video%lu", DeviceNumber);
|
||||||
|
|
||||||
|
if (VideoPortUseNewKey)
|
||||||
|
RegistryPath = &DeviceExtension->NewRegistryPath;
|
||||||
|
else
|
||||||
|
RegistryPath = &DeviceExtension->RegistryPath;
|
||||||
|
|
||||||
/* Add entry to DEVICEMAP\VIDEO key in registry. */
|
/* Add entry to DEVICEMAP\VIDEO key in registry. */
|
||||||
Status = RtlWriteRegistryValue(RTL_REGISTRY_DEVICEMAP,
|
Status = RtlWriteRegistryValue(RTL_REGISTRY_DEVICEMAP,
|
||||||
L"VIDEO",
|
L"VIDEO",
|
||||||
DeviceBuffer,
|
DeviceBuffer,
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
DeviceExtension->NewRegistryPath.Buffer,
|
RegistryPath->Buffer,
|
||||||
DeviceExtension->NewRegistryPath.Length + sizeof(UNICODE_NULL));
|
RegistryPath->Length + sizeof(UNICODE_NULL));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ERR_(VIDEOPRT, "Failed to create DEViCEMAP registry entry: 0x%X\n", Status);
|
ERR_(VIDEOPRT, "Failed to create DEViCEMAP registry entry: 0x%X\n", Status);
|
||||||
|
@ -516,12 +523,28 @@ IntLoadRegistryParameters(VOID)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE KeyHandle;
|
HANDLE KeyHandle;
|
||||||
|
UNICODE_STRING UseNewKeyPath = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\GraphicsDrivers\\UseNewKey");
|
||||||
UNICODE_STRING Path = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control");
|
UNICODE_STRING Path = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control");
|
||||||
UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"SystemStartOptions");
|
UNICODE_STRING ValueName = RTL_CONSTANT_STRING(L"SystemStartOptions");
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
PKEY_VALUE_PARTIAL_INFORMATION KeyInfo;
|
PKEY_VALUE_PARTIAL_INFORMATION KeyInfo;
|
||||||
ULONG Length, NewLength;
|
ULONG Length, NewLength;
|
||||||
|
|
||||||
|
/* Check if we need to use new registry */
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
&UseNewKeyPath,
|
||||||
|
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
Status = ZwOpenKey(&KeyHandle,
|
||||||
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
|
&ObjectAttributes);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
VideoPortUseNewKey = TRUE;
|
||||||
|
ZwClose(KeyHandle);
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize object attributes with the path we want */
|
/* Initialize object attributes with the path we want */
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&Path,
|
&Path,
|
||||||
|
|
|
@ -249,6 +249,7 @@ IntVideoPortMapPhysicalMemory(
|
||||||
|
|
||||||
extern PKPROCESS CsrProcess;
|
extern PKPROCESS CsrProcess;
|
||||||
extern ULONG VideoPortDeviceNumber;
|
extern ULONG VideoPortDeviceNumber;
|
||||||
|
extern BOOLEAN VideoPortUseNewKey;
|
||||||
extern KMUTEX VideoPortInt10Mutex;
|
extern KMUTEX VideoPortInt10Mutex;
|
||||||
extern KSPIN_LOCK HwResetAdaptersLock;
|
extern KSPIN_LOCK HwResetAdaptersLock;
|
||||||
extern LIST_ENTRY HwResetAdaptersList;
|
extern LIST_ENTRY HwResetAdaptersList;
|
||||||
|
|
Loading…
Reference in a new issue