mirror of
https://github.com/reactos/reactos.git
synced 2024-06-15 09:01:42 +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)
|
||||
+ DeviceNumberString.Length;
|
||||
|
|
|
@ -38,6 +38,7 @@ BOOLEAN VpNoVesa = FALSE;
|
|||
|
||||
PKPROCESS CsrProcess = NULL;
|
||||
static ULONG VideoPortMaxObjectNumber = -1;
|
||||
BOOLEAN VideoPortUseNewKey = FALSE;
|
||||
KMUTEX VideoPortInt10Mutex;
|
||||
KSPIN_LOCK HwResetAdaptersLock;
|
||||
RTL_STATIC_LIST_HEAD(HwResetAdaptersList);
|
||||
|
@ -58,6 +59,7 @@ NTSTATUS
|
|||
IntVideoPortAddDeviceMapLink(
|
||||
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
|
||||
{
|
||||
PUNICODE_STRING RegistryPath;
|
||||
WCHAR DeviceBuffer[20];
|
||||
UNICODE_STRING DeviceName;
|
||||
WCHAR SymlinkBuffer[20];
|
||||
|
@ -69,13 +71,18 @@ IntVideoPortAddDeviceMapLink(
|
|||
DeviceNumber = DeviceExtension->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. */
|
||||
Status = RtlWriteRegistryValue(RTL_REGISTRY_DEVICEMAP,
|
||||
L"VIDEO",
|
||||
DeviceBuffer,
|
||||
REG_SZ,
|
||||
DeviceExtension->NewRegistryPath.Buffer,
|
||||
DeviceExtension->NewRegistryPath.Length + sizeof(UNICODE_NULL));
|
||||
RegistryPath->Buffer,
|
||||
RegistryPath->Length + sizeof(UNICODE_NULL));
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ERR_(VIDEOPRT, "Failed to create DEViCEMAP registry entry: 0x%X\n", Status);
|
||||
|
@ -516,12 +523,28 @@ IntLoadRegistryParameters(VOID)
|
|||
{
|
||||
NTSTATUS Status;
|
||||
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 ValueName = RTL_CONSTANT_STRING(L"SystemStartOptions");
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
PKEY_VALUE_PARTIAL_INFORMATION KeyInfo;
|
||||
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 */
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&Path,
|
||||
|
|
|
@ -249,6 +249,7 @@ IntVideoPortMapPhysicalMemory(
|
|||
|
||||
extern PKPROCESS CsrProcess;
|
||||
extern ULONG VideoPortDeviceNumber;
|
||||
extern BOOLEAN VideoPortUseNewKey;
|
||||
extern KMUTEX VideoPortInt10Mutex;
|
||||
extern KSPIN_LOCK HwResetAdaptersLock;
|
||||
extern LIST_ENTRY HwResetAdaptersList;
|
||||
|
|
Loading…
Reference in a new issue