mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 23:43:08 +00:00
[VIDEOPRT] Fix adapter id
This commit is contained in:
parent
af314557c0
commit
545352c655
4 changed files with 41 additions and 6 deletions
|
@ -346,6 +346,8 @@ IntVideoPortAddDevice(
|
||||||
Status = IntVideoPortCreateAdapterDeviceObject(DriverObject,
|
Status = IntVideoPortCreateAdapterDeviceObject(DriverObject,
|
||||||
DriverExtension,
|
DriverExtension,
|
||||||
PhysicalDeviceObject,
|
PhysicalDeviceObject,
|
||||||
|
DriverExtension->InitializationData.StartingDeviceNumber,
|
||||||
|
0,
|
||||||
&DeviceObject);
|
&DeviceObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "videoprt.h"
|
#include "videoprt.h"
|
||||||
#include <ndk/obfuncs.h>
|
#include <ndk/obfuncs.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
@ -369,6 +370,7 @@ IntCreateNewRegistryPath(
|
||||||
ULONG ResultLength;
|
ULONG ResultLength;
|
||||||
USHORT KeyMaxLength;
|
USHORT KeyMaxLength;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
PWCHAR InstanceIdBuffer;
|
||||||
|
|
||||||
/* Open the hardware key: HKLM\System\CurrentControlSet\Enum\... */
|
/* Open the hardware key: HKLM\System\CurrentControlSet\Enum\... */
|
||||||
Status = IoOpenDeviceRegistryKey(DeviceExtension->PhysicalDeviceObject,
|
Status = IoOpenDeviceRegistryKey(DeviceExtension->PhysicalDeviceObject,
|
||||||
|
@ -476,9 +478,14 @@ IntCreateNewRegistryPath(
|
||||||
|
|
||||||
/* Append a the instance path */ /// \todo HACK
|
/* Append a the instance path */ /// \todo HACK
|
||||||
RtlAppendUnicodeToString(&DeviceExtension->NewRegistryPath, L"\\");
|
RtlAppendUnicodeToString(&DeviceExtension->NewRegistryPath, L"\\");
|
||||||
|
InstanceIdBuffer = DeviceExtension->NewRegistryPath.Buffer +
|
||||||
|
DeviceExtension->NewRegistryPath.Length / sizeof(WCHAR);
|
||||||
RtlAppendUnicodeToString(&DeviceExtension->NewRegistryPath, L"0000");
|
RtlAppendUnicodeToString(&DeviceExtension->NewRegistryPath, L"0000");
|
||||||
|
|
||||||
/* Check this key again */
|
/* Write instance ID */
|
||||||
|
swprintf(InstanceIdBuffer, L"%04u", DeviceExtension->DisplayNumber);
|
||||||
|
|
||||||
|
/* Check if the name exists */
|
||||||
Status = RtlCheckRegistryKey(RTL_REGISTRY_ABSOLUTE,
|
Status = RtlCheckRegistryKey(RTL_REGISTRY_ABSOLUTE,
|
||||||
DeviceExtension->NewRegistryPath.Buffer);
|
DeviceExtension->NewRegistryPath.Buffer);
|
||||||
if (Status != STATUS_SUCCESS)
|
if (Status != STATUS_SUCCESS)
|
||||||
|
@ -521,8 +528,11 @@ IntCreateNewRegistryPath(
|
||||||
|
|
||||||
/* Copy the registry data from the legacy key */
|
/* Copy the registry data from the legacy key */
|
||||||
Status = IntCopyRegistryKey(SettingsKey, NewKey);
|
Status = IntCopyRegistryKey(SettingsKey, NewKey);
|
||||||
}
|
|
||||||
|
|
||||||
|
/* Close the key handles */
|
||||||
|
ObCloseHandle(SettingsKey, KernelMode);
|
||||||
|
ObCloseHandle(NewKey, KernelMode);
|
||||||
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,6 +153,8 @@ IntVideoPortCreateAdapterDeviceObject(
|
||||||
_In_ PDRIVER_OBJECT DriverObject,
|
_In_ PDRIVER_OBJECT DriverObject,
|
||||||
_In_ PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
|
_In_ PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
|
||||||
_In_opt_ PDEVICE_OBJECT PhysicalDeviceObject,
|
_In_opt_ PDEVICE_OBJECT PhysicalDeviceObject,
|
||||||
|
_In_ USHORT AdapterNumber,
|
||||||
|
_In_ USHORT DisplayNumber,
|
||||||
_Out_opt_ PDEVICE_OBJECT *DeviceObject)
|
_Out_opt_ PDEVICE_OBJECT *DeviceObject)
|
||||||
{
|
{
|
||||||
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
|
@ -223,12 +225,14 @@ IntVideoPortCreateAdapterDeviceObject(
|
||||||
DeviceExtension->FunctionalDeviceObject = *DeviceObject;
|
DeviceExtension->FunctionalDeviceObject = *DeviceObject;
|
||||||
DeviceExtension->DriverExtension = DriverExtension;
|
DeviceExtension->DriverExtension = DriverExtension;
|
||||||
DeviceExtension->SessionId = -1;
|
DeviceExtension->SessionId = -1;
|
||||||
|
DeviceExtension->AdapterNumber = AdapterNumber;
|
||||||
|
DeviceExtension->DisplayNumber = DisplayNumber;
|
||||||
|
|
||||||
InitializeListHead(&DeviceExtension->ChildDeviceList);
|
InitializeListHead(&DeviceExtension->ChildDeviceList);
|
||||||
|
|
||||||
/* Get the registry path associated with this device. */
|
/* Get the registry path associated with this device. */
|
||||||
Status = IntCreateRegistryPath(&DriverExtension->RegistryPath,
|
Status = IntCreateRegistryPath(&DriverExtension->RegistryPath,
|
||||||
DriverExtension->InitializationData.StartingDeviceNumber,
|
DeviceExtension->AdapterNumber,
|
||||||
&DeviceExtension->RegistryPath);
|
&DeviceExtension->RegistryPath);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -299,9 +303,16 @@ IntVideoPortCreateAdapterDeviceObject(
|
||||||
*DeviceObject,
|
*DeviceObject,
|
||||||
PhysicalDeviceObject);
|
PhysicalDeviceObject);
|
||||||
|
|
||||||
IntCreateNewRegistryPath(DeviceExtension);
|
Status = IntCreateNewRegistryPath(DeviceExtension);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ERR_(VIDEOPRT, "IntCreateNewRegistryPath() failed with status 0x%08x\n", Status);
|
||||||
|
IoDeleteDevice(*DeviceObject);
|
||||||
|
*DeviceObject = NULL;
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
IntSetupDeviceSettingsKey(DeviceExtension);
|
IntSetupDeviceSettingsKey(DeviceExtension);
|
||||||
DriverExtension->InitializationData.StartingDeviceNumber++;
|
|
||||||
|
|
||||||
/* Remove the initailizing flag */
|
/* Remove the initailizing flag */
|
||||||
(*DeviceObject)->Flags &= ~DO_DEVICE_INITIALIZING;
|
(*DeviceObject)->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||||
|
@ -316,6 +327,11 @@ IntVideoPortCreateAdapterDeviceObject(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DisplayNumber == 0)
|
||||||
|
{
|
||||||
|
DriverExtension->InitializationData.StartingDeviceNumber++;
|
||||||
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -798,6 +814,8 @@ VideoPortInitialize(
|
||||||
Status = IntVideoPortCreateAdapterDeviceObject(DriverObject,
|
Status = IntVideoPortCreateAdapterDeviceObject(DriverObject,
|
||||||
DriverExtension,
|
DriverExtension,
|
||||||
NULL,
|
NULL,
|
||||||
|
DriverExtension->InitializationData.StartingDeviceNumber,
|
||||||
|
0,
|
||||||
&DeviceObject);
|
&DeviceObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,7 +107,10 @@ typedef struct _VIDEO_PORT_DEVICE_EXTENSTION
|
||||||
LIST_ENTRY DmaAdapterList, ChildDeviceList;
|
LIST_ENTRY DmaAdapterList, ChildDeviceList;
|
||||||
LIST_ENTRY HwResetListEntry;
|
LIST_ENTRY HwResetListEntry;
|
||||||
ULONG SessionId;
|
ULONG SessionId;
|
||||||
CHAR MiniPortDeviceExtension[1];
|
USHORT AdapterNumber;
|
||||||
|
USHORT DisplayNumber;
|
||||||
|
ULONG NumberOfSecondaryDisplays;
|
||||||
|
CHAR POINTER_ALIGNMENT MiniPortDeviceExtension[1];
|
||||||
} VIDEO_PORT_DEVICE_EXTENSION, *PVIDEO_PORT_DEVICE_EXTENSION;
|
} VIDEO_PORT_DEVICE_EXTENSION, *PVIDEO_PORT_DEVICE_EXTENSION;
|
||||||
|
|
||||||
typedef struct _VIDEO_PORT_CHILD_EXTENSION
|
typedef struct _VIDEO_PORT_CHILD_EXTENSION
|
||||||
|
@ -260,6 +263,8 @@ IntVideoPortCreateAdapterDeviceObject(
|
||||||
_In_ PDRIVER_OBJECT DriverObject,
|
_In_ PDRIVER_OBJECT DriverObject,
|
||||||
_In_ PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
|
_In_ PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
|
||||||
_In_opt_ PDEVICE_OBJECT PhysicalDeviceObject,
|
_In_opt_ PDEVICE_OBJECT PhysicalDeviceObject,
|
||||||
|
_In_ USHORT AdapterNumber,
|
||||||
|
_In_ USHORT DisplayNumber,
|
||||||
_Out_opt_ PDEVICE_OBJECT *DeviceObject);
|
_Out_opt_ PDEVICE_OBJECT *DeviceObject);
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue