reactos/win32ss/drivers/videoprt/videoprt.h

362 lines
8.3 KiB
C
Raw Normal View History

/*
* VideoPort driver
*
* Copyright (C) 2002, 2003, 2004 ReactOS Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef VIDEOPRT_H
#define VIDEOPRT_H
#include <ntifs.h>
#define __BROKEN__
#include <miniport.h>
#include <video.h>
#include <ntagp.h>
#include <dderror.h>
#include <windef.h>
#include <wdmguid.h>
[WIN32K][VIDEOPRT] Improve initialization and interfacing with INBV. CORE-12149 VIDEOPRT: ========= Improve interfacing with INBV, so as to detect when an external module acquired INBV display ownership, and whether ownership is being released later on. (This does NOT rely on hooking!) For this purpose we improve the IntVideoPortResetDisplayParameters(Ex) callback that gets registered with an InbvNotifyDisplayOwnershipLost() call during initialization, and we add a monitoring thread. The callback is called whenever an external module calls InbvAcquireDisplayOwnership(), for example the bugcheck code or the KDBG debugger in SCREEN mode. When this happens, a flag that tells the monitoring thread to start monitoring INBV is set (ReactOS-specific), and the display adapters get reset with HwResetHw() (as done on Windows). Due to the fact that this INBV callback can be called at *ANY* IRQL, we cannot use dispatcher synchronization mechanisms such as events to tell the INBV monitoring thread to start its operations, so we need to rely instead on a flag to be set. And, since INBV doesn't provide with any proper callback/notification system either, we need to actively monitor its state by pooling. To reduce the load on the system the monitoring thread performs 1-second waits between each check for the flag set by the INBV callback, and during checking the INBV ownership status. When the INBV ownership is detected to be released by an external module, the INBV callback is re-registered (this is *MANDATORY* since the external module has called InbvNotifyDisplayOwnershipLost() with a different callback parameter!), and then we callout to Win32k for re-enabling the display. This has the virtue of correctly resetting the display once the KDBG debugger in SCREEN mode is being exited, and fixes CORE-12149 . The following additional fixes were needed: VIDEOPRT & WIN32K: ================== Remove the registration with INBV that was previously done in a ReactOS- specific hacked IRP_MJ_WRITE call; it is now done correctly during the video device opening done by EngpRegisterGraphicsDevice() in the VIDEOPRT's IRP_MJ_CREATE handler, as done on Windows. WIN32K: ======= - Stub the VideoPortCallout() support, for VIDEOPRT -> WIN32 callbacks. This function gets registered with VIDEOPRT through an IOCTL_VIDEO_INIT_WIN32K_CALLBACKS call in EngpRegisterGraphicsDevice(). - Only partially implement the 'VideoFindAdapterCallout' case, that just re-enables the primary display by refreshing it (using the new function UserRefreshDisplay()). VIDEOPRT: ========= - PVIDEO_WIN32K_CALLOUT is an NTAPI (stdcall) callback. - In the IntVideoPortResetDisplayParameters(Ex) callback, reset all the "resettable" adapters registered in the HwResetAdaptersList list. We thus get rid of the global ResetDisplayParametersDeviceExtension. - Make the IntVideoPortResetDisplayParameters(Ex) callback slightly more robust (using SEH) against potential HwResetListEntry list corruption or invalid DriverExtension->InitializationData.HwResetHw() that would otherwise trigger a BSOD, and this would be disastrous since that callback is precisely called when INBV is acquired, typically when the BSOD code initializes the display for displaying its information... Extras: - Validate the IrpStack->MajorFunction in IntVideoPortDispatchDeviceControl() and implement IRP_MJ_SHUTDOWN handling. Stub out the other IOCTLs that are handled by VIDEOPRT only (and not by the miniports). - VIDEOPRT doesn't require IRP_MJ_INTERNAL_DEVICE_CONTROL (unused). - Implement IOCTL_VIDEO_PREPARE_FOR_EARECOVERY that just resets the display to standard VGA 80x25 text mode.
2019-11-26 01:49:35 +00:00
/* PSEH for SEH Support */
#include <pseh/pseh2.h>
[WIN32K][VIDEOPRT] Improve initialization and interfacing with INBV. CORE-12149 VIDEOPRT: ========= Improve interfacing with INBV, so as to detect when an external module acquired INBV display ownership, and whether ownership is being released later on. (This does NOT rely on hooking!) For this purpose we improve the IntVideoPortResetDisplayParameters(Ex) callback that gets registered with an InbvNotifyDisplayOwnershipLost() call during initialization, and we add a monitoring thread. The callback is called whenever an external module calls InbvAcquireDisplayOwnership(), for example the bugcheck code or the KDBG debugger in SCREEN mode. When this happens, a flag that tells the monitoring thread to start monitoring INBV is set (ReactOS-specific), and the display adapters get reset with HwResetHw() (as done on Windows). Due to the fact that this INBV callback can be called at *ANY* IRQL, we cannot use dispatcher synchronization mechanisms such as events to tell the INBV monitoring thread to start its operations, so we need to rely instead on a flag to be set. And, since INBV doesn't provide with any proper callback/notification system either, we need to actively monitor its state by pooling. To reduce the load on the system the monitoring thread performs 1-second waits between each check for the flag set by the INBV callback, and during checking the INBV ownership status. When the INBV ownership is detected to be released by an external module, the INBV callback is re-registered (this is *MANDATORY* since the external module has called InbvNotifyDisplayOwnershipLost() with a different callback parameter!), and then we callout to Win32k for re-enabling the display. This has the virtue of correctly resetting the display once the KDBG debugger in SCREEN mode is being exited, and fixes CORE-12149 . The following additional fixes were needed: VIDEOPRT & WIN32K: ================== Remove the registration with INBV that was previously done in a ReactOS- specific hacked IRP_MJ_WRITE call; it is now done correctly during the video device opening done by EngpRegisterGraphicsDevice() in the VIDEOPRT's IRP_MJ_CREATE handler, as done on Windows. WIN32K: ======= - Stub the VideoPortCallout() support, for VIDEOPRT -> WIN32 callbacks. This function gets registered with VIDEOPRT through an IOCTL_VIDEO_INIT_WIN32K_CALLBACKS call in EngpRegisterGraphicsDevice(). - Only partially implement the 'VideoFindAdapterCallout' case, that just re-enables the primary display by refreshing it (using the new function UserRefreshDisplay()). VIDEOPRT: ========= - PVIDEO_WIN32K_CALLOUT is an NTAPI (stdcall) callback. - In the IntVideoPortResetDisplayParameters(Ex) callback, reset all the "resettable" adapters registered in the HwResetAdaptersList list. We thus get rid of the global ResetDisplayParametersDeviceExtension. - Make the IntVideoPortResetDisplayParameters(Ex) callback slightly more robust (using SEH) against potential HwResetListEntry list corruption or invalid DriverExtension->InitializationData.HwResetHw() that would otherwise trigger a BSOD, and this would be disastrous since that callback is precisely called when INBV is acquired, typically when the BSOD code initializes the display for displaying its information... Extras: - Validate the IrpStack->MajorFunction in IntVideoPortDispatchDeviceControl() and implement IRP_MJ_SHUTDOWN handling. Stub out the other IOCTLs that are handled by VIDEOPRT only (and not by the miniports). - VIDEOPRT doesn't require IRP_MJ_INTERNAL_DEVICE_CONTROL (unused). - Implement IOCTL_VIDEO_PREPARE_FOR_EARECOVERY that just resets the display to standard VGA 80x25 text mode.
2019-11-26 01:49:35 +00:00
#define TAG_VIDEO_PORT 'PDIV'
#define TAG_VIDEO_PORT_BUFFER '\0mpV'
#define TAG_REQUEST_PACKET 'qRpV'
#define GUID_STRING_LENGTH (38 * sizeof(WCHAR))
typedef struct _VIDEO_PORT_ADDRESS_MAPPING
{
LIST_ENTRY List;
PVOID MappedAddress;
ULONG NumberOfUchars;
PHYSICAL_ADDRESS IoAddress;
ULONG SystemIoBusNumber;
UINT MappingCount;
} VIDEO_PORT_ADDRESS_MAPPING, *PVIDEO_PORT_ADDRESS_MAPPING;
struct _VIDEO_PORT_AGP_VIRTUAL_MAPPING;
typedef struct _VIDEO_PORT_AGP_MAPPING
{
ULONG NumberOfPages;
PVOID MapHandle;
PHYSICAL_ADDRESS PhysicalAddress;
} VIDEO_PORT_AGP_MAPPING, *PVIDEO_PORT_AGP_MAPPING;
typedef struct _VIDEO_PORT_AGP_VIRTUAL_MAPPING
{
PVIDEO_PORT_AGP_MAPPING AgpMapping;
HANDLE ProcessHandle;
PVOID MappedAddress;
} VIDEO_PORT_AGP_VIRTUAL_MAPPING, *PVIDEO_PORT_AGP_VIRTUAL_MAPPING;
typedef struct _VIDEO_PORT_DRIVER_EXTENSION
{
VIDEO_HW_INITIALIZATION_DATA InitializationData;
PVOID HwContext;
UNICODE_STRING RegistryPath;
} VIDEO_PORT_DRIVER_EXTENSION, *PVIDEO_PORT_DRIVER_EXTENSION;
typedef struct _VIDEO_PORT_COMMON_EXTENSION
{
BOOLEAN Fdo;
} VIDEO_PORT_COMMON_EXTENSION, *PVIDEO_PORT_COMMON_EXTENSION;
typedef struct _VIDEO_PORT_DEVICE_EXTENSTION
{
VIDEO_PORT_COMMON_EXTENSION Common;
ULONG DeviceNumber;
PDRIVER_OBJECT DriverObject;
PDEVICE_OBJECT PhysicalDeviceObject;
PDEVICE_OBJECT FunctionalDeviceObject;
PDEVICE_OBJECT NextDeviceObject;
UNICODE_STRING RegistryPath;
UNICODE_STRING NewRegistryPath;
PKINTERRUPT InterruptObject;
KSPIN_LOCK InterruptSpinLock;
PCM_RESOURCE_LIST AllocatedResources;
ULONG InterruptVector;
ULONG InterruptLevel;
BOOLEAN InterruptShared;
INTERFACE_TYPE AdapterInterfaceType;
ULONG SystemIoBusNumber;
ULONG SystemIoSlotNumber;
LIST_ENTRY AddressMappingListHead;
KDPC DpcObject;
VIDEO_PORT_DRIVER_EXTENSION *DriverExtension;
ULONG DeviceOpened;
AGP_BUS_INTERFACE_STANDARD AgpInterface;
KMUTEX DeviceLock;
LIST_ENTRY DmaAdapterList, ChildDeviceList;
[WIN32K][VIDEOPRT] Improve initialization and interfacing with INBV. CORE-12149 VIDEOPRT: ========= Improve interfacing with INBV, so as to detect when an external module acquired INBV display ownership, and whether ownership is being released later on. (This does NOT rely on hooking!) For this purpose we improve the IntVideoPortResetDisplayParameters(Ex) callback that gets registered with an InbvNotifyDisplayOwnershipLost() call during initialization, and we add a monitoring thread. The callback is called whenever an external module calls InbvAcquireDisplayOwnership(), for example the bugcheck code or the KDBG debugger in SCREEN mode. When this happens, a flag that tells the monitoring thread to start monitoring INBV is set (ReactOS-specific), and the display adapters get reset with HwResetHw() (as done on Windows). Due to the fact that this INBV callback can be called at *ANY* IRQL, we cannot use dispatcher synchronization mechanisms such as events to tell the INBV monitoring thread to start its operations, so we need to rely instead on a flag to be set. And, since INBV doesn't provide with any proper callback/notification system either, we need to actively monitor its state by pooling. To reduce the load on the system the monitoring thread performs 1-second waits between each check for the flag set by the INBV callback, and during checking the INBV ownership status. When the INBV ownership is detected to be released by an external module, the INBV callback is re-registered (this is *MANDATORY* since the external module has called InbvNotifyDisplayOwnershipLost() with a different callback parameter!), and then we callout to Win32k for re-enabling the display. This has the virtue of correctly resetting the display once the KDBG debugger in SCREEN mode is being exited, and fixes CORE-12149 . The following additional fixes were needed: VIDEOPRT & WIN32K: ================== Remove the registration with INBV that was previously done in a ReactOS- specific hacked IRP_MJ_WRITE call; it is now done correctly during the video device opening done by EngpRegisterGraphicsDevice() in the VIDEOPRT's IRP_MJ_CREATE handler, as done on Windows. WIN32K: ======= - Stub the VideoPortCallout() support, for VIDEOPRT -> WIN32 callbacks. This function gets registered with VIDEOPRT through an IOCTL_VIDEO_INIT_WIN32K_CALLBACKS call in EngpRegisterGraphicsDevice(). - Only partially implement the 'VideoFindAdapterCallout' case, that just re-enables the primary display by refreshing it (using the new function UserRefreshDisplay()). VIDEOPRT: ========= - PVIDEO_WIN32K_CALLOUT is an NTAPI (stdcall) callback. - In the IntVideoPortResetDisplayParameters(Ex) callback, reset all the "resettable" adapters registered in the HwResetAdaptersList list. We thus get rid of the global ResetDisplayParametersDeviceExtension. - Make the IntVideoPortResetDisplayParameters(Ex) callback slightly more robust (using SEH) against potential HwResetListEntry list corruption or invalid DriverExtension->InitializationData.HwResetHw() that would otherwise trigger a BSOD, and this would be disastrous since that callback is precisely called when INBV is acquired, typically when the BSOD code initializes the display for displaying its information... Extras: - Validate the IrpStack->MajorFunction in IntVideoPortDispatchDeviceControl() and implement IRP_MJ_SHUTDOWN handling. Stub out the other IOCTLs that are handled by VIDEOPRT only (and not by the miniports). - VIDEOPRT doesn't require IRP_MJ_INTERNAL_DEVICE_CONTROL (unused). - Implement IOCTL_VIDEO_PREPARE_FOR_EARECOVERY that just resets the display to standard VGA 80x25 text mode.
2019-11-26 01:49:35 +00:00
LIST_ENTRY HwResetListEntry;
ULONG SessionId;
2021-07-03 20:59:30 +00:00
USHORT AdapterNumber;
USHORT DisplayNumber;
ULONG NumberOfSecondaryDisplays;
CHAR POINTER_ALIGNMENT MiniPortDeviceExtension[1];
} VIDEO_PORT_DEVICE_EXTENSION, *PVIDEO_PORT_DEVICE_EXTENSION;
typedef struct _VIDEO_PORT_CHILD_EXTENSION
{
VIDEO_PORT_COMMON_EXTENSION Common;
ULONG ChildId;
VIDEO_CHILD_TYPE ChildType;
UCHAR ChildDescriptor[256];
BOOLEAN EdidValid;
PDRIVER_OBJECT DriverObject;
PDEVICE_OBJECT PhysicalDeviceObject;
LIST_ENTRY ListEntry;
CHAR ChildDeviceExtension[1];
} VIDEO_PORT_CHILD_EXTENSION, *PVIDEO_PORT_CHILD_EXTENSION;
#define VIDEO_PORT_GET_CHILD_EXTENSION(MiniportExtension) \
CONTAINING_RECORD( \
MiniportExtension, \
VIDEO_PORT_CHILD_EXTENSION, \
ChildDeviceExtension)
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension) \
CONTAINING_RECORD( \
MiniportExtension, \
VIDEO_PORT_DEVICE_EXTENSION, \
MiniPortDeviceExtension)
typedef struct _VIDEO_PORT_EVENT
{
ENG_EVENT;
} VIDEO_PORT_EVENT, *PVIDEO_PORT_EVENT;
/* agp.c */
NTSTATUS
IopInitiatePnpIrp(
PDEVICE_OBJECT DeviceObject,
PIO_STATUS_BLOCK IoStatusBlock,
UCHAR MinorFunction,
PIO_STACK_LOCATION Stack OPTIONAL);
NTSTATUS NTAPI
IntAgpGetInterface(
IN PVOID HwDeviceExtension,
IN OUT PINTERFACE Interface);
/* child.c */
NTSTATUS NTAPI
IntVideoPortDispatchPdoPnp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/* dispatch.c */
NTSTATUS NTAPI
IntVideoPortAddDevice(
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT PhysicalDeviceObject);
NTSTATUS NTAPI
IntVideoPortDispatchOpen(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS NTAPI
IntVideoPortDispatchClose(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS NTAPI
IntVideoPortDispatchCleanup(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS NTAPI
IntVideoPortDispatchDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS NTAPI
IntVideoPortDispatchPnp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS NTAPI
IntVideoPortDispatchPower(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS NTAPI
IntVideoPortDispatchSystemControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
VOID NTAPI
IntVideoPortUnload(PDRIVER_OBJECT DriverObject);
/* timer.c */
BOOLEAN NTAPI
IntVideoPortSetupTimer(
IN PDEVICE_OBJECT DeviceObject,
IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension);
/* interrupt.c */
BOOLEAN NTAPI
IntVideoPortSetupInterrupt(
IN PDEVICE_OBJECT DeviceObject,
IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
IN PVIDEO_PORT_CONFIG_INFO ConfigInfo);
/* resource.c */
NTSTATUS NTAPI
IntVideoPortFilterResourceRequirements(
IN PDEVICE_OBJECT DeviceObject,
IN PIO_STACK_LOCATION IrpStack,
IN PIRP Irp);
NTSTATUS NTAPI
IntVideoPortMapPhysicalMemory(
IN HANDLE Process,
IN PHYSICAL_ADDRESS PhysicalAddress,
IN ULONG SizeInBytes,
IN ULONG Protect,
IN OUT PVOID *VirtualAddress OPTIONAL);
/* videoprt.c */
[WIN32K][VIDEOPRT] Improve initialization and interfacing with INBV. CORE-12149 VIDEOPRT: ========= Improve interfacing with INBV, so as to detect when an external module acquired INBV display ownership, and whether ownership is being released later on. (This does NOT rely on hooking!) For this purpose we improve the IntVideoPortResetDisplayParameters(Ex) callback that gets registered with an InbvNotifyDisplayOwnershipLost() call during initialization, and we add a monitoring thread. The callback is called whenever an external module calls InbvAcquireDisplayOwnership(), for example the bugcheck code or the KDBG debugger in SCREEN mode. When this happens, a flag that tells the monitoring thread to start monitoring INBV is set (ReactOS-specific), and the display adapters get reset with HwResetHw() (as done on Windows). Due to the fact that this INBV callback can be called at *ANY* IRQL, we cannot use dispatcher synchronization mechanisms such as events to tell the INBV monitoring thread to start its operations, so we need to rely instead on a flag to be set. And, since INBV doesn't provide with any proper callback/notification system either, we need to actively monitor its state by pooling. To reduce the load on the system the monitoring thread performs 1-second waits between each check for the flag set by the INBV callback, and during checking the INBV ownership status. When the INBV ownership is detected to be released by an external module, the INBV callback is re-registered (this is *MANDATORY* since the external module has called InbvNotifyDisplayOwnershipLost() with a different callback parameter!), and then we callout to Win32k for re-enabling the display. This has the virtue of correctly resetting the display once the KDBG debugger in SCREEN mode is being exited, and fixes CORE-12149 . The following additional fixes were needed: VIDEOPRT & WIN32K: ================== Remove the registration with INBV that was previously done in a ReactOS- specific hacked IRP_MJ_WRITE call; it is now done correctly during the video device opening done by EngpRegisterGraphicsDevice() in the VIDEOPRT's IRP_MJ_CREATE handler, as done on Windows. WIN32K: ======= - Stub the VideoPortCallout() support, for VIDEOPRT -> WIN32 callbacks. This function gets registered with VIDEOPRT through an IOCTL_VIDEO_INIT_WIN32K_CALLBACKS call in EngpRegisterGraphicsDevice(). - Only partially implement the 'VideoFindAdapterCallout' case, that just re-enables the primary display by refreshing it (using the new function UserRefreshDisplay()). VIDEOPRT: ========= - PVIDEO_WIN32K_CALLOUT is an NTAPI (stdcall) callback. - In the IntVideoPortResetDisplayParameters(Ex) callback, reset all the "resettable" adapters registered in the HwResetAdaptersList list. We thus get rid of the global ResetDisplayParametersDeviceExtension. - Make the IntVideoPortResetDisplayParameters(Ex) callback slightly more robust (using SEH) against potential HwResetListEntry list corruption or invalid DriverExtension->InitializationData.HwResetHw() that would otherwise trigger a BSOD, and this would be disastrous since that callback is precisely called when INBV is acquired, typically when the BSOD code initializes the display for displaying its information... Extras: - Validate the IrpStack->MajorFunction in IntVideoPortDispatchDeviceControl() and implement IRP_MJ_SHUTDOWN handling. Stub out the other IOCTLs that are handled by VIDEOPRT only (and not by the miniports). - VIDEOPRT doesn't require IRP_MJ_INTERNAL_DEVICE_CONTROL (unused). - Implement IOCTL_VIDEO_PREPARE_FOR_EARECOVERY that just resets the display to standard VGA 80x25 text mode.
2019-11-26 01:49:35 +00:00
extern PKPROCESS CsrProcess;
extern ULONG VideoPortDeviceNumber;
extern BOOLEAN VideoPortUseNewKey;
extern KMUTEX VideoPortInt10Mutex;
extern KSPIN_LOCK HwResetAdaptersLock;
[WIN32K][VIDEOPRT] Improve initialization and interfacing with INBV. CORE-12149 VIDEOPRT: ========= Improve interfacing with INBV, so as to detect when an external module acquired INBV display ownership, and whether ownership is being released later on. (This does NOT rely on hooking!) For this purpose we improve the IntVideoPortResetDisplayParameters(Ex) callback that gets registered with an InbvNotifyDisplayOwnershipLost() call during initialization, and we add a monitoring thread. The callback is called whenever an external module calls InbvAcquireDisplayOwnership(), for example the bugcheck code or the KDBG debugger in SCREEN mode. When this happens, a flag that tells the monitoring thread to start monitoring INBV is set (ReactOS-specific), and the display adapters get reset with HwResetHw() (as done on Windows). Due to the fact that this INBV callback can be called at *ANY* IRQL, we cannot use dispatcher synchronization mechanisms such as events to tell the INBV monitoring thread to start its operations, so we need to rely instead on a flag to be set. And, since INBV doesn't provide with any proper callback/notification system either, we need to actively monitor its state by pooling. To reduce the load on the system the monitoring thread performs 1-second waits between each check for the flag set by the INBV callback, and during checking the INBV ownership status. When the INBV ownership is detected to be released by an external module, the INBV callback is re-registered (this is *MANDATORY* since the external module has called InbvNotifyDisplayOwnershipLost() with a different callback parameter!), and then we callout to Win32k for re-enabling the display. This has the virtue of correctly resetting the display once the KDBG debugger in SCREEN mode is being exited, and fixes CORE-12149 . The following additional fixes were needed: VIDEOPRT & WIN32K: ================== Remove the registration with INBV that was previously done in a ReactOS- specific hacked IRP_MJ_WRITE call; it is now done correctly during the video device opening done by EngpRegisterGraphicsDevice() in the VIDEOPRT's IRP_MJ_CREATE handler, as done on Windows. WIN32K: ======= - Stub the VideoPortCallout() support, for VIDEOPRT -> WIN32 callbacks. This function gets registered with VIDEOPRT through an IOCTL_VIDEO_INIT_WIN32K_CALLBACKS call in EngpRegisterGraphicsDevice(). - Only partially implement the 'VideoFindAdapterCallout' case, that just re-enables the primary display by refreshing it (using the new function UserRefreshDisplay()). VIDEOPRT: ========= - PVIDEO_WIN32K_CALLOUT is an NTAPI (stdcall) callback. - In the IntVideoPortResetDisplayParameters(Ex) callback, reset all the "resettable" adapters registered in the HwResetAdaptersList list. We thus get rid of the global ResetDisplayParametersDeviceExtension. - Make the IntVideoPortResetDisplayParameters(Ex) callback slightly more robust (using SEH) against potential HwResetListEntry list corruption or invalid DriverExtension->InitializationData.HwResetHw() that would otherwise trigger a BSOD, and this would be disastrous since that callback is precisely called when INBV is acquired, typically when the BSOD code initializes the display for displaying its information... Extras: - Validate the IrpStack->MajorFunction in IntVideoPortDispatchDeviceControl() and implement IRP_MJ_SHUTDOWN handling. Stub out the other IOCTLs that are handled by VIDEOPRT only (and not by the miniports). - VIDEOPRT doesn't require IRP_MJ_INTERNAL_DEVICE_CONTROL (unused). - Implement IOCTL_VIDEO_PREPARE_FOR_EARECOVERY that just resets the display to standard VGA 80x25 text mode.
2019-11-26 01:49:35 +00:00
extern LIST_ENTRY HwResetAdaptersList;
VOID FASTCALL
IntAttachToCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState);
VOID FASTCALL
IntDetachFromCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState);
NTSTATUS NTAPI
IntVideoPortCreateAdapterDeviceObject(
_In_ PDRIVER_OBJECT DriverObject,
_In_ PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
_In_opt_ PDEVICE_OBJECT PhysicalDeviceObject,
2021-07-03 20:59:30 +00:00
_In_ USHORT AdapterNumber,
_In_ USHORT DisplayNumber,
_Out_opt_ PDEVICE_OBJECT *DeviceObject);
NTSTATUS NTAPI
IntVideoPortFindAdapter(
IN PDRIVER_OBJECT DriverObject,
IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
IN PDEVICE_OBJECT DeviceObject);
PVOID NTAPI
IntVideoPortGetProcAddress(
IN PVOID HwDeviceExtension,
IN PUCHAR FunctionName);
NTSTATUS NTAPI
IntVideoPortEnumerateChildren(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/* int10.c */
NTSTATUS
NTAPI
IntInitializeVideoAddressSpace(VOID);
VP_STATUS NTAPI
IntInt10AllocateBuffer(
IN PVOID Context,
OUT PUSHORT Seg,
OUT PUSHORT Off,
IN OUT PULONG Length);
VP_STATUS NTAPI
IntInt10FreeBuffer(
IN PVOID Context,
IN USHORT Seg,
IN USHORT Off);
VP_STATUS NTAPI
IntInt10ReadMemory(
IN PVOID Context,
IN USHORT Seg,
IN USHORT Off,
OUT PVOID Buffer,
IN ULONG Length);
VP_STATUS NTAPI
IntInt10WriteMemory(
IN PVOID Context,
IN USHORT Seg,
IN USHORT Off,
IN PVOID Buffer,
IN ULONG Length);
VP_STATUS NTAPI
IntInt10CallBios(
IN PVOID Context,
IN OUT PINT10_BIOS_ARGUMENTS BiosArguments);
/* registry.c */
NTSTATUS
NTAPI
IntCopyRegistryKey(
_In_ HANDLE SourceKeyHandle,
_In_ HANDLE DestKeyHandle);
NTSTATUS
NTAPI
IntCopyRegistryValue(
HANDLE SourceKeyHandle,
HANDLE DestKeyHandle,
PWSTR ValueName);
NTSTATUS
NTAPI
IntSetupDeviceSettingsKey(
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension);
NTSTATUS
NTAPI
IntCreateNewRegistryPath(
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension);
NTSTATUS
NTAPI
IntCreateRegistryPath(
IN PCUNICODE_STRING DriverRegistryPath,
IN ULONG DeviceNumber,
OUT PUNICODE_STRING DeviceRegistryPath);
#endif /* VIDEOPRT_H */