mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 00:48:23 -06:00
Add InteractivityOneCore/RendererWddmCon projects (#13007)
`InteractivityOneCore` and `RendererWddmCon` were the last two remaining projects which are relevant for our internal console builds, but couldn't be easily compiled publicly by users on GitHub. This commit adds all definitions required to compile the two projects into dysfunctional libraries at least. (Since the added definitions are deliberately incorrect.) Additionally this commit fixes the AuditMode build for the two projects. ## Validation Steps Performed The two new projects compile fine.
This commit is contained in:
parent
223af3a54a
commit
eb5c26cc69
5
.github/actions/spelling/expect/expect.txt
vendored
5
.github/actions/spelling/expect/expect.txt
vendored
@ -1064,6 +1064,7 @@ ico
|
||||
IComponent
|
||||
ICONERROR
|
||||
Iconified
|
||||
iconify
|
||||
Iconify
|
||||
ICONINFORMATION
|
||||
IConsole
|
||||
@ -2748,8 +2749,8 @@ windowsapp
|
||||
windowsdeveloper
|
||||
windowsinternalstring
|
||||
WINDOWSIZE
|
||||
windowsx
|
||||
windowsterminal
|
||||
windowsx
|
||||
WINDOWTEXT
|
||||
windowtheme
|
||||
WINDOWTITLE
|
||||
@ -2887,12 +2888,12 @@ XTest
|
||||
XTPOPSGR
|
||||
XTPUSHSGR
|
||||
xtr
|
||||
XTWINOPS
|
||||
xunit
|
||||
xutr
|
||||
xvalue
|
||||
XVIRTUALSCREEN
|
||||
XWalk
|
||||
XTWINOPS
|
||||
Xzn
|
||||
yact
|
||||
YAML
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29001.49
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.2.32422.2
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Terminal", "Terminal", "{59840756-302F-44DF-AA47-441A9D673202}"
|
||||
EndProject
|
||||
@ -406,6 +406,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{61901E80
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RendererAtlas", "src\renderer\atlas\atlas.vcxproj", "{8222900C-8B6C-452A-91AC-BE95DB04B95F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InteractivityOneCore", "src\interactivity\onecore\lib\onecore.LIB.vcxproj", "{06EC74CB-9A12-428C-B551-8537EC964726}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RendererWddmCon", "src\renderer\wddmcon\lib\wddmcon.vcxproj", "{75C6F576-18E9-4566-978A-F0A301CAC090}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
AuditMode|Any CPU = AuditMode|Any CPU
|
||||
@ -3375,6 +3379,76 @@ Global
|
||||
{8222900C-8B6C-452A-91AC-BE95DB04B95F}.Release|x64.Build.0 = Release|x64
|
||||
{8222900C-8B6C-452A-91AC-BE95DB04B95F}.Release|x86.ActiveCfg = Release|Win32
|
||||
{8222900C-8B6C-452A-91AC-BE95DB04B95F}.Release|x86.Build.0 = Release|Win32
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|Any CPU.ActiveCfg = AuditMode|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|ARM.ActiveCfg = AuditMode|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|DotNet_x64Test.ActiveCfg = AuditMode|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|DotNet_x86Test.ActiveCfg = AuditMode|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|x64.ActiveCfg = AuditMode|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|x64.Build.0 = AuditMode|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.AuditMode|x86.ActiveCfg = AuditMode|Win32
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|ARM.ActiveCfg = Debug|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|DotNet_x64Test.ActiveCfg = Debug|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|DotNet_x86Test.ActiveCfg = Debug|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|x64.Build.0 = Debug|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Debug|x86.Build.0 = Debug|Win32
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Fuzzing|Any CPU.ActiveCfg = Fuzzing|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Fuzzing|ARM.ActiveCfg = Fuzzing|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Fuzzing|ARM64.ActiveCfg = Fuzzing|ARM64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Fuzzing|DotNet_x64Test.ActiveCfg = Fuzzing|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Fuzzing|DotNet_x86Test.ActiveCfg = Fuzzing|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Fuzzing|x64.ActiveCfg = Fuzzing|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Fuzzing|x86.ActiveCfg = Fuzzing|Win32
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|ARM.ActiveCfg = Release|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|DotNet_x64Test.ActiveCfg = Release|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|DotNet_x86Test.ActiveCfg = Release|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|x64.ActiveCfg = Release|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|x64.Build.0 = Release|x64
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|x86.ActiveCfg = Release|Win32
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726}.Release|x86.Build.0 = Release|Win32
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.AuditMode|Any CPU.ActiveCfg = AuditMode|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.AuditMode|ARM.ActiveCfg = AuditMode|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.AuditMode|DotNet_x64Test.ActiveCfg = AuditMode|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.AuditMode|DotNet_x86Test.ActiveCfg = AuditMode|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.AuditMode|x64.ActiveCfg = AuditMode|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.AuditMode|x86.ActiveCfg = AuditMode|Win32
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|ARM.ActiveCfg = Debug|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|DotNet_x64Test.ActiveCfg = Debug|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|DotNet_x86Test.ActiveCfg = Debug|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|x64.Build.0 = Debug|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Debug|x86.Build.0 = Debug|Win32
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|Any CPU.ActiveCfg = Fuzzing|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|ARM.ActiveCfg = Fuzzing|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|ARM64.ActiveCfg = Fuzzing|ARM64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|DotNet_x64Test.ActiveCfg = Fuzzing|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|DotNet_x86Test.ActiveCfg = Fuzzing|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|x64.ActiveCfg = Fuzzing|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|x64.Build.0 = Fuzzing|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Fuzzing|x86.ActiveCfg = Fuzzing|Win32
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|ARM.ActiveCfg = Release|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|DotNet_x64Test.ActiveCfg = Release|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|DotNet_x86Test.ActiveCfg = Release|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|x64.ActiveCfg = Release|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|x64.Build.0 = Release|x64
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|x86.ActiveCfg = Release|Win32
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -3476,6 +3550,8 @@ Global
|
||||
{9CF74355-F018-4C19-81AD-9DC6B7F2C6F5} = {89CDCC5C-9F53-4054-97A4-639D99F169CD}
|
||||
{61901E80-E97D-4D61-A9BB-E8F2FDA8B40C} = {59840756-302F-44DF-AA47-441A9D673202}
|
||||
{8222900C-8B6C-452A-91AC-BE95DB04B95F} = {05500DEF-2294-41E3-AF9A-24E580B82836}
|
||||
{06EC74CB-9A12-428C-B551-8537EC964726} = {E8F24881-5E37-4362-B191-A3BA0ED7F4EB}
|
||||
{75C6F576-18E9-4566-978A-F0A301CAC090} = {05500DEF-2294-41E3-AF9A-24E580B82836}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3140B1B7-C8EE-43D1-A772-D82A7061A271}
|
||||
|
||||
76
dep/Console/ConIoSrv.h
Normal file
76
dep/Console/ConIoSrv.h
Normal file
@ -0,0 +1,76 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT license.
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ntlpcapi.h>
|
||||
|
||||
#define CIS_ALPC_PORT_NAME L""
|
||||
|
||||
#define CIS_EVENT_TYPE_INPUT (0)
|
||||
#define CIS_EVENT_TYPE_FOCUS (1)
|
||||
#define CIS_EVENT_TYPE_FOCUS_ACK (2)
|
||||
|
||||
#define CIS_MSG_TYPE_GETDISPLAYSIZE (3)
|
||||
#define CIS_MSG_TYPE_GETFONTSIZE (4)
|
||||
#define CIS_MSG_TYPE_SETCURSOR (5)
|
||||
#define CIS_MSG_TYPE_UPDATEDISPLAY (6)
|
||||
|
||||
#define CIS_MSG_ATTR_FLAGS (0)
|
||||
|
||||
#define CIS_MSG_ATTR_BUFFER_SIZE (1024)
|
||||
|
||||
#define CIS_DISPLAY_MODE_NONE (0)
|
||||
#define CIS_DISPLAY_MODE_BGFX (1)
|
||||
#define CIS_DISPLAY_MODE_DIRECTX (2)
|
||||
|
||||
typedef struct {
|
||||
PORT_MESSAGE AlpcHeader;
|
||||
UCHAR Type;
|
||||
|
||||
union {
|
||||
struct {
|
||||
CD_IO_DISPLAY_SIZE DisplaySize;
|
||||
|
||||
NTSTATUS ReturnValue;
|
||||
} GetDisplaySizeParams;
|
||||
|
||||
struct {
|
||||
CD_IO_FONT_SIZE FontSize;
|
||||
|
||||
NTSTATUS ReturnValue;
|
||||
} GetFontSizeParams;
|
||||
|
||||
struct {
|
||||
CD_IO_CURSOR_INFORMATION CursorInformation;
|
||||
|
||||
NTSTATUS ReturnValue;
|
||||
} SetCursorParams;
|
||||
|
||||
struct {
|
||||
SHORT RowIndex;
|
||||
|
||||
NTSTATUS ReturnValue;
|
||||
} UpdateDisplayParams;
|
||||
|
||||
struct {
|
||||
USHORT DisplayMode;
|
||||
} GetDisplayModeParams;
|
||||
};
|
||||
} CIS_MSG, *PCIS_MSG;
|
||||
|
||||
typedef struct {
|
||||
UCHAR Type;
|
||||
|
||||
union {
|
||||
struct {
|
||||
INPUT_RECORD Record;
|
||||
} InputEvent;
|
||||
|
||||
struct {
|
||||
BOOLEAN IsActive;
|
||||
} FocusEvent;
|
||||
};
|
||||
} CIS_EVENT, *PCIS_EVENT;
|
||||
@ -158,8 +158,8 @@ typedef struct _CD_IO_DISPLAY_SIZE {
|
||||
} CD_IO_DISPLAY_SIZE, *PCD_IO_DISPLAY_SIZE;
|
||||
|
||||
typedef struct _CD_IO_CHARACTER {
|
||||
WCHAR Character;
|
||||
USHORT Atribute;
|
||||
WCHAR Character;
|
||||
USHORT Attribute;
|
||||
} CD_IO_CHARACTER, *PCD_IO_CHARACTER;
|
||||
|
||||
typedef struct _CD_IO_ROW_INFORMATION {
|
||||
@ -175,6 +175,11 @@ typedef struct _CD_IO_CURSOR_INFORMATION {
|
||||
BOOLEAN IsVisible;
|
||||
} CD_IO_CURSOR_INFORMATION, *PCD_IO_CURSOR_INFORMATION;
|
||||
|
||||
typedef struct _CD_IO_FONT_SIZE {
|
||||
ULONG Width;
|
||||
ULONG Height;
|
||||
} CD_IO_FONT_SIZE, *PCD_IO_FONT_SIZE;
|
||||
|
||||
#define IOCTL_CONDRV_READ_IO \
|
||||
CTL_CODE(FILE_DEVICE_CONSOLE, 1, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
|
||||
|
||||
@ -213,3 +218,6 @@ typedef struct _CD_IO_CURSOR_INFORMATION {
|
||||
|
||||
#define IOCTL_CONDRV_LAUNCH_SERVER \
|
||||
CTL_CODE(FILE_DEVICE_CONSOLE, 13, METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
|
||||
#define IOCTL_CONDRV_GET_FONT_SIZE \
|
||||
CTL_CODE(FILE_DEVICE_CONSOLE, 14, METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
|
||||
24
dep/Console/csrmsg.h
Normal file
24
dep/Console/csrmsg.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT license.
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ntcsrmsg.h>
|
||||
|
||||
typedef enum _USER_API_NUMBER {
|
||||
UserpEndTask,
|
||||
} USER_API_NUMBER, *PUSER_API_NUMBER;
|
||||
|
||||
typedef struct _ENDTASKMSG {
|
||||
HANDLE ProcessId;
|
||||
ULONG ConsoleEventCode;
|
||||
ULONG ConsoleFlags;
|
||||
} ENDTASKMSG, *PENDTASKMSG;
|
||||
|
||||
typedef struct _USER_API_MSG {
|
||||
union {
|
||||
ENDTASKMSG EndTask;
|
||||
} u;
|
||||
} USER_API_MSG, *PUSER_API_MSG;
|
||||
15
dep/Console/ntcsrdll.h
Normal file
15
dep/Console/ntcsrdll.h
Normal file
@ -0,0 +1,15 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT license.
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ntcsrmsg.h>
|
||||
|
||||
NTSTATUS CsrClientCallServer(
|
||||
PCSR_API_MSG m,
|
||||
PCSR_CAPTURE_HEADER CaptureBuffer OPTIONAL,
|
||||
ULONG ApiNumber,
|
||||
ULONG ArgLength
|
||||
);
|
||||
16
dep/Console/ntcsrmsg.h
Normal file
16
dep/Console/ntcsrmsg.h
Normal file
@ -0,0 +1,16 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT license.
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ntlpcapi.h>
|
||||
|
||||
typedef struct _CSR_CAPTURE_HEADER {
|
||||
} CSR_CAPTURE_HEADER, *PCSR_CAPTURE_HEADER;
|
||||
|
||||
typedef struct _CSR_API_MSG {
|
||||
} CSR_API_MSG, *PCSR_API_MSG;
|
||||
|
||||
#define CSR_MAKE_API_NUMBER(DllIndex, ApiIndex) 0
|
||||
126
dep/Console/ntlpcapi.h
Normal file
126
dep/Console/ntlpcapi.h
Normal file
@ -0,0 +1,126 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT license.
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define OB_FILE_OBJECT_TYPE 1
|
||||
|
||||
typedef struct _PORT_MESSAGE {
|
||||
union {
|
||||
struct {
|
||||
SHORT DataLength;
|
||||
SHORT TotalLength;
|
||||
} s1;
|
||||
} u1;
|
||||
union {
|
||||
ULONG ZeroInit;
|
||||
} u2;
|
||||
union {
|
||||
CLIENT_ID ClientId;
|
||||
};
|
||||
ULONG MessageId;
|
||||
} PORT_MESSAGE, *PPORT_MESSAGE;
|
||||
|
||||
#define ALPC_MSGFLG_SYNC_REQUEST 0
|
||||
#define ALPC_PORFLG_ACCEPT_DUP_HANDLES 1
|
||||
#define ALPC_PORFLG_ACCEPT_INDIRECT_HANDLES 2
|
||||
|
||||
typedef struct _ALPC_DATA_VIEW_ATTR {
|
||||
PVOID ViewBase;
|
||||
SIZE_T ViewSize;
|
||||
} ALPC_DATA_VIEW_ATTR, *PALPC_DATA_VIEW_ATTR;
|
||||
|
||||
typedef struct _ALPC_CONTEXT_ATTR {
|
||||
} ALPC_CONTEXT_ATTR, *PALPC_CONTEXT_ATTR;
|
||||
|
||||
#define ALPC_INDIRECT_HANDLE_MAX 512
|
||||
|
||||
typedef struct _ALPC_HANDLE_ATTR {
|
||||
union {
|
||||
ULONG HandleCount;
|
||||
};
|
||||
} ALPC_HANDLE_ATTR, *PALPC_HANDLE_ATTR;
|
||||
|
||||
#define ALPC_FLG_MSG_DATAVIEW_ATTR 1
|
||||
#define ALPC_FLG_MSG_HANDLE_ATTR 2
|
||||
|
||||
typedef struct _ALPC_MESSAGE_ATTRIBUTES {
|
||||
} ALPC_MESSAGE_ATTRIBUTES, *PALPC_MESSAGE_ATTRIBUTES;
|
||||
|
||||
typedef struct _ALPC_PORT_ATTRIBUTES {
|
||||
ULONG Flags;
|
||||
SECURITY_QUALITY_OF_SERVICE SecurityQos;
|
||||
SIZE_T MaxMessageLength;
|
||||
SIZE_T MemoryBandwidth;
|
||||
SIZE_T MaxPoolUsage;
|
||||
SIZE_T MaxSectionSize;
|
||||
SIZE_T MaxViewSize;
|
||||
SIZE_T MaxTotalSectionSize;
|
||||
ULONG DupObjectTypes;
|
||||
#ifdef _WIN64
|
||||
ULONG Reserved;
|
||||
#endif
|
||||
} ALPC_PORT_ATTRIBUTES, *PALPC_PORT_ATTRIBUTES;
|
||||
|
||||
typedef enum _ALPC_MESSAGE_INFORMATION_CLASS {
|
||||
AlpcMessageHandleInformation
|
||||
} ALPC_MESSAGE_INFORMATION_CLASS;
|
||||
|
||||
typedef struct _ALPC_MESSAGE_HANDLE_INFORMATION {
|
||||
ULONG Index;
|
||||
ULONG Handle;
|
||||
} ALPC_MESSAGE_HANDLE_INFORMATION, *PALPC_MESSAGE_HANDLE_INFORMATION;
|
||||
|
||||
NTSTATUS AlpcInitializeMessageAttribute(
|
||||
ULONG AttributeFlags,
|
||||
PALPC_MESSAGE_ATTRIBUTES Buffer,
|
||||
SIZE_T BufferSize,
|
||||
PSIZE_T RequiredBufferSize
|
||||
);
|
||||
|
||||
PVOID AlpcGetMessageAttribute(
|
||||
PALPC_MESSAGE_ATTRIBUTES Buffer,
|
||||
ULONG AttributeFlag
|
||||
);
|
||||
|
||||
#define ALPC_GET_DATAVIEW_ATTRIBUTES(MsgAttr) \
|
||||
((PALPC_DATA_VIEW_ATTR)AlpcGetMessageAttribute(MsgAttr, ALPC_FLG_MSG_DATAVIEW_ATTR))
|
||||
|
||||
#define ALPC_GET_HANDLE_ATTRIBUTES(MsgAttr) \
|
||||
((PALPC_HANDLE_ATTR)AlpcGetMessageAttribute(MsgAttr, ALPC_FLG_MSG_HANDLE_ATTR))
|
||||
|
||||
NTSTATUS NtAlpcConnectPort(
|
||||
PHANDLE PortHandle,
|
||||
PUNICODE_STRING PortName,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
PALPC_PORT_ATTRIBUTES PortAttributes,
|
||||
ULONG Flags,
|
||||
PSID RequiredServerSid,
|
||||
PPORT_MESSAGE ConnectionMessage,
|
||||
PSIZE_T BufferLength,
|
||||
PALPC_MESSAGE_ATTRIBUTES OutMessageAttributes,
|
||||
PALPC_MESSAGE_ATTRIBUTES InMessageAttributes,
|
||||
PLARGE_INTEGER Timeout
|
||||
);
|
||||
|
||||
NTSTATUS NtAlpcSendWaitReceivePort(
|
||||
HANDLE PortHandle,
|
||||
ULONG Flags,
|
||||
PPORT_MESSAGE SendMessage,
|
||||
PALPC_MESSAGE_ATTRIBUTES SendMessageAttributes,
|
||||
PPORT_MESSAGE ReceiveMessage,
|
||||
PSIZE_T BufferLength,
|
||||
PALPC_MESSAGE_ATTRIBUTES ReceiveMessageAttributes,
|
||||
PLARGE_INTEGER Timeout
|
||||
);
|
||||
|
||||
NTSTATUS NtAlpcQueryInformationMessage(
|
||||
HANDLE PortHandle,
|
||||
PPORT_MESSAGE PortMessage,
|
||||
ALPC_MESSAGE_INFORMATION_CLASS MessageInformationClass,
|
||||
PVOID MessageInformation,
|
||||
ULONG Length,
|
||||
PULONG ReturnLength
|
||||
);
|
||||
@ -15,11 +15,12 @@ and it's easier to include a copy of the infrequently changing defs here.
|
||||
|
||||
#ifndef _DDK_INCLUDED
|
||||
|
||||
extern "C" {
|
||||
|
||||
#pragma region wdm.h(public DDK)
|
||||
//
|
||||
// Define the base asynchronous I/O argument types
|
||||
//
|
||||
extern "C" {
|
||||
|
||||
//
|
||||
// ClientId
|
||||
@ -92,17 +93,50 @@ typedef CONST OBJECT_ATTRIBUTES* PCOBJECT_ATTRIBUTES;
|
||||
//--
|
||||
|
||||
#define InitializeObjectAttributes(p, n, a, r, s) \
|
||||
do \
|
||||
{ \
|
||||
(p)->Length = sizeof(OBJECT_ATTRIBUTES); \
|
||||
(p)->RootDirectory = r; \
|
||||
(p)->Attributes = a; \
|
||||
(p)->ObjectName = n; \
|
||||
(p)->SecurityDescriptor = s; \
|
||||
(p)->SecurityQualityOfService = NULL; \
|
||||
}
|
||||
(p)->SecurityQualityOfService = nullptr; \
|
||||
} while (0)
|
||||
|
||||
// UNICODE_STRING
|
||||
|
||||
extern "C++" {
|
||||
char _RTL_CONSTANT_STRING_type_check(const char* s);
|
||||
char _RTL_CONSTANT_STRING_type_check(const WCHAR* s);
|
||||
|
||||
template<size_t N>
|
||||
class _RTL_CONSTANT_STRING_remove_const_template_class;
|
||||
|
||||
template<>
|
||||
class _RTL_CONSTANT_STRING_remove_const_template_class<sizeof(char)>
|
||||
{
|
||||
public:
|
||||
typedef char T;
|
||||
};
|
||||
|
||||
template<>
|
||||
class _RTL_CONSTANT_STRING_remove_const_template_class<sizeof(WCHAR)>
|
||||
{
|
||||
public:
|
||||
typedef WCHAR T;
|
||||
};
|
||||
|
||||
#define _RTL_CONSTANT_STRING_remove_const_macro(s) \
|
||||
(const_cast<_RTL_CONSTANT_STRING_remove_const_template_class<sizeof((s)[0])>::T*>(s))
|
||||
|
||||
#define RTL_CONSTANT_STRING(s) \
|
||||
{ \
|
||||
sizeof(s) - sizeof((s)[0]), \
|
||||
sizeof(s) / sizeof(_RTL_CONSTANT_STRING_type_check(s)), \
|
||||
_RTL_CONSTANT_STRING_remove_const_macro(s) \
|
||||
}
|
||||
}
|
||||
|
||||
// OBJ_CASE_INSENSITIVE
|
||||
// OBJ_INHERIT
|
||||
// InitializeObjectAttributes
|
||||
@ -197,12 +231,11 @@ typedef struct _FILE_FS_DEVICE_INFORMATION
|
||||
#define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
|
||||
|
||||
#pragma endregion
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region ntifs.h(public DDK)
|
||||
|
||||
extern "C" {
|
||||
#define RtlOffsetToPointer(B, O) ((PCHAR)(((PCHAR)(B)) + ((ULONG_PTR)(O))))
|
||||
|
||||
__kernel_entry NTSYSCALLAPI
|
||||
@ -214,8 +247,12 @@ __kernel_entry NTSYSCALLAPI
|
||||
_Out_writes_bytes_(Length) PVOID FsInformation,
|
||||
_In_ ULONG Length,
|
||||
_In_ FS_INFORMATION_CLASS FsInformationClass);
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
// InteractivityOneCore depends on this private function. The IsPresent checks
|
||||
// are automatically generated by forwarder.template and aren't part of the DDK.
|
||||
// I've placed it here because I couldn't come up with a better place.
|
||||
BOOL IsGetSystemMetricsPresent();
|
||||
}
|
||||
#endif // _DDK_INCLUDED
|
||||
|
||||
@ -27,7 +27,7 @@ namespace Microsoft::Console::Interactivity
|
||||
CaretVisible
|
||||
};
|
||||
|
||||
virtual ~IAccessibilityNotifier() = 0;
|
||||
virtual ~IAccessibilityNotifier() = default;
|
||||
|
||||
virtual void NotifyConsoleCaretEvent(_In_ RECT rectangle) = 0;
|
||||
virtual void NotifyConsoleCaretEvent(_In_ ConsoleCaretEventFlags flags, _In_ LONG position) = 0;
|
||||
@ -37,13 +37,5 @@ namespace Microsoft::Console::Interactivity
|
||||
virtual void NotifyConsoleLayoutEvent() = 0;
|
||||
virtual void NotifyConsoleStartApplicationEvent(_In_ DWORD processId) = 0;
|
||||
virtual void NotifyConsoleEndApplicationEvent(_In_ DWORD processId) = 0;
|
||||
|
||||
protected:
|
||||
IAccessibilityNotifier() {}
|
||||
|
||||
IAccessibilityNotifier(const IAccessibilityNotifier&) = delete;
|
||||
IAccessibilityNotifier& operator=(const IAccessibilityNotifier&) = delete;
|
||||
};
|
||||
|
||||
inline IAccessibilityNotifier::~IAccessibilityNotifier() {}
|
||||
}
|
||||
|
||||
@ -20,17 +20,9 @@ namespace Microsoft::Console::Interactivity
|
||||
class IConsoleControl
|
||||
{
|
||||
public:
|
||||
virtual ~IConsoleControl() = 0;
|
||||
virtual ~IConsoleControl() = default;
|
||||
[[nodiscard]] virtual NTSTATUS NotifyConsoleApplication(DWORD dwProcessId) = 0;
|
||||
[[nodiscard]] virtual NTSTATUS SetForeground(HANDLE hProcess, BOOL fForeground) = 0;
|
||||
[[nodiscard]] virtual NTSTATUS EndTask(HANDLE hProcessId, DWORD dwEventType, ULONG ulCtrlFlags) = 0;
|
||||
|
||||
protected:
|
||||
IConsoleControl() {}
|
||||
|
||||
IConsoleControl(const IConsoleControl&) = delete;
|
||||
IConsoleControl& operator=(const IConsoleControl&) = delete;
|
||||
};
|
||||
|
||||
inline IConsoleControl::~IConsoleControl() {}
|
||||
}
|
||||
|
||||
@ -20,11 +20,11 @@ namespace Microsoft::Console::Interactivity
|
||||
class IConsoleInputThread
|
||||
{
|
||||
public:
|
||||
virtual ~IConsoleInputThread() = 0;
|
||||
virtual ~IConsoleInputThread() = default;
|
||||
virtual HANDLE Start() = 0;
|
||||
|
||||
HANDLE GetHandle() { return _hThread; }
|
||||
DWORD GetThreadId() { return _dwThreadId; }
|
||||
HANDLE GetHandle() noexcept { return _hThread; }
|
||||
DWORD GetThreadId() noexcept { return _dwThreadId; }
|
||||
|
||||
protected:
|
||||
// Prevent accidental copies.
|
||||
@ -32,7 +32,7 @@ namespace Microsoft::Console::Interactivity
|
||||
IConsoleInputThread& operator=(const IConsoleInputThread&) = delete;
|
||||
|
||||
// .ctor
|
||||
IConsoleInputThread() :
|
||||
IConsoleInputThread() noexcept :
|
||||
_hThread(nullptr),
|
||||
_dwThreadId(gsl::narrow_cast<DWORD>(-1)) {}
|
||||
|
||||
@ -40,6 +40,4 @@ namespace Microsoft::Console::Interactivity
|
||||
HANDLE _hThread;
|
||||
DWORD _dwThreadId;
|
||||
};
|
||||
|
||||
inline IConsoleInputThread::~IConsoleInputThread() {}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ namespace Microsoft::Console::Types
|
||||
class IConsoleWindow
|
||||
{
|
||||
public:
|
||||
virtual ~IConsoleWindow() = 0;
|
||||
virtual ~IConsoleWindow() = default;
|
||||
|
||||
virtual BOOL EnableBothScrollBars() = 0;
|
||||
virtual int UpdateScrollBar(_In_ bool isVertical,
|
||||
@ -69,6 +69,4 @@ namespace Microsoft::Console::Types
|
||||
[[nodiscard]] virtual HRESULT UiaSetTextAreaFocus() = 0;
|
||||
virtual RECT GetWindowRect() const noexcept = 0;
|
||||
};
|
||||
|
||||
inline IConsoleWindow::~IConsoleWindow() {}
|
||||
}
|
||||
|
||||
@ -22,14 +22,6 @@ namespace Microsoft::Console::Interactivity
|
||||
virtual BOOL SetProcessDpiAwarenessContext() = 0;
|
||||
[[nodiscard]] virtual HRESULT SetProcessPerMonitorDpiAwareness() = 0;
|
||||
|
||||
virtual ~IHighDpiApi() = 0;
|
||||
|
||||
protected:
|
||||
IHighDpiApi() {}
|
||||
|
||||
IHighDpiApi(const IHighDpiApi&) = delete;
|
||||
IHighDpiApi& operator=(const IHighDpiApi&) = delete;
|
||||
virtual ~IHighDpiApi() = default;
|
||||
};
|
||||
|
||||
inline IHighDpiApi::~IHighDpiApi() {}
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ namespace Microsoft::Console::Interactivity
|
||||
class IInteractivityFactory
|
||||
{
|
||||
public:
|
||||
virtual ~IInteractivityFactory() = 0;
|
||||
virtual ~IInteractivityFactory() = default;
|
||||
[[nodiscard]] virtual NTSTATUS CreateConsoleControl(_Inout_ std::unique_ptr<IConsoleControl>& control) = 0;
|
||||
[[nodiscard]] virtual NTSTATUS CreateConsoleInputThread(_Inout_ std::unique_ptr<IConsoleInputThread>& thread) = 0;
|
||||
|
||||
@ -43,6 +43,4 @@ namespace Microsoft::Console::Interactivity
|
||||
virtual void SetPseudoWindowCallback(std::function<void(bool)> func) = 0;
|
||||
[[nodiscard]] virtual NTSTATUS CreatePseudoWindow(HWND& hwnd, const HWND owner) = 0;
|
||||
};
|
||||
|
||||
inline IInteractivityFactory::~IInteractivityFactory() {}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ namespace Microsoft::Console::Interactivity
|
||||
class ISystemConfigurationProvider
|
||||
{
|
||||
public:
|
||||
virtual ~ISystemConfigurationProvider() = 0;
|
||||
virtual ~ISystemConfigurationProvider() = default;
|
||||
|
||||
virtual bool IsCaretBlinkingEnabled() = 0;
|
||||
|
||||
@ -37,13 +37,5 @@ namespace Microsoft::Console::Interactivity
|
||||
_Inout_ PDWORD pdwTitleLength,
|
||||
_In_ PCWSTR pwszCurrDir,
|
||||
_In_ PCWSTR pwszAppName) = 0;
|
||||
|
||||
protected:
|
||||
ISystemConfigurationProvider(){};
|
||||
|
||||
ISystemConfigurationProvider(const ISystemConfigurationProvider&) = delete;
|
||||
ISystemConfigurationProvider& operator=(const ISystemConfigurationProvider&) = delete;
|
||||
};
|
||||
|
||||
inline ISystemConfigurationProvider::~ISystemConfigurationProvider() {}
|
||||
}
|
||||
|
||||
@ -20,16 +20,8 @@ namespace Microsoft::Console::Interactivity
|
||||
class IWindowMetrics
|
||||
{
|
||||
public:
|
||||
virtual ~IWindowMetrics() = 0;
|
||||
virtual ~IWindowMetrics() = default;
|
||||
virtual RECT GetMinClientRectInPixels() = 0;
|
||||
virtual RECT GetMaxClientRectInPixels() = 0;
|
||||
|
||||
protected:
|
||||
IWindowMetrics() {}
|
||||
|
||||
IWindowMetrics(const IWindowMetrics&) = delete;
|
||||
IWindowMetrics& operator=(const IWindowMetrics&) = delete;
|
||||
};
|
||||
|
||||
inline IWindowMetrics::~IWindowMetrics() {}
|
||||
}
|
||||
|
||||
@ -7,34 +7,34 @@
|
||||
|
||||
using namespace Microsoft::Console::Interactivity::OneCore;
|
||||
|
||||
void AccessibilityNotifier::NotifyConsoleCaretEvent(_In_ RECT /*rectangle*/)
|
||||
void AccessibilityNotifier::NotifyConsoleCaretEvent(_In_ RECT /*rectangle*/) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
void AccessibilityNotifier::NotifyConsoleCaretEvent(_In_ ConsoleCaretEventFlags /*flags*/, _In_ LONG /*position*/)
|
||||
void AccessibilityNotifier::NotifyConsoleCaretEvent(_In_ ConsoleCaretEventFlags /*flags*/, _In_ LONG /*position*/) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
void AccessibilityNotifier::NotifyConsoleUpdateScrollEvent(_In_ LONG /*x*/, _In_ LONG /*y*/)
|
||||
void AccessibilityNotifier::NotifyConsoleUpdateScrollEvent(_In_ LONG /*x*/, _In_ LONG /*y*/) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
void AccessibilityNotifier::NotifyConsoleUpdateSimpleEvent(_In_ LONG /*start*/, _In_ LONG /*charAndAttribute*/)
|
||||
void AccessibilityNotifier::NotifyConsoleUpdateSimpleEvent(_In_ LONG /*start*/, _In_ LONG /*charAndAttribute*/) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
void AccessibilityNotifier::NotifyConsoleUpdateRegionEvent(_In_ LONG /*startXY*/, _In_ LONG /*endXY*/)
|
||||
void AccessibilityNotifier::NotifyConsoleUpdateRegionEvent(_In_ LONG /*startXY*/, _In_ LONG /*endXY*/) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
void AccessibilityNotifier::NotifyConsoleLayoutEvent()
|
||||
void AccessibilityNotifier::NotifyConsoleLayoutEvent() noexcept
|
||||
{
|
||||
}
|
||||
|
||||
void AccessibilityNotifier::NotifyConsoleStartApplicationEvent(_In_ DWORD /*processId*/)
|
||||
void AccessibilityNotifier::NotifyConsoleStartApplicationEvent(_In_ DWORD /*processId*/) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
void AccessibilityNotifier::NotifyConsoleEndApplicationEvent(_In_ DWORD /*processId*/)
|
||||
void AccessibilityNotifier::NotifyConsoleEndApplicationEvent(_In_ DWORD /*processId*/) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
@ -20,16 +20,16 @@ Author(s):
|
||||
|
||||
namespace Microsoft::Console::Interactivity::OneCore
|
||||
{
|
||||
class AccessibilityNotifier sealed : public IAccessibilityNotifier
|
||||
class AccessibilityNotifier : public IAccessibilityNotifier
|
||||
{
|
||||
public:
|
||||
void NotifyConsoleCaretEvent(_In_ RECT rectangle);
|
||||
void NotifyConsoleCaretEvent(_In_ ConsoleCaretEventFlags flags, _In_ LONG position);
|
||||
void NotifyConsoleUpdateScrollEvent(_In_ LONG x, _In_ LONG y);
|
||||
void NotifyConsoleUpdateSimpleEvent(_In_ LONG start, _In_ LONG charAndAttribute);
|
||||
void NotifyConsoleUpdateRegionEvent(_In_ LONG startXY, _In_ LONG endXY);
|
||||
void NotifyConsoleLayoutEvent();
|
||||
void NotifyConsoleStartApplicationEvent(_In_ DWORD processId);
|
||||
void NotifyConsoleEndApplicationEvent(_In_ DWORD processId);
|
||||
void NotifyConsoleCaretEvent(_In_ RECT rectangle) noexcept override;
|
||||
void NotifyConsoleCaretEvent(_In_ ConsoleCaretEventFlags flags, _In_ LONG position) noexcept override;
|
||||
void NotifyConsoleUpdateScrollEvent(_In_ LONG x, _In_ LONG y) noexcept override;
|
||||
void NotifyConsoleUpdateSimpleEvent(_In_ LONG start, _In_ LONG charAndAttribute) noexcept override;
|
||||
void NotifyConsoleUpdateRegionEvent(_In_ LONG startXY, _In_ LONG endXY) noexcept override;
|
||||
void NotifyConsoleLayoutEvent() noexcept override;
|
||||
void NotifyConsoleStartApplicationEvent(_In_ DWORD processId) noexcept override;
|
||||
void NotifyConsoleEndApplicationEvent(_In_ DWORD processId) noexcept override;
|
||||
};
|
||||
}
|
||||
|
||||
@ -20,17 +20,17 @@ using namespace Microsoft::Console::Render;
|
||||
using namespace Microsoft::Console::Interactivity;
|
||||
using namespace Microsoft::Console::Interactivity::OneCore;
|
||||
|
||||
BgfxEngine::BgfxEngine(PVOID SharedViewBase, LONG DisplayHeight, LONG DisplayWidth, LONG FontWidth, LONG FontHeight) :
|
||||
BgfxEngine::BgfxEngine(PVOID SharedViewBase, LONG DisplayHeight, LONG DisplayWidth, LONG FontWidth, LONG FontHeight) noexcept :
|
||||
RenderEngineBase(),
|
||||
_sharedViewBase((ULONG_PTR)SharedViewBase),
|
||||
_displayHeight(DisplayHeight),
|
||||
_displayWidth(DisplayWidth),
|
||||
_sharedViewBase(static_cast<std::byte*>(SharedViewBase)),
|
||||
_displayHeight(gsl::narrow_cast<SIZE_T>(DisplayHeight)),
|
||||
_displayWidth(gsl::narrow_cast<SIZE_T>(DisplayWidth)),
|
||||
_currentLegacyColorAttribute(DEFAULT_COLOR_ATTRIBUTE)
|
||||
{
|
||||
_runLength = sizeof(CD_IO_CHARACTER) * DisplayWidth;
|
||||
|
||||
_fontSize.X = FontWidth > SHORT_MAX ? SHORT_MAX : (SHORT)FontWidth;
|
||||
_fontSize.Y = FontHeight > SHORT_MAX ? SHORT_MAX : (SHORT)FontHeight;
|
||||
_fontSize.X = FontWidth > SHORT_MAX ? SHORT_MAX : gsl::narrow_cast<SHORT>(FontWidth);
|
||||
_fontSize.Y = FontHeight > SHORT_MAX ? SHORT_MAX : gsl::narrow_cast<SHORT>(FontHeight);
|
||||
}
|
||||
|
||||
[[nodiscard]] HRESULT BgfxEngine::Invalidate(const SMALL_RECT* const /*psrRegion*/) noexcept
|
||||
@ -75,26 +75,23 @@ BgfxEngine::BgfxEngine(PVOID SharedViewBase, LONG DisplayHeight, LONG DisplayWid
|
||||
}
|
||||
|
||||
[[nodiscard]] HRESULT BgfxEngine::EndPaint() noexcept
|
||||
try
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
PVOID OldRunBase;
|
||||
PVOID NewRunBase;
|
||||
|
||||
Status = ConIoSrvComm::GetConIoSrvComm()->RequestUpdateDisplay(0);
|
||||
const auto Status = ConIoSrvComm::GetConIoSrvComm()->RequestUpdateDisplay(0);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
for (SHORT i = 0; i < _displayHeight; i++)
|
||||
for (SIZE_T i = 0; i < _displayHeight; i++)
|
||||
{
|
||||
OldRunBase = (PVOID)(_sharedViewBase + (i * 2 * _runLength));
|
||||
NewRunBase = (PVOID)(_sharedViewBase + (i * 2 * _runLength) + _runLength);
|
||||
const auto OldRunBase = _sharedViewBase + (i * 2 * _runLength);
|
||||
const auto NewRunBase = OldRunBase + _runLength;
|
||||
memcpy_s(OldRunBase, _runLength, NewRunBase, _runLength);
|
||||
}
|
||||
}
|
||||
|
||||
return HRESULT_FROM_NT(Status);
|
||||
}
|
||||
CATCH_RETURN()
|
||||
|
||||
// Routine Description:
|
||||
// - Used to perform longer running presentation steps outside the lock so the other threads can continue.
|
||||
@ -115,21 +112,11 @@ BgfxEngine::BgfxEngine(PVOID SharedViewBase, LONG DisplayHeight, LONG DisplayWid
|
||||
|
||||
[[nodiscard]] HRESULT BgfxEngine::PaintBackground() noexcept
|
||||
{
|
||||
PVOID OldRunBase;
|
||||
PVOID NewRunBase;
|
||||
|
||||
PCD_IO_CHARACTER OldRun;
|
||||
PCD_IO_CHARACTER NewRun;
|
||||
|
||||
for (SHORT i = 0; i < _displayHeight; i++)
|
||||
for (SIZE_T i = 0; i < _displayHeight; i++)
|
||||
{
|
||||
OldRunBase = (PVOID)(_sharedViewBase + (i * 2 * _runLength));
|
||||
NewRunBase = (PVOID)(_sharedViewBase + (i * 2 * _runLength) + _runLength);
|
||||
const auto NewRun = reinterpret_cast<PCD_IO_CHARACTER>(_sharedViewBase + (i * 2 * _runLength) + _runLength);
|
||||
|
||||
OldRun = (PCD_IO_CHARACTER)OldRunBase;
|
||||
NewRun = (PCD_IO_CHARACTER)NewRunBase;
|
||||
|
||||
for (SHORT j = 0; j < _displayWidth; j++)
|
||||
for (SIZE_T j = 0; j < _displayWidth; j++)
|
||||
{
|
||||
NewRun[j].Character = L' ';
|
||||
NewRun[j].Attribute = 0;
|
||||
@ -146,10 +133,10 @@ BgfxEngine::BgfxEngine(PVOID SharedViewBase, LONG DisplayHeight, LONG DisplayWid
|
||||
{
|
||||
try
|
||||
{
|
||||
PVOID NewRunBase = (PVOID)(_sharedViewBase + (coord.Y * 2 * _runLength) + _runLength);
|
||||
PCD_IO_CHARACTER NewRun = (PCD_IO_CHARACTER)NewRunBase;
|
||||
const auto y = gsl::narrow_cast<SIZE_T>(coord.Y);
|
||||
const auto NewRun = reinterpret_cast<PCD_IO_CHARACTER>(_sharedViewBase + (y * 2 * _runLength) + _runLength);
|
||||
|
||||
for (size_t i = 0; i < clusters.size() && i < (size_t)_displayWidth; i++)
|
||||
for (SIZE_T i = 0; i < clusters.size() && i < _displayWidth; i++)
|
||||
{
|
||||
NewRun[coord.X + i].Character = til::at(clusters, i).GetTextAsSingle();
|
||||
NewRun[coord.X + i].Attribute = _currentLegacyColorAttribute;
|
||||
@ -157,7 +144,7 @@ BgfxEngine::BgfxEngine(PVOID SharedViewBase, LONG DisplayHeight, LONG DisplayWid
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
CATCH_RETURN();
|
||||
CATCH_RETURN()
|
||||
}
|
||||
|
||||
[[nodiscard]] HRESULT BgfxEngine::PaintBufferGridLines(GridLineSet const /*lines*/,
|
||||
@ -174,6 +161,7 @@ BgfxEngine::BgfxEngine(PVOID SharedViewBase, LONG DisplayHeight, LONG DisplayWid
|
||||
}
|
||||
|
||||
[[nodiscard]] HRESULT BgfxEngine::PaintCursor(const CursorOptions& options) noexcept
|
||||
try
|
||||
{
|
||||
// TODO: MSFT: 11448021 - Modify BGFX to support rendering full-width
|
||||
// characters and a full-width cursor.
|
||||
@ -183,10 +171,11 @@ BgfxEngine::BgfxEngine(PVOID SharedViewBase, LONG DisplayHeight, LONG DisplayWid
|
||||
CursorInfo.Height = options.ulCursorHeightPercent;
|
||||
CursorInfo.IsVisible = TRUE;
|
||||
|
||||
NTSTATUS Status = ConIoSrvComm::GetConIoSrvComm()->RequestSetCursor(&CursorInfo);
|
||||
const auto Status = ConIoSrvComm::GetConIoSrvComm()->RequestSetCursor(&CursorInfo);
|
||||
|
||||
return HRESULT_FROM_NT(Status);
|
||||
}
|
||||
CATCH_RETURN()
|
||||
|
||||
[[nodiscard]] HRESULT BgfxEngine::UpdateDrawingBrushes(const TextAttribute& textAttributes,
|
||||
const RenderSettings& /*renderSettings*/,
|
||||
@ -228,8 +217,8 @@ BgfxEngine::BgfxEngine(PVOID SharedViewBase, LONG DisplayHeight, LONG DisplayWid
|
||||
|
||||
[[nodiscard]] HRESULT BgfxEngine::GetDirtyArea(gsl::span<const til::rect>& area) noexcept
|
||||
{
|
||||
_dirtyArea.bottom = std::max<LONG>(0, _displayHeight);
|
||||
_dirtyArea.right = std::max<LONG>(0, _displayWidth);
|
||||
_dirtyArea.bottom = gsl::narrow_cast<til::CoordType>(std::max(static_cast<SIZE_T>(0), _displayHeight));
|
||||
_dirtyArea.right = gsl::narrow_cast<til::CoordType>(std::max(static_cast<SIZE_T>(0), _displayWidth));
|
||||
|
||||
area = { &_dirtyArea,
|
||||
1 };
|
||||
|
||||
@ -29,8 +29,7 @@ namespace Microsoft::Console::Render
|
||||
class BgfxEngine final : public RenderEngineBase
|
||||
{
|
||||
public:
|
||||
BgfxEngine(PVOID SharedViewBase, LONG DisplayHeight, LONG DisplayWidth, LONG FontWidth, LONG FontHeight);
|
||||
~BgfxEngine() override = default;
|
||||
BgfxEngine(PVOID SharedViewBase, LONG DisplayHeight, LONG DisplayWidth, LONG FontWidth, LONG FontHeight) noexcept;
|
||||
|
||||
// IRenderEngine Members
|
||||
[[nodiscard]] HRESULT Invalidate(const SMALL_RECT* const psrRegion) noexcept override;
|
||||
@ -76,11 +75,11 @@ namespace Microsoft::Console::Render
|
||||
[[nodiscard]] HRESULT _DoUpdateTitle(_In_ const std::wstring_view newTitle) noexcept override;
|
||||
|
||||
private:
|
||||
ULONG_PTR _sharedViewBase;
|
||||
std::byte* _sharedViewBase;
|
||||
SIZE_T _runLength;
|
||||
|
||||
LONG _displayHeight;
|
||||
LONG _displayWidth;
|
||||
SIZE_T _displayHeight;
|
||||
SIZE_T _displayWidth;
|
||||
til::rect _dirtyArea;
|
||||
|
||||
COORD _fontSize;
|
||||
|
||||
@ -27,9 +27,9 @@ using namespace Microsoft::Console::Interactivity::OneCore;
|
||||
static std::unique_ptr<ConIoSrvComm> s_conIoSrvComm;
|
||||
ConIoSrvComm* ConIoSrvComm::GetConIoSrvComm()
|
||||
{
|
||||
static bool initialized = []() {
|
||||
static auto initialized = []() {
|
||||
s_conIoSrvComm = std::make_unique<ConIoSrvComm>();
|
||||
ServiceLocator::SetOneCoreTeardownFunction([] {
|
||||
ServiceLocator::SetOneCoreTeardownFunction([]() noexcept {
|
||||
s_conIoSrvComm.reset(nullptr);
|
||||
});
|
||||
return true;
|
||||
@ -37,16 +37,15 @@ ConIoSrvComm* ConIoSrvComm::GetConIoSrvComm()
|
||||
return s_conIoSrvComm.get();
|
||||
}
|
||||
|
||||
ConIoSrvComm::ConIoSrvComm() :
|
||||
ConIoSrvComm::ConIoSrvComm() noexcept :
|
||||
_inputPipeThreadHandle(nullptr),
|
||||
_pipeReadHandle(INVALID_HANDLE_VALUE),
|
||||
_pipeWriteHandle(INVALID_HANDLE_VALUE),
|
||||
_alpcClientCommunicationPort(INVALID_HANDLE_VALUE),
|
||||
_alpcSharedViewSize(0),
|
||||
_alpcSharedViewBase(NULL),
|
||||
_alpcSharedViewBase(nullptr),
|
||||
_displayMode(CIS_DISPLAY_MODE_NONE),
|
||||
_fIsInputInitialized(false),
|
||||
pWddmConEngine(nullptr)
|
||||
_fIsInputInitialized(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -55,6 +54,7 @@ ConIoSrvComm::~ConIoSrvComm()
|
||||
// Cancel pending IOs on the input thread that might get us stuck.
|
||||
if (_inputPipeThreadHandle)
|
||||
{
|
||||
#pragma warning(suppress : 26447)
|
||||
LOG_IF_WIN32_BOOL_FALSE(CancelSynchronousIo(_inputPipeThreadHandle));
|
||||
CloseHandle(_inputPipeThreadHandle);
|
||||
_inputPipeThreadHandle = nullptr;
|
||||
@ -84,8 +84,6 @@ ConIoSrvComm::~ConIoSrvComm()
|
||||
|
||||
[[nodiscard]] NTSTATUS ConIoSrvComm::Connect()
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
// Port handle and name.
|
||||
HANDLE PortHandle;
|
||||
static UNICODE_STRING PortName = RTL_CONSTANT_STRING(CIS_ALPC_PORT_NAME);
|
||||
@ -101,29 +99,25 @@ ConIoSrvComm::~ConIoSrvComm()
|
||||
|
||||
// Connection message attributes.
|
||||
SIZE_T ConnectionMessageAttributesBufferLength;
|
||||
UCHAR ConnectionMessageAttributesBuffer[CIS_MSG_ATTR_BUFFER_SIZE];
|
||||
|
||||
// Type-specific pointers into the connection message attributes.
|
||||
PALPC_HANDLE_ATTR HandleAttributes;
|
||||
PALPC_DATA_VIEW_ATTR ViewAttributes;
|
||||
std::aligned_storage_t<CIS_MSG_ATTR_BUFFER_SIZE, alignof(ALPC_MESSAGE_ATTRIBUTES)> ConnectionMessageAttributesBuffer;
|
||||
|
||||
// Structure used to iterate over the handles given to us by the server.
|
||||
ALPC_MESSAGE_HANDLE_INFORMATION HandleInfo;
|
||||
|
||||
// Initialize the attributes of the port object.
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
nullptr,
|
||||
nullptr);
|
||||
|
||||
// Initialize the connection message attributes.
|
||||
PALPC_MESSAGE_ATTRIBUTES ConnectionMessageAttributes = (PALPC_MESSAGE_ATTRIBUTES)&ConnectionMessageAttributesBuffer;
|
||||
const auto ConnectionMessageAttributes = reinterpret_cast<PALPC_MESSAGE_ATTRIBUTES>(&ConnectionMessageAttributesBuffer);
|
||||
|
||||
Status = AlpcInitializeMessageAttribute(CIS_MSG_ATTR_FLAGS,
|
||||
ConnectionMessageAttributes,
|
||||
CIS_MSG_ATTR_BUFFER_SIZE,
|
||||
&ConnectionMessageAttributesBufferLength);
|
||||
auto Status = AlpcInitializeMessageAttribute(CIS_MSG_ATTR_FLAGS,
|
||||
ConnectionMessageAttributes,
|
||||
CIS_MSG_ATTR_BUFFER_SIZE,
|
||||
&ConnectionMessageAttributesBufferLength);
|
||||
|
||||
// Set up the default security QoS descriptor.
|
||||
const SECURITY_QUALITY_OF_SERVICE DefaultQoS = {
|
||||
@ -152,26 +146,26 @@ ConIoSrvComm::~ConIoSrvComm()
|
||||
ConnectionMessage.AlpcHeader.u1.s1.TotalLength = sizeof(CIS_MSG);
|
||||
ConnectionMessage.AlpcHeader.u1.s1.DataLength = sizeof(CIS_MSG) - sizeof(PORT_MESSAGE);
|
||||
|
||||
ConnectionMessage.AlpcHeader.ClientId.UniqueProcess = 0;
|
||||
ConnectionMessage.AlpcHeader.ClientId.UniqueThread = 0;
|
||||
ConnectionMessage.AlpcHeader.ClientId.UniqueProcess = nullptr;
|
||||
ConnectionMessage.AlpcHeader.ClientId.UniqueThread = nullptr;
|
||||
|
||||
// Request to connect to the server.
|
||||
ConnectionMessageLength = sizeof(CIS_MSG);
|
||||
Status = NtAlpcConnectPort(&PortHandle,
|
||||
&PortName,
|
||||
NULL,
|
||||
nullptr,
|
||||
&PortAttributes,
|
||||
ALPC_MSGFLG_SYNC_REQUEST,
|
||||
NULL,
|
||||
(PPORT_MESSAGE)&ConnectionMessage,
|
||||
nullptr,
|
||||
&ConnectionMessage.AlpcHeader,
|
||||
&ConnectionMessageLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
ConnectionMessageAttributes,
|
||||
0);
|
||||
nullptr);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
ViewAttributes = ALPC_GET_DATAVIEW_ATTRIBUTES(ConnectionMessageAttributes);
|
||||
HandleAttributes = ALPC_GET_HANDLE_ATTRIBUTES(ConnectionMessageAttributes);
|
||||
const auto ViewAttributes = ALPC_GET_DATAVIEW_ATTRIBUTES(ConnectionMessageAttributes);
|
||||
const auto HandleAttributes = ALPC_GET_HANDLE_ATTRIBUTES(ConnectionMessageAttributes);
|
||||
|
||||
// We must have exactly two handles, one for read, and one for write for
|
||||
// the pipe.
|
||||
@ -189,11 +183,11 @@ ConIoSrvComm::~ConIoSrvComm()
|
||||
HandleInfo.Index = Index;
|
||||
|
||||
Status = NtAlpcQueryInformationMessage(PortHandle,
|
||||
(PPORT_MESSAGE)&ConnectionMessage,
|
||||
&ConnectionMessage.AlpcHeader,
|
||||
AlpcMessageHandleInformation,
|
||||
&HandleInfo,
|
||||
sizeof(HandleInfo),
|
||||
NULL);
|
||||
nullptr);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
if (Index == 0)
|
||||
@ -253,17 +247,15 @@ VOID ConIoSrvComm::ServiceInputPipe()
|
||||
FALSE,
|
||||
DUPLICATE_SAME_ACCESS));
|
||||
|
||||
BOOL Ret;
|
||||
|
||||
CIS_EVENT Event = { 0 };
|
||||
CIS_EVENT Event{};
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
Ret = ReadFile(_pipeReadHandle,
|
||||
&Event,
|
||||
sizeof(CIS_EVENT),
|
||||
NULL,
|
||||
NULL);
|
||||
const auto Ret = ReadFile(_pipeReadHandle,
|
||||
&Event,
|
||||
sizeof(CIS_EVENT),
|
||||
nullptr,
|
||||
nullptr);
|
||||
|
||||
if (Ret != FALSE)
|
||||
{
|
||||
@ -273,8 +265,8 @@ VOID ConIoSrvComm::ServiceInputPipe()
|
||||
case CIS_EVENT_TYPE_INPUT:
|
||||
try
|
||||
{
|
||||
KEY_EVENT_RECORD keyRecord = Event.InputEvent.Record.Event.KeyEvent;
|
||||
KeyEvent keyEvent{ keyRecord };
|
||||
const auto keyRecord = Event.InputEvent.Record.Event.KeyEvent;
|
||||
const KeyEvent keyEvent{ keyRecord };
|
||||
HandleGenericKeyEvent(keyEvent, false);
|
||||
}
|
||||
catch (...)
|
||||
@ -282,10 +274,11 @@ VOID ConIoSrvComm::ServiceInputPipe()
|
||||
LOG_HR(wil::ResultFromCaughtException());
|
||||
}
|
||||
break;
|
||||
|
||||
case CIS_EVENT_TYPE_FOCUS:
|
||||
HandleFocusEvent(&Event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
UnlockConsole();
|
||||
}
|
||||
@ -299,38 +292,34 @@ VOID ConIoSrvComm::ServiceInputPipe()
|
||||
|
||||
[[nodiscard]] NTSTATUS ConIoSrvComm::SendRequestReceiveReply(PCIS_MSG Message) const
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
Message->AlpcHeader.MessageId = 0;
|
||||
Message->AlpcHeader.u2.ZeroInit = 0;
|
||||
|
||||
Message->AlpcHeader.u1.s1.TotalLength = sizeof(CIS_MSG);
|
||||
Message->AlpcHeader.u1.s1.DataLength = sizeof(CIS_MSG) - sizeof(PORT_MESSAGE);
|
||||
|
||||
Message->AlpcHeader.ClientId.UniqueProcess = 0;
|
||||
Message->AlpcHeader.ClientId.UniqueThread = 0;
|
||||
Message->AlpcHeader.ClientId.UniqueProcess = nullptr;
|
||||
Message->AlpcHeader.ClientId.UniqueThread = nullptr;
|
||||
|
||||
SIZE_T ActualReceiveMessageLength = sizeof(CIS_MSG);
|
||||
|
||||
Status = NtAlpcSendWaitReceivePort(_alpcClientCommunicationPort,
|
||||
0,
|
||||
(PPORT_MESSAGE)Message,
|
||||
NULL,
|
||||
(PPORT_MESSAGE)Message,
|
||||
&ActualReceiveMessageLength,
|
||||
NULL,
|
||||
0);
|
||||
const auto Status = NtAlpcSendWaitReceivePort(_alpcClientCommunicationPort,
|
||||
0,
|
||||
&Message->AlpcHeader,
|
||||
nullptr,
|
||||
&Message->AlpcHeader,
|
||||
&ActualReceiveMessageLength,
|
||||
nullptr,
|
||||
nullptr);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
VOID ConIoSrvComm::HandleFocusEvent(PCIS_EVENT Event)
|
||||
VOID ConIoSrvComm::HandleFocusEvent(const CIS_EVENT* const Event)
|
||||
{
|
||||
BOOL Ret;
|
||||
Renderer* Renderer;
|
||||
CIS_EVENT ReplyEvent;
|
||||
|
||||
Renderer = ServiceLocator::LocateGlobals().pRender;
|
||||
auto Renderer = ServiceLocator::LocateGlobals().pRender;
|
||||
|
||||
switch (_displayMode)
|
||||
{
|
||||
@ -348,7 +337,7 @@ VOID ConIoSrvComm::HandleFocusEvent(PCIS_EVENT Event)
|
||||
|
||||
case CIS_DISPLAY_MODE_DIRECTX:
|
||||
{
|
||||
Globals& globals = ServiceLocator::LocateGlobals();
|
||||
auto& globals = ServiceLocator::LocateGlobals();
|
||||
|
||||
if (Event->FocusEvent.IsActive)
|
||||
{
|
||||
@ -367,13 +356,13 @@ VOID ConIoSrvComm::HandleFocusEvent(PCIS_EVENT Event)
|
||||
// Right after we initialize, synchronize the screen/viewport states with the WddmCon surface dimensions
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
const RECT rcOld = { 0 };
|
||||
const RECT rcOld{};
|
||||
|
||||
// WddmEngine reports display size in characters, adjust to pixels for resize window calc.
|
||||
RECT rcDisplay = pWddmConEngine->GetDisplaySize();
|
||||
auto rcDisplay = pWddmConEngine->GetDisplaySize();
|
||||
|
||||
// Get font to adjust char to pixels.
|
||||
COORD coordFont = { 0 };
|
||||
COORD coordFont{};
|
||||
LOG_IF_FAILED(pWddmConEngine->GetFontSize(&coordFont));
|
||||
|
||||
rcDisplay.right *= coordFont.X;
|
||||
@ -415,11 +404,11 @@ VOID ConIoSrvComm::HandleFocusEvent(PCIS_EVENT Event)
|
||||
// Let the Console IO Server that we have relinquished
|
||||
// control of the display.
|
||||
ReplyEvent.Type = CIS_EVENT_TYPE_FOCUS_ACK;
|
||||
Ret = WriteFile(_pipeWriteHandle,
|
||||
&ReplyEvent,
|
||||
sizeof(CIS_EVENT),
|
||||
NULL,
|
||||
NULL);
|
||||
WriteFile(_pipeWriteHandle,
|
||||
&ReplyEvent,
|
||||
sizeof(CIS_EVENT),
|
||||
nullptr,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -471,12 +460,10 @@ VOID ConIoSrvComm::CleanupForHeadless(const NTSTATUS status)
|
||||
|
||||
[[nodiscard]] NTSTATUS ConIoSrvComm::RequestGetDisplaySize(_Inout_ PCD_IO_DISPLAY_SIZE pCdDisplaySize) const
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
CIS_MSG Message = { 0 };
|
||||
CIS_MSG Message{};
|
||||
Message.Type = CIS_MSG_TYPE_GETDISPLAYSIZE;
|
||||
|
||||
Status = SendRequestReceiveReply(&Message);
|
||||
auto Status = SendRequestReceiveReply(&Message);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
*pCdDisplaySize = Message.GetDisplaySizeParams.DisplaySize;
|
||||
@ -488,12 +475,10 @@ VOID ConIoSrvComm::CleanupForHeadless(const NTSTATUS status)
|
||||
|
||||
[[nodiscard]] NTSTATUS ConIoSrvComm::RequestGetFontSize(_Inout_ PCD_IO_FONT_SIZE pCdFontSize) const
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
CIS_MSG Message = { 0 };
|
||||
CIS_MSG Message{};
|
||||
Message.Type = CIS_MSG_TYPE_GETFONTSIZE;
|
||||
|
||||
Status = SendRequestReceiveReply(&Message);
|
||||
auto Status = SendRequestReceiveReply(&Message);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
*pCdFontSize = Message.GetFontSizeParams.FontSize;
|
||||
@ -503,15 +488,13 @@ VOID ConIoSrvComm::CleanupForHeadless(const NTSTATUS status)
|
||||
return Status;
|
||||
}
|
||||
|
||||
[[nodiscard]] NTSTATUS ConIoSrvComm::RequestSetCursor(_In_ CD_IO_CURSOR_INFORMATION* const pCdCursorInformation) const
|
||||
[[nodiscard]] NTSTATUS ConIoSrvComm::RequestSetCursor(_In_ const CD_IO_CURSOR_INFORMATION* const pCdCursorInformation) const
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
CIS_MSG Message = { 0 };
|
||||
CIS_MSG Message{};
|
||||
Message.Type = CIS_MSG_TYPE_SETCURSOR;
|
||||
Message.SetCursorParams.CursorInformation = *pCdCursorInformation;
|
||||
|
||||
Status = SendRequestReceiveReply(&Message);
|
||||
auto Status = SendRequestReceiveReply(&Message);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = Message.SetCursorParams.ReturnValue;
|
||||
@ -522,13 +505,11 @@ VOID ConIoSrvComm::CleanupForHeadless(const NTSTATUS status)
|
||||
|
||||
[[nodiscard]] NTSTATUS ConIoSrvComm::RequestUpdateDisplay(_In_ SHORT RowIndex) const
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
CIS_MSG Message = { 0 };
|
||||
CIS_MSG Message{};
|
||||
Message.Type = CIS_MSG_TYPE_UPDATEDISPLAY;
|
||||
Message.UpdateDisplayParams.RowIndex = RowIndex;
|
||||
|
||||
Status = SendRequestReceiveReply(&Message);
|
||||
auto Status = SendRequestReceiveReply(&Message);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = Message.UpdateDisplayParams.ReturnValue;
|
||||
@ -537,12 +518,12 @@ VOID ConIoSrvComm::CleanupForHeadless(const NTSTATUS status)
|
||||
return Status;
|
||||
}
|
||||
|
||||
[[nodiscard]] USHORT ConIoSrvComm::GetDisplayMode() const
|
||||
[[nodiscard]] USHORT ConIoSrvComm::GetDisplayMode() const noexcept
|
||||
{
|
||||
return _displayMode;
|
||||
}
|
||||
|
||||
PVOID ConIoSrvComm::GetSharedViewBase() const
|
||||
PVOID ConIoSrvComm::GetSharedViewBase() const noexcept
|
||||
{
|
||||
return _alpcSharedViewBase;
|
||||
}
|
||||
@ -551,20 +532,18 @@ PVOID ConIoSrvComm::GetSharedViewBase() const
|
||||
|
||||
[[nodiscard]] NTSTATUS ConIoSrvComm::InitializeBgfx()
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
Globals& globals = ServiceLocator::LocateGlobals();
|
||||
const auto& globals = ServiceLocator::LocateGlobals();
|
||||
FAIL_FAST_IF_NULL(globals.pRender);
|
||||
IWindowMetrics* const Metrics = ServiceLocator::LocateWindowMetrics();
|
||||
const auto Metrics = ServiceLocator::LocateWindowMetrics();
|
||||
|
||||
// Fetch the display size from the console driver.
|
||||
const RECT DisplaySize = Metrics->GetMaxClientRectInPixels();
|
||||
Status = GetLastError();
|
||||
const auto DisplaySize = Metrics->GetMaxClientRectInPixels();
|
||||
auto Status = GetLastError();
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
// Same with the font size.
|
||||
CD_IO_FONT_SIZE FontSize = { 0 };
|
||||
CD_IO_FONT_SIZE FontSize{};
|
||||
Status = RequestGetFontSize(&FontSize);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
@ -572,13 +551,14 @@ PVOID ConIoSrvComm::GetSharedViewBase() const
|
||||
try
|
||||
{
|
||||
// Create and set the render engine.
|
||||
BgfxEngine* const pBgfxEngine = new BgfxEngine(GetSharedViewBase(),
|
||||
DisplaySize.bottom / FontSize.Height,
|
||||
DisplaySize.right / FontSize.Width,
|
||||
FontSize.Width,
|
||||
FontSize.Height);
|
||||
_bgfxEngine = std::make_unique<BgfxEngine>(
|
||||
GetSharedViewBase(),
|
||||
DisplaySize.bottom / FontSize.Height,
|
||||
DisplaySize.right / FontSize.Width,
|
||||
FontSize.Width,
|
||||
FontSize.Height);
|
||||
|
||||
globals.pRender->AddRenderEngine(pBgfxEngine);
|
||||
globals.pRender->AddRenderEngine(_bgfxEngine.get());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@ -592,13 +572,13 @@ PVOID ConIoSrvComm::GetSharedViewBase() const
|
||||
|
||||
[[nodiscard]] NTSTATUS ConIoSrvComm::InitializeWddmCon()
|
||||
{
|
||||
Globals& globals = ServiceLocator::LocateGlobals();
|
||||
const auto& globals = ServiceLocator::LocateGlobals();
|
||||
FAIL_FAST_IF_NULL(globals.pRender);
|
||||
|
||||
try
|
||||
{
|
||||
pWddmConEngine = new WddmConEngine();
|
||||
globals.pRender->AddRenderEngine(pWddmConEngine);
|
||||
pWddmConEngine = std::make_unique<WddmConEngine>();
|
||||
globals.pRender->AddRenderEngine(pWddmConEngine.get());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
||||
@ -19,7 +19,7 @@ Author(s):
|
||||
#include "ConIoSrv.h"
|
||||
|
||||
#include "BgfxEngine.hpp"
|
||||
#include "../../renderer/wddmcon/wddmconrenderer.hpp"
|
||||
#include "../../renderer/wddmcon/WddmConRenderer.hpp"
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
@ -28,7 +28,7 @@ namespace Microsoft::Console::Interactivity::OneCore
|
||||
class ConIoSrvComm final
|
||||
{
|
||||
public:
|
||||
ConIoSrvComm();
|
||||
ConIoSrvComm() noexcept;
|
||||
~ConIoSrvComm();
|
||||
|
||||
static ConIoSrvComm* GetConIoSrvComm();
|
||||
@ -38,25 +38,27 @@ namespace Microsoft::Console::Interactivity::OneCore
|
||||
|
||||
[[nodiscard]] NTSTATUS RequestGetDisplaySize(_Inout_ PCD_IO_DISPLAY_SIZE pCdDisplaySize) const;
|
||||
[[nodiscard]] NTSTATUS RequestGetFontSize(_Inout_ PCD_IO_FONT_SIZE pCdFontSize) const;
|
||||
[[nodiscard]] NTSTATUS RequestSetCursor(_In_ CD_IO_CURSOR_INFORMATION* const pCdCursorInformation) const;
|
||||
[[nodiscard]] NTSTATUS RequestSetCursor(_In_ const CD_IO_CURSOR_INFORMATION* const pCdCursorInformation) const;
|
||||
[[nodiscard]] NTSTATUS RequestUpdateDisplay(_In_ SHORT RowIndex) const;
|
||||
|
||||
[[nodiscard]] USHORT GetDisplayMode() const;
|
||||
[[nodiscard]] USHORT GetDisplayMode() const noexcept;
|
||||
|
||||
PVOID GetSharedViewBase() const;
|
||||
PVOID GetSharedViewBase() const noexcept;
|
||||
|
||||
VOID CleanupForHeadless(const NTSTATUS status);
|
||||
|
||||
[[nodiscard]] NTSTATUS InitializeBgfx();
|
||||
[[nodiscard]] NTSTATUS InitializeWddmCon();
|
||||
|
||||
Microsoft::Console::Render::WddmConEngine* pWddmConEngine;
|
||||
std::unique_ptr<Render::WddmConEngine> pWddmConEngine;
|
||||
|
||||
private:
|
||||
[[nodiscard]] NTSTATUS EnsureConnection();
|
||||
[[nodiscard]] NTSTATUS SendRequestReceiveReply(PCIS_MSG Message) const;
|
||||
|
||||
VOID HandleFocusEvent(PCIS_EVENT const FocusEvent);
|
||||
VOID HandleFocusEvent(const CIS_EVENT* const FocusEvent);
|
||||
|
||||
std::unique_ptr<Render::BgfxEngine> _bgfxEngine;
|
||||
|
||||
HANDLE _inputPipeThreadHandle;
|
||||
|
||||
|
||||
@ -12,28 +12,28 @@ using namespace Microsoft::Console::Interactivity::OneCore;
|
||||
|
||||
#pragma region IConsoleControl Members
|
||||
|
||||
[[nodiscard]] NTSTATUS ConsoleControl::NotifyConsoleApplication(_In_ DWORD /*dwProcessId*/)
|
||||
[[nodiscard]] NTSTATUS ConsoleControl::NotifyConsoleApplication(_In_ DWORD /*dwProcessId*/) noexcept
|
||||
{
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
[[nodiscard]] NTSTATUS ConsoleControl::SetForeground(_In_ HANDLE /*hProcess*/, _In_ BOOL /*fForeground*/)
|
||||
[[nodiscard]] NTSTATUS ConsoleControl::SetForeground(_In_ HANDLE /*hProcess*/, _In_ BOOL /*fForeground*/) noexcept
|
||||
{
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
[[nodiscard]] NTSTATUS ConsoleControl::EndTask(_In_ HANDLE hProcessId, _In_ DWORD dwEventType, _In_ ULONG ulCtrlFlags)
|
||||
{
|
||||
USER_API_MSG m;
|
||||
PENDTASKMSG a = &m.u.EndTask;
|
||||
USER_API_MSG m{};
|
||||
const auto a = &m.u.EndTask;
|
||||
|
||||
RtlZeroMemory(a, sizeof(*a));
|
||||
a->ProcessId = hProcessId;
|
||||
a->ConsoleEventCode = dwEventType;
|
||||
a->ConsoleFlags = ulCtrlFlags;
|
||||
|
||||
return CsrClientCallServer((PCSR_API_MSG)&m,
|
||||
NULL,
|
||||
return CsrClientCallServer(reinterpret_cast<PCSR_API_MSG>(&m),
|
||||
nullptr,
|
||||
CSR_MAKE_API_NUMBER(USERSRV_SERVERDLL_INDEX, UserpEndTask),
|
||||
sizeof(*a));
|
||||
}
|
||||
|
||||
@ -20,12 +20,12 @@ Author(s):
|
||||
|
||||
namespace Microsoft::Console::Interactivity::OneCore
|
||||
{
|
||||
class ConsoleControl sealed : public IConsoleControl
|
||||
class ConsoleControl : public IConsoleControl
|
||||
{
|
||||
public:
|
||||
// IConsoleControl Members
|
||||
[[nodiscard]] NTSTATUS NotifyConsoleApplication(_In_ DWORD dwProcessId);
|
||||
[[nodiscard]] NTSTATUS SetForeground(_In_ HANDLE hProcess, _In_ BOOL fForeground);
|
||||
[[nodiscard]] NTSTATUS EndTask(_In_ HANDLE hProcessId, _In_ DWORD dwEventType, _In_ ULONG ulCtrlFlags);
|
||||
[[nodiscard]] NTSTATUS NotifyConsoleApplication(_In_ DWORD dwProcessId) noexcept override;
|
||||
[[nodiscard]] NTSTATUS SetForeground(_In_ HANDLE hProcess, _In_ BOOL fForeground) noexcept override;
|
||||
[[nodiscard]] NTSTATUS EndTask(_In_ HANDLE hProcessId, _In_ DWORD dwEventType, _In_ ULONG ulCtrlFlags) override;
|
||||
};
|
||||
}
|
||||
|
||||
@ -18,24 +18,23 @@ using namespace Microsoft::Console::Interactivity::OneCore;
|
||||
|
||||
DWORD WINAPI ConsoleInputThreadProcOneCore(LPVOID /*lpParam*/)
|
||||
{
|
||||
Globals& globals = ServiceLocator::LocateGlobals();
|
||||
ConIoSrvComm* const Server = ConIoSrvComm::GetConIoSrvComm();
|
||||
auto& globals = ServiceLocator::LocateGlobals();
|
||||
const auto Server = ConIoSrvComm::GetConIoSrvComm();
|
||||
|
||||
NTSTATUS Status = Server->Connect();
|
||||
auto Status = Server->Connect();
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
USHORT DisplayMode = Server->GetDisplayMode();
|
||||
const auto DisplayMode = Server->GetDisplayMode();
|
||||
|
||||
if (DisplayMode != CIS_DISPLAY_MODE_NONE)
|
||||
{
|
||||
// Create and set the console window.
|
||||
ConsoleWindow* const wnd = new (std::nothrow) ConsoleWindow();
|
||||
Status = NT_TESTNULL(wnd);
|
||||
static ConsoleWindow wnd;
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
LOG_IF_FAILED(ServiceLocator::SetConsoleWindowInstance(wnd));
|
||||
LOG_IF_FAILED(ServiceLocator::SetConsoleWindowInstance(&wnd));
|
||||
|
||||
// The console's renderer should be created before we get here.
|
||||
FAIL_FAST_IF_NULL(globals.pRender);
|
||||
@ -45,10 +44,11 @@ DWORD WINAPI ConsoleInputThreadProcOneCore(LPVOID /*lpParam*/)
|
||||
case CIS_DISPLAY_MODE_BGFX:
|
||||
Status = Server->InitializeBgfx();
|
||||
break;
|
||||
|
||||
case CIS_DISPLAY_MODE_DIRECTX:
|
||||
Status = Server->InitializeWddmCon();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
@ -106,17 +106,16 @@ DWORD WINAPI ConsoleInputThreadProcOneCore(LPVOID /*lpParam*/)
|
||||
|
||||
// Routine Description:
|
||||
// - Starts the OneCore-specific console input thread.
|
||||
HANDLE ConsoleInputThread::Start()
|
||||
HANDLE ConsoleInputThread::Start() noexcept
|
||||
{
|
||||
HANDLE hThread = nullptr;
|
||||
DWORD dwThreadId = (DWORD)-1;
|
||||
auto dwThreadId = gsl::narrow_cast<DWORD>(-1);
|
||||
|
||||
hThread = CreateThread(nullptr,
|
||||
0,
|
||||
ConsoleInputThreadProcOneCore,
|
||||
nullptr,
|
||||
0,
|
||||
&dwThreadId);
|
||||
const auto hThread = CreateThread(nullptr,
|
||||
0,
|
||||
ConsoleInputThreadProcOneCore,
|
||||
nullptr,
|
||||
0,
|
||||
&dwThreadId);
|
||||
if (hThread)
|
||||
{
|
||||
_hThread = hThread;
|
||||
|
||||
@ -21,9 +21,9 @@ Author(s):
|
||||
|
||||
namespace Microsoft::Console::Interactivity::OneCore
|
||||
{
|
||||
class ConsoleInputThread sealed : public IConsoleInputThread
|
||||
class ConsoleInputThread : public IConsoleInputThread
|
||||
{
|
||||
public:
|
||||
HANDLE Start();
|
||||
HANDLE Start() noexcept override;
|
||||
};
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
using namespace Microsoft::Console::Interactivity::OneCore;
|
||||
using namespace Microsoft::Console::Types;
|
||||
|
||||
BOOL ConsoleWindow::EnableBothScrollBars()
|
||||
BOOL ConsoleWindow::EnableBothScrollBars() noexcept
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@ -20,28 +20,28 @@ int ConsoleWindow::UpdateScrollBar(bool /*isVertical*/,
|
||||
bool /*isAltBuffer*/,
|
||||
UINT /*pageSize*/,
|
||||
int /*maxSize*/,
|
||||
int /*viewportPosition*/)
|
||||
int /*viewportPosition*/) noexcept
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ConsoleWindow::IsInFullscreen() const
|
||||
bool ConsoleWindow::IsInFullscreen() const noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConsoleWindow::SetIsFullscreen(const bool /*fFullscreenEnabled*/)
|
||||
void ConsoleWindow::SetIsFullscreen(const bool /*fFullscreenEnabled*/) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
void ConsoleWindow::ChangeViewport(const SMALL_RECT NewWindow)
|
||||
{
|
||||
CONSOLE_INFORMATION& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
|
||||
auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
|
||||
|
||||
SCREEN_INFORMATION& ScreenInfo = gci.GetActiveOutputBuffer();
|
||||
const COORD FontSize = ScreenInfo.GetScreenFontSize();
|
||||
auto& ScreenInfo = gci.GetActiveOutputBuffer();
|
||||
const auto FontSize = ScreenInfo.GetScreenFontSize();
|
||||
|
||||
Selection* pSelection = &Selection::Instance();
|
||||
auto pSelection = &Selection::Instance();
|
||||
pSelection->HideSelection();
|
||||
|
||||
ScreenInfo.SetViewport(Viewport::FromInclusive(NewWindow), true);
|
||||
@ -56,87 +56,86 @@ void ConsoleWindow::ChangeViewport(const SMALL_RECT NewWindow)
|
||||
ScreenInfo.UpdateScrollBars();
|
||||
}
|
||||
|
||||
void ConsoleWindow::CaptureMouse()
|
||||
void ConsoleWindow::CaptureMouse() noexcept
|
||||
{
|
||||
}
|
||||
|
||||
BOOL ConsoleWindow::ReleaseMouse()
|
||||
BOOL ConsoleWindow::ReleaseMouse() noexcept
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HWND ConsoleWindow::GetWindowHandle() const
|
||||
HWND ConsoleWindow::GetWindowHandle() const noexcept
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ConsoleWindow::SetOwner()
|
||||
void ConsoleWindow::SetOwner() noexcept
|
||||
{
|
||||
}
|
||||
|
||||
BOOL ConsoleWindow::GetCursorPosition(LPPOINT /*lpPoint*/)
|
||||
BOOL ConsoleWindow::GetCursorPosition(LPPOINT /*lpPoint*/) noexcept
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL ConsoleWindow::GetClientRectangle(LPRECT /*lpRect*/)
|
||||
BOOL ConsoleWindow::GetClientRectangle(LPRECT /*lpRect*/) noexcept
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int ConsoleWindow::MapPoints(LPPOINT /*lpPoints*/, UINT /*cPoints*/)
|
||||
int ConsoleWindow::MapPoints(LPPOINT /*lpPoints*/, UINT /*cPoints*/) noexcept
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL ConsoleWindow::ConvertScreenToClient(LPPOINT /*lpPoint*/)
|
||||
BOOL ConsoleWindow::ConvertScreenToClient(LPPOINT /*lpPoint*/) noexcept
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL ConsoleWindow::SendNotifyBeep() const
|
||||
BOOL ConsoleWindow::SendNotifyBeep() const noexcept
|
||||
{
|
||||
return Beep(800, 200);
|
||||
}
|
||||
|
||||
BOOL ConsoleWindow::PostUpdateScrollBars() const
|
||||
BOOL ConsoleWindow::PostUpdateScrollBars() const noexcept
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL ConsoleWindow::PostUpdateWindowSize() const
|
||||
BOOL ConsoleWindow::PostUpdateWindowSize() const noexcept
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void ConsoleWindow::UpdateWindowSize(const COORD /*coordSizeInChars*/)
|
||||
void ConsoleWindow::UpdateWindowSize(const COORD /*coordSizeInChars*/) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
void ConsoleWindow::UpdateWindowText()
|
||||
void ConsoleWindow::UpdateWindowText() noexcept
|
||||
{
|
||||
}
|
||||
|
||||
void ConsoleWindow::HorizontalScroll(const WORD /*wScrollCommand*/, const WORD /*wAbsoluteChange*/)
|
||||
void ConsoleWindow::HorizontalScroll(const WORD /*wScrollCommand*/, const WORD /*wAbsoluteChange*/) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
void ConsoleWindow::VerticalScroll(const WORD /*wScrollCommand*/, const WORD /*wAbsoluteChange*/)
|
||||
void ConsoleWindow::VerticalScroll(const WORD /*wScrollCommand*/, const WORD /*wAbsoluteChange*/) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
[[nodiscard]] HRESULT ConsoleWindow::SignalUia(_In_ EVENTID /*id*/)
|
||||
[[nodiscard]] HRESULT ConsoleWindow::SignalUia(_In_ EVENTID /*id*/) noexcept
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
[[nodiscard]] HRESULT ConsoleWindow::UiaSetTextAreaFocus()
|
||||
[[nodiscard]] HRESULT ConsoleWindow::UiaSetTextAreaFocus() noexcept
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
RECT ConsoleWindow::GetWindowRect() const noexcept
|
||||
{
|
||||
RECT rc = { 0 };
|
||||
return rc;
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -20,43 +20,42 @@ Author(s):
|
||||
|
||||
namespace Microsoft::Console::Interactivity::OneCore
|
||||
{
|
||||
class ConsoleWindow sealed : public Microsoft::Console::Types::IConsoleWindow
|
||||
class ConsoleWindow : public Microsoft::Console::Types::IConsoleWindow
|
||||
{
|
||||
public:
|
||||
// Inherited via IConsoleWindow
|
||||
BOOL EnableBothScrollBars();
|
||||
int UpdateScrollBar(bool isVertical, bool isAltBuffer, UINT pageSize, int maxSize, int viewportPosition);
|
||||
BOOL EnableBothScrollBars() noexcept override;
|
||||
int UpdateScrollBar(bool isVertical, bool isAltBuffer, UINT pageSize, int maxSize, int viewportPosition) noexcept override;
|
||||
|
||||
bool IsInFullscreen() const;
|
||||
void SetIsFullscreen(const bool fFullscreenEnabled);
|
||||
void ChangeViewport(const SMALL_RECT NewWindow);
|
||||
bool IsInFullscreen() const noexcept override;
|
||||
void SetIsFullscreen(const bool fFullscreenEnabled) noexcept override;
|
||||
void ChangeViewport(const SMALL_RECT NewWindow) override;
|
||||
|
||||
void CaptureMouse();
|
||||
BOOL ReleaseMouse();
|
||||
void CaptureMouse() noexcept override;
|
||||
BOOL ReleaseMouse() noexcept override;
|
||||
|
||||
HWND GetWindowHandle() const;
|
||||
HWND GetWindowHandle() const noexcept override;
|
||||
|
||||
void SetOwner();
|
||||
void SetOwner() noexcept override;
|
||||
|
||||
BOOL GetCursorPosition(LPPOINT lpPoint);
|
||||
BOOL GetClientRectangle(LPRECT lpRect);
|
||||
int MapPoints(LPPOINT lpPoints, UINT cPoints);
|
||||
BOOL ConvertScreenToClient(LPPOINT lpPoint);
|
||||
BOOL GetCursorPosition(LPPOINT lpPoint) noexcept override;
|
||||
BOOL GetClientRectangle(LPRECT lpRect) noexcept override;
|
||||
int MapPoints(LPPOINT lpPoints, UINT cPoints) noexcept override;
|
||||
BOOL ConvertScreenToClient(LPPOINT lpPoint) noexcept override;
|
||||
|
||||
BOOL SendNotifyBeep() const;
|
||||
BOOL SendNotifyBeep() const noexcept override;
|
||||
|
||||
BOOL PostUpdateScrollBars() const;
|
||||
BOOL PostUpdateTitleWithCopy(const PCWSTR pwszNewTitle) const;
|
||||
BOOL PostUpdateWindowSize() const;
|
||||
BOOL PostUpdateScrollBars() const noexcept override;
|
||||
BOOL PostUpdateWindowSize() const noexcept override;
|
||||
|
||||
void UpdateWindowSize(const COORD coordSizeInChars);
|
||||
void UpdateWindowText();
|
||||
void UpdateWindowSize(const COORD coordSizeInChars) noexcept override;
|
||||
void UpdateWindowText() noexcept override;
|
||||
|
||||
void HorizontalScroll(const WORD wScrollCommand, const WORD wAbsoluteChange);
|
||||
void VerticalScroll(const WORD wScrollCommand, const WORD wAbsoluteChange);
|
||||
void HorizontalScroll(const WORD wScrollCommand, const WORD wAbsoluteChange) noexcept override;
|
||||
void VerticalScroll(const WORD wScrollCommand, const WORD wAbsoluteChange) noexcept override;
|
||||
|
||||
[[nodiscard]] HRESULT SignalUia(_In_ EVENTID id);
|
||||
[[nodiscard]] HRESULT UiaSetTextAreaFocus();
|
||||
RECT GetWindowRect() const noexcept;
|
||||
[[nodiscard]] HRESULT SignalUia(_In_ EVENTID id) noexcept override;
|
||||
[[nodiscard]] HRESULT UiaSetTextAreaFocus() noexcept override;
|
||||
RECT GetWindowRect() const noexcept override;
|
||||
};
|
||||
}
|
||||
|
||||
@ -7,17 +7,17 @@
|
||||
|
||||
using namespace Microsoft::Console::Interactivity::OneCore;
|
||||
|
||||
UINT SystemConfigurationProvider::GetCaretBlinkTime()
|
||||
UINT SystemConfigurationProvider::GetCaretBlinkTime() noexcept
|
||||
{
|
||||
return s_DefaultCaretBlinkTime;
|
||||
}
|
||||
|
||||
bool SystemConfigurationProvider::IsCaretBlinkingEnabled()
|
||||
bool SystemConfigurationProvider::IsCaretBlinkingEnabled() noexcept
|
||||
{
|
||||
return s_DefaultIsCaretBlinkingEnabled;
|
||||
}
|
||||
|
||||
int SystemConfigurationProvider::GetNumberOfMouseButtons()
|
||||
int SystemConfigurationProvider::GetNumberOfMouseButtons() noexcept
|
||||
{
|
||||
if (IsGetSystemMetricsPresent())
|
||||
{
|
||||
@ -29,17 +29,17 @@ int SystemConfigurationProvider::GetNumberOfMouseButtons()
|
||||
}
|
||||
}
|
||||
|
||||
ULONG SystemConfigurationProvider::GetCursorWidth()
|
||||
ULONG SystemConfigurationProvider::GetCursorWidth() noexcept
|
||||
{
|
||||
return s_DefaultCursorWidth;
|
||||
}
|
||||
|
||||
ULONG SystemConfigurationProvider::GetNumberOfWheelScrollLines()
|
||||
ULONG SystemConfigurationProvider::GetNumberOfWheelScrollLines() noexcept
|
||||
{
|
||||
return s_DefaultNumberOfWheelScrollLines;
|
||||
}
|
||||
|
||||
ULONG SystemConfigurationProvider::GetNumberOfWheelScrollCharacters()
|
||||
ULONG SystemConfigurationProvider::GetNumberOfWheelScrollCharacters() noexcept
|
||||
{
|
||||
return s_DefaultNumberOfWheelScrollCharacters;
|
||||
}
|
||||
|
||||
@ -22,30 +22,30 @@ class InputTests;
|
||||
|
||||
namespace Microsoft::Console::Interactivity::OneCore
|
||||
{
|
||||
class SystemConfigurationProvider sealed : public ISystemConfigurationProvider
|
||||
class SystemConfigurationProvider : public ISystemConfigurationProvider
|
||||
{
|
||||
public:
|
||||
bool IsCaretBlinkingEnabled();
|
||||
bool IsCaretBlinkingEnabled() noexcept override;
|
||||
|
||||
UINT GetCaretBlinkTime();
|
||||
int GetNumberOfMouseButtons();
|
||||
ULONG GetCursorWidth() override;
|
||||
ULONG GetNumberOfWheelScrollLines();
|
||||
ULONG GetNumberOfWheelScrollCharacters();
|
||||
UINT GetCaretBlinkTime() noexcept override;
|
||||
int GetNumberOfMouseButtons() noexcept override;
|
||||
ULONG GetCursorWidth() noexcept override;
|
||||
ULONG GetNumberOfWheelScrollLines() noexcept override;
|
||||
ULONG GetNumberOfWheelScrollCharacters() noexcept override;
|
||||
|
||||
void GetSettingsFromLink(_Inout_ Settings* pLinkSettings,
|
||||
_Inout_updates_bytes_(*pdwTitleLength) LPWSTR pwszTitle,
|
||||
_Inout_ PDWORD pdwTitleLength,
|
||||
_In_ PCWSTR pwszCurrDir,
|
||||
_In_ PCWSTR pwszAppName);
|
||||
_In_ PCWSTR pwszAppName) override;
|
||||
|
||||
private:
|
||||
static const UINT s_DefaultCaretBlinkTime = 530; // milliseconds
|
||||
static const bool s_DefaultIsCaretBlinkingEnabled = true;
|
||||
static const int s_DefaultNumberOfMouseButtons = 3;
|
||||
static const ULONG s_DefaultCursorWidth = 1;
|
||||
static const ULONG s_DefaultNumberOfWheelScrollLines = 3;
|
||||
static const ULONG s_DefaultNumberOfWheelScrollCharacters = 3;
|
||||
static constexpr UINT s_DefaultCaretBlinkTime = 530; // milliseconds
|
||||
static constexpr bool s_DefaultIsCaretBlinkingEnabled = true;
|
||||
static constexpr int s_DefaultNumberOfMouseButtons = 3;
|
||||
static constexpr ULONG s_DefaultCursorWidth = 1;
|
||||
static constexpr ULONG s_DefaultNumberOfWheelScrollLines = 3;
|
||||
static constexpr ULONG s_DefaultNumberOfWheelScrollCharacters = 3;
|
||||
|
||||
friend class ::InputTests;
|
||||
};
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
#include "WindowMetrics.hpp"
|
||||
#include "ConIoSrvComm.hpp"
|
||||
|
||||
#include "../../renderer/wddmcon/wddmconrenderer.hpp"
|
||||
#include "../../renderer/wddmcon/WddmConRenderer.hpp"
|
||||
|
||||
#include "../inc/ServiceLocator.hpp"
|
||||
|
||||
@ -22,34 +22,28 @@ using namespace Microsoft::Console::Interactivity::OneCore;
|
||||
|
||||
RECT WindowMetrics::GetMinClientRectInPixels()
|
||||
{
|
||||
ConIoSrvComm* Server;
|
||||
|
||||
NTSTATUS Status;
|
||||
|
||||
// We need to always return something viable for this call,
|
||||
// so by default, set the font and display size to our headless
|
||||
// constants.
|
||||
// If we get information from the Server, great. We'll calculate
|
||||
// the values for that at the end.
|
||||
// If we don't... then at least we have a non-zero rectangle.
|
||||
COORD FontSize = { 0 };
|
||||
COORD FontSize{};
|
||||
FontSize.X = HEADLESS_FONT_SIZE_WIDTH;
|
||||
FontSize.Y = HEADLESS_FONT_SIZE_HEIGHT;
|
||||
|
||||
RECT DisplaySize = { 0 };
|
||||
RECT DisplaySize{};
|
||||
DisplaySize.right = HEADLESS_DISPLAY_SIZE_WIDTH;
|
||||
DisplaySize.bottom = HEADLESS_DISPLAY_SIZE_HEIGHT;
|
||||
|
||||
CD_IO_FONT_SIZE FontSizeIoctl = { 0 };
|
||||
CD_IO_DISPLAY_SIZE DisplaySizeIoctl = { 0 };
|
||||
|
||||
USHORT DisplayMode;
|
||||
CD_IO_FONT_SIZE FontSizeIoctl{};
|
||||
CD_IO_DISPLAY_SIZE DisplaySizeIoctl{};
|
||||
|
||||
// Fetch a reference to the Console IO Server.
|
||||
Server = ConIoSrvComm::GetConIoSrvComm();
|
||||
const auto Server = ConIoSrvComm::GetConIoSrvComm();
|
||||
|
||||
// Figure out what kind of display we are using.
|
||||
DisplayMode = Server->GetDisplayMode();
|
||||
const auto DisplayMode = Server->GetDisplayMode();
|
||||
|
||||
// Note on status propagation:
|
||||
//
|
||||
@ -71,7 +65,7 @@ RECT WindowMetrics::GetMinClientRectInPixels()
|
||||
// might be a problem for plugging/unplugging monitors or perhaps
|
||||
// across KVM sessions.
|
||||
|
||||
Status = Server->RequestGetDisplaySize(&DisplaySizeIoctl);
|
||||
auto Status = Server->RequestGetDisplaySize(&DisplaySizeIoctl);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
@ -81,34 +75,34 @@ RECT WindowMetrics::GetMinClientRectInPixels()
|
||||
{
|
||||
DisplaySize.top = 0;
|
||||
DisplaySize.left = 0;
|
||||
DisplaySize.bottom = DisplaySizeIoctl.Height;
|
||||
DisplaySize.right = DisplaySizeIoctl.Width;
|
||||
DisplaySize.bottom = gsl::narrow_cast<LONG>(DisplaySizeIoctl.Height);
|
||||
DisplaySize.right = gsl::narrow_cast<LONG>(DisplaySizeIoctl.Width);
|
||||
|
||||
FontSize.X = (SHORT)FontSizeIoctl.Width;
|
||||
FontSize.Y = (SHORT)FontSizeIoctl.Height;
|
||||
FontSize.X = gsl::narrow_cast<SHORT>(FontSizeIoctl.Width);
|
||||
FontSize.Y = gsl::narrow_cast<SHORT>(FontSizeIoctl.Height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLastError(Status);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case CIS_DISPLAY_MODE_DIRECTX:
|
||||
{
|
||||
LOG_IF_FAILED(Server->pWddmConEngine->GetFontSize(&FontSize));
|
||||
DisplaySize = Server->pWddmConEngine->GetDisplaySize();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case CIS_DISPLAY_MODE_NONE:
|
||||
{
|
||||
// When in headless mode and using EMS (Emergency Management
|
||||
// Services), ensure that the buffer isn't zero-sized by
|
||||
// using the default values.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// The result is expected to be in pixels, not rows/columns.
|
||||
|
||||
@ -20,10 +20,10 @@ Author(s):
|
||||
|
||||
namespace Microsoft::Console::Interactivity::OneCore
|
||||
{
|
||||
class WindowMetrics sealed : public IWindowMetrics
|
||||
class WindowMetrics : public IWindowMetrics
|
||||
{
|
||||
public:
|
||||
RECT GetMinClientRectInPixels();
|
||||
RECT GetMaxClientRectInPixels();
|
||||
RECT GetMinClientRectInPixels() override;
|
||||
RECT GetMaxClientRectInPixels() override;
|
||||
};
|
||||
}
|
||||
|
||||
@ -6,17 +6,28 @@
|
||||
<RootNamespace>OneCore</RootNamespace>
|
||||
<ProjectName>InteractivityOneCore</ProjectName>
|
||||
<TargetName>ConInteractivityOneCoreLib</TargetName>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SolutionDir)src\common.build.pre.props" />
|
||||
<Import Project="$(SolutionDir)src\common.nugetversions.props" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<!--
|
||||
C26429: Symbol '...' is never tested for nullness, it can be marked as not_null (f.23).
|
||||
C26432: If you define or delete any default operation in the type '...', define or delete them all (c.21).
|
||||
C26462: The value pointed to by '...' is assigned only once, mark it as a pointer to const (con.4).
|
||||
C26481: Don't use pointer arithmetic. Use span instead (bounds.1).
|
||||
C26490: Don't use reinterpret_cast (type.1).
|
||||
C26494: Variable '...' is uninitialized. Always initialize an object (type.5).
|
||||
-->
|
||||
<DisableSpecificWarnings>26429;26432;26462;26481;26490;26494;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>IS_INTERACTIVITYBASE_CONSUMER;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\host\newdelete.cpp" />
|
||||
<ClCompile Include="..\AccessibilityNotifier.cpp" />
|
||||
<ClCompile Include="..\BgfxEngine.cpp" />
|
||||
<ClCompile Include="..\ConIoSrvComm.cpp" />
|
||||
<ClCompile Include="..\ConsoleControl.cpp" />
|
||||
<ClCompile Include="..\ConsoleInputThread.cpp" />
|
||||
<ClCompile Include="..\ConsoleWindow.cpp" />
|
||||
@ -27,8 +38,9 @@
|
||||
<ClCompile Include="..\WindowMetrics.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\host\newdelete.hpp" />
|
||||
<ClInclude Include="..\AccessibilityNotifier.hpp" />
|
||||
<ClInclude Include="..\BgfxEngine.hpp" />
|
||||
<ClInclude Include="..\ConIoSrvComm.hpp" />
|
||||
<ClInclude Include="..\ConsoleControl.hpp" />
|
||||
<ClInclude Include="..\ConsoleInputThread.hpp" />
|
||||
<ClInclude Include="..\ConsoleWindow.hpp" />
|
||||
@ -36,6 +48,12 @@
|
||||
<ClInclude Include="..\SystemConfigurationProvider.hpp" />
|
||||
<ClInclude Include="..\WindowMetrics.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- Careful reordering these. Some default props (contained in these files) are order sensitive. -->
|
||||
<Import Project="$(SolutionDir)src\common.build.post.props" />
|
||||
<Import Project="$(SolutionDir)src\common.nugetversions.targets" />
|
||||
</Project>
|
||||
|
||||
@ -39,6 +39,12 @@
|
||||
<ClCompile Include="..\ConsoleWindow.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\BgfxEngine.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ConIoSrvComm.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\precomp.h">
|
||||
@ -65,5 +71,14 @@
|
||||
<ClInclude Include="..\ConsoleWindow.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\BgfxEngine.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ConIoSrvComm.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Natvis Include="$(SolutionDir)tools\ConsoleTypes.natvis" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __INSIDE_WINDOWS
|
||||
|
||||
#define NOMINMAX
|
||||
|
||||
#include <nt.h>
|
||||
@ -16,3 +18,9 @@
|
||||
|
||||
#define _DDK_INCLUDED
|
||||
#include "../../host/precomp.h"
|
||||
|
||||
#else
|
||||
|
||||
#include "../../host/precomp.h"
|
||||
|
||||
#endif
|
||||
|
||||
@ -84,8 +84,6 @@ public:
|
||||
PCWSTR pwszValueName;
|
||||
DWORD dwFieldOffset;
|
||||
size_t cbFieldSize;
|
||||
|
||||
_RegPropertyMap& operator=(const _RegPropertyMap&) { return *this; }
|
||||
} RegPropertyMap;
|
||||
|
||||
static const RegPropertyMap s_PropertyMappings[];
|
||||
|
||||
@ -7,12 +7,6 @@
|
||||
using namespace Microsoft::Console;
|
||||
using namespace Microsoft::Console::Render;
|
||||
|
||||
RenderEngineBase::RenderEngineBase() :
|
||||
_titleChanged(false),
|
||||
_lastFrameTitle(L"")
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT RenderEngineBase::InvalidateTitle(const std::wstring_view proposedTitle) noexcept
|
||||
{
|
||||
if (proposedTitle != _lastFrameTitle)
|
||||
|
||||
@ -23,16 +23,6 @@ namespace Microsoft::Console::Render
|
||||
{
|
||||
class RenderEngineBase : public IRenderEngine
|
||||
{
|
||||
public:
|
||||
~RenderEngineBase() = 0;
|
||||
|
||||
protected:
|
||||
RenderEngineBase();
|
||||
RenderEngineBase(const RenderEngineBase&) = default;
|
||||
RenderEngineBase(RenderEngineBase&&) = default;
|
||||
RenderEngineBase& operator=(const RenderEngineBase&) = default;
|
||||
RenderEngineBase& operator=(RenderEngineBase&&) = default;
|
||||
|
||||
public:
|
||||
[[nodiscard]] HRESULT InvalidateTitle(const std::wstring_view proposedTitle) noexcept override;
|
||||
|
||||
@ -60,9 +50,7 @@ namespace Microsoft::Console::Render
|
||||
protected:
|
||||
[[nodiscard]] virtual HRESULT _DoUpdateTitle(const std::wstring_view newTitle) noexcept = 0;
|
||||
|
||||
bool _titleChanged;
|
||||
bool _titleChanged = false;
|
||||
std::wstring _lastFrameTitle;
|
||||
};
|
||||
|
||||
inline Microsoft::Console::Render::RenderEngineBase::~RenderEngineBase() {}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
using namespace Microsoft::Console::Render;
|
||||
|
||||
WddmConEngine::WddmConEngine() :
|
||||
WddmConEngine::WddmConEngine() noexcept :
|
||||
RenderEngineBase(),
|
||||
_hWddmConCtx(INVALID_HANDLE_VALUE),
|
||||
_displayHeight(0),
|
||||
@ -63,10 +63,11 @@ void WddmConEngine::FreeResources(ULONG displayHeight)
|
||||
|
||||
WddmConEngine::~WddmConEngine()
|
||||
{
|
||||
#pragma warning(suppress : 26447)
|
||||
FreeResources(_displayHeight);
|
||||
}
|
||||
|
||||
[[nodiscard]] HRESULT WddmConEngine::Initialize() noexcept
|
||||
[[nodiscard]] HRESULT WddmConEngine::Initialize()
|
||||
{
|
||||
HRESULT hr;
|
||||
RECT DisplaySize;
|
||||
@ -84,16 +85,16 @@ WddmConEngine::~WddmConEngine()
|
||||
{
|
||||
DisplaySize.top = 0;
|
||||
DisplaySize.left = 0;
|
||||
DisplaySize.bottom = (LONG)DisplaySizeIoctl.Height;
|
||||
DisplaySize.right = (LONG)DisplaySizeIoctl.Width;
|
||||
DisplaySize.bottom = gsl::narrow_cast<LONG>(DisplaySizeIoctl.Height);
|
||||
DisplaySize.right = gsl::narrow_cast<LONG>(DisplaySizeIoctl.Width);
|
||||
|
||||
_displayState = (PCD_IO_ROW_INFORMATION*)calloc(DisplaySize.bottom, sizeof(PCD_IO_ROW_INFORMATION));
|
||||
_displayState = static_cast<PCD_IO_ROW_INFORMATION*>(calloc(DisplaySize.bottom, sizeof(PCD_IO_ROW_INFORMATION)));
|
||||
|
||||
if (_displayState != nullptr)
|
||||
{
|
||||
for (LONG i = 0; i < DisplaySize.bottom; i++)
|
||||
{
|
||||
_displayState[i] = (PCD_IO_ROW_INFORMATION)calloc(1, sizeof(CD_IO_ROW_INFORMATION));
|
||||
_displayState[i] = static_cast<PCD_IO_ROW_INFORMATION>(calloc(1, sizeof(CD_IO_ROW_INFORMATION)));
|
||||
if (_displayState[i] == nullptr)
|
||||
{
|
||||
hr = E_OUTOFMEMORY;
|
||||
@ -101,9 +102,9 @@ WddmConEngine::~WddmConEngine()
|
||||
break;
|
||||
}
|
||||
|
||||
_displayState[i]->Index = (SHORT)i;
|
||||
_displayState[i]->Old = (PCD_IO_CHARACTER)calloc(DisplaySize.right, sizeof(CD_IO_CHARACTER));
|
||||
_displayState[i]->New = (PCD_IO_CHARACTER)calloc(DisplaySize.right, sizeof(CD_IO_CHARACTER));
|
||||
_displayState[i]->Index = gsl::narrow_cast<SHORT>(i);
|
||||
_displayState[i]->Old = static_cast<PCD_IO_CHARACTER>(calloc(DisplaySize.right, sizeof(CD_IO_CHARACTER)));
|
||||
_displayState[i]->New = static_cast<PCD_IO_CHARACTER>(calloc(DisplaySize.right, sizeof(CD_IO_CHARACTER)));
|
||||
|
||||
if (_displayState[i]->Old == nullptr || _displayState[i]->New == nullptr)
|
||||
{
|
||||
@ -144,22 +145,26 @@ WddmConEngine::~WddmConEngine()
|
||||
return hr;
|
||||
}
|
||||
|
||||
bool WddmConEngine::IsInitialized()
|
||||
bool WddmConEngine::IsInitialized() noexcept
|
||||
{
|
||||
return _hWddmConCtx != INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
[[nodiscard]] HRESULT WddmConEngine::Enable() noexcept
|
||||
try
|
||||
{
|
||||
RETURN_IF_HANDLE_INVALID(_hWddmConCtx);
|
||||
return WDDMConEnableDisplayAccess((PHANDLE)_hWddmConCtx, TRUE);
|
||||
RETURN_LAST_ERROR_IF(_hWddmConCtx == INVALID_HANDLE_VALUE);
|
||||
return WDDMConEnableDisplayAccess(_hWddmConCtx, TRUE);
|
||||
}
|
||||
CATCH_RETURN()
|
||||
|
||||
[[nodiscard]] HRESULT WddmConEngine::Disable() noexcept
|
||||
try
|
||||
{
|
||||
RETURN_IF_HANDLE_INVALID(_hWddmConCtx);
|
||||
return WDDMConEnableDisplayAccess((PHANDLE)_hWddmConCtx, FALSE);
|
||||
RETURN_LAST_ERROR_IF(_hWddmConCtx == INVALID_HANDLE_VALUE);
|
||||
return WDDMConEnableDisplayAccess(_hWddmConCtx, FALSE);
|
||||
}
|
||||
CATCH_RETURN()
|
||||
|
||||
[[nodiscard]] HRESULT WddmConEngine::Invalidate(const SMALL_RECT* const /*psrRegion*/) noexcept
|
||||
{
|
||||
@ -198,16 +203,20 @@ bool WddmConEngine::IsInitialized()
|
||||
}
|
||||
|
||||
[[nodiscard]] HRESULT WddmConEngine::StartPaint() noexcept
|
||||
try
|
||||
{
|
||||
RETURN_IF_HANDLE_INVALID(_hWddmConCtx);
|
||||
RETURN_LAST_ERROR_IF(_hWddmConCtx == INVALID_HANDLE_VALUE);
|
||||
return WDDMConBeginUpdateDisplayBatch(_hWddmConCtx);
|
||||
}
|
||||
CATCH_RETURN()
|
||||
|
||||
[[nodiscard]] HRESULT WddmConEngine::EndPaint() noexcept
|
||||
try
|
||||
{
|
||||
RETURN_IF_HANDLE_INVALID(_hWddmConCtx);
|
||||
RETURN_LAST_ERROR_IF(_hWddmConCtx == INVALID_HANDLE_VALUE);
|
||||
return WDDMConEndUpdateDisplayBatch(_hWddmConCtx);
|
||||
}
|
||||
CATCH_RETURN()
|
||||
|
||||
// Routine Description:
|
||||
// - Used to perform longer running presentation steps outside the lock so the other threads can continue.
|
||||
@ -229,17 +238,14 @@ bool WddmConEngine::IsInitialized()
|
||||
|
||||
[[nodiscard]] HRESULT WddmConEngine::PaintBackground() noexcept
|
||||
{
|
||||
RETURN_IF_HANDLE_INVALID(_hWddmConCtx);
|
||||
|
||||
PCD_IO_CHARACTER OldChar;
|
||||
PCD_IO_CHARACTER NewChar;
|
||||
RETURN_LAST_ERROR_IF(_hWddmConCtx == INVALID_HANDLE_VALUE);
|
||||
|
||||
for (LONG rowIndex = 0; rowIndex < _displayHeight; rowIndex++)
|
||||
{
|
||||
for (LONG colIndex = 0; colIndex < _displayWidth; colIndex++)
|
||||
{
|
||||
OldChar = &_displayState[rowIndex]->Old[colIndex];
|
||||
NewChar = &_displayState[rowIndex]->New[colIndex];
|
||||
const auto OldChar = &_displayState[rowIndex]->Old[colIndex];
|
||||
const auto NewChar = &_displayState[rowIndex]->New[colIndex];
|
||||
|
||||
OldChar->Character = NewChar->Character;
|
||||
OldChar->Attribute = NewChar->Attribute;
|
||||
@ -259,15 +265,12 @@ bool WddmConEngine::IsInitialized()
|
||||
{
|
||||
try
|
||||
{
|
||||
RETURN_IF_HANDLE_INVALID(_hWddmConCtx);
|
||||
RETURN_LAST_ERROR_IF(_hWddmConCtx == INVALID_HANDLE_VALUE);
|
||||
|
||||
PCD_IO_CHARACTER OldChar;
|
||||
PCD_IO_CHARACTER NewChar;
|
||||
|
||||
for (size_t i = 0; i < clusters.size() && i < (size_t)_displayWidth; i++)
|
||||
for (size_t i = 0; i < clusters.size() && i < gsl::narrow_cast<size_t>(_displayWidth); i++)
|
||||
{
|
||||
OldChar = &_displayState[coord.Y]->Old[coord.X + i];
|
||||
NewChar = &_displayState[coord.Y]->New[coord.X + i];
|
||||
const auto OldChar = &_displayState[coord.Y]->Old[coord.X + i];
|
||||
const auto NewChar = &_displayState[coord.Y]->New[coord.X + i];
|
||||
|
||||
OldChar->Character = NewChar->Character;
|
||||
OldChar->Attribute = NewChar->Attribute;
|
||||
@ -337,6 +340,7 @@ bool WddmConEngine::IsInitialized()
|
||||
const int /*iDpi*/) noexcept
|
||||
{
|
||||
COORD coordSize = { 0 };
|
||||
#pragma warning(suppress : 26447)
|
||||
LOG_IF_FAILED(GetFontSize(&coordSize));
|
||||
|
||||
fiFontInfo.SetFromEngine(fiFontInfo.GetFaceName(),
|
||||
@ -360,7 +364,7 @@ bool WddmConEngine::IsInitialized()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
RECT WddmConEngine::GetDisplaySize()
|
||||
RECT WddmConEngine::GetDisplaySize() noexcept
|
||||
{
|
||||
RECT r;
|
||||
r.top = 0;
|
||||
|
||||
@ -10,11 +10,11 @@ namespace Microsoft::Console::Render
|
||||
class WddmConEngine final : public RenderEngineBase
|
||||
{
|
||||
public:
|
||||
WddmConEngine();
|
||||
WddmConEngine() noexcept;
|
||||
~WddmConEngine() override;
|
||||
|
||||
[[nodiscard]] HRESULT Initialize() noexcept;
|
||||
bool IsInitialized();
|
||||
[[nodiscard]] HRESULT Initialize();
|
||||
bool IsInitialized() noexcept;
|
||||
|
||||
// Used to release device resources so that another instance of
|
||||
// conhost can render to the screen (i.e. only one DirectX
|
||||
@ -22,7 +22,7 @@ namespace Microsoft::Console::Render
|
||||
[[nodiscard]] HRESULT Enable() noexcept override;
|
||||
[[nodiscard]] HRESULT Disable() noexcept;
|
||||
|
||||
RECT GetDisplaySize();
|
||||
RECT GetDisplaySize() noexcept;
|
||||
|
||||
// IRenderEngine Members
|
||||
[[nodiscard]] HRESULT Invalidate(const SMALL_RECT* const psrRegion) noexcept override;
|
||||
|
||||
46
src/renderer/wddmcon/lib/wddmcon.vcxproj
Normal file
46
src/renderer/wddmcon/lib/wddmcon.vcxproj
Normal file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{75C6F576-18E9-4566-978A-F0A301CAC090}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>wddmcon</RootNamespace>
|
||||
<ProjectName>RendererWddmCon</ProjectName>
|
||||
<TargetName>ConRenderWddmCon</TargetName>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SolutionDir)src\common.build.pre.props" />
|
||||
<Import Project="$(SolutionDir)src\common.nugetversions.props" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<!--
|
||||
C6001: Using uninitialized memory '...'.
|
||||
C26408: Avoid malloc() and free(), prefer the nothrow version of new with delete (r.10).
|
||||
C26429: Symbol '...' is never tested for nullness, it can be marked as not_null (f.23).
|
||||
C26430: Symbol '...' is not tested for nullness on all paths (f.23).
|
||||
C26432: If you define or delete any default operation in the type '...', define or delete them all (c.21).
|
||||
C26446: Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4).
|
||||
C26481: Don't use pointer arithmetic. Use span instead (bounds.1).
|
||||
C26482: Only index into arrays using constant expressions (bounds.2).
|
||||
C26490: Don't use reinterpret_cast (type.1).
|
||||
C26494: Variable '...' is uninitialized. Always initialize an object (type.5).
|
||||
-->
|
||||
<DisableSpecificWarnings>6001;26408;26429;26430;26432;26446;26481;26482;26490;26494;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>IS_INTERACTIVITYBASE_CONSUMER;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\main.cxx" />
|
||||
<ClCompile Include="..\precomp.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\WddmConRenderer.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\main.h" />
|
||||
<ClInclude Include="..\precomp.h" />
|
||||
<ClInclude Include="..\WddmConRenderer.hpp" />
|
||||
</ItemGroup>
|
||||
<!-- Careful reordering these. Some default props (contained in these files) are order sensitive. -->
|
||||
<Import Project="$(SolutionDir)src\common.build.post.props" />
|
||||
<Import Project="$(SolutionDir)src\common.nugetversions.targets" />
|
||||
</Project>
|
||||
16
src/renderer/wddmcon/lib/wddmcon.vcxproj.filters
Normal file
16
src/renderer/wddmcon/lib/wddmcon.vcxproj.filters
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Natvis Include="$(SolutionDir)tools\ConsoleTypes.natvis" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\precomp.cpp" />
|
||||
<ClCompile Include="..\WddmConRenderer.cpp" />
|
||||
<ClCompile Include="..\main.cxx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\precomp.h" />
|
||||
<ClInclude Include="..\WddmConRenderer.hpp" />
|
||||
<ClInclude Include="..\main.h" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -16,7 +16,7 @@ HINSTANCE g_hInstance;
|
||||
#define REGSTR_VALUE_DISPLAY_INIT_DELAY L"DisplayInitDelay"
|
||||
#define REGSTR_VALUE_FONT_SIZE L"FontSize"
|
||||
|
||||
#define SafeRelease(p) if (p) { (p)->Release(); (p) = NULL;}
|
||||
#define SafeRelease(p) if (p) { (p)->Release(); (p) = nullptr;}
|
||||
|
||||
typedef struct tagWDDMCONSOLECONTEXT {
|
||||
// Console state
|
||||
@ -73,7 +73,7 @@ ReleaseDeviceResources(
|
||||
{
|
||||
// To ensure the swap chain goes away we must unbind any views from the
|
||||
// D3D pipeline
|
||||
pCtx->pD3DDeviceContext->OMSetRenderTargets(0, NULL, NULL);
|
||||
pCtx->pD3DDeviceContext->OMSetRenderTargets(0, nullptr, nullptr);
|
||||
}
|
||||
SafeRelease(pCtx->pD3DDeviceContext);
|
||||
|
||||
@ -90,31 +90,31 @@ WDDMConDestroy(
|
||||
_In_ HANDLE hDisplay
|
||||
)
|
||||
{
|
||||
if (hDisplay != NULL) {
|
||||
PWDDMCONSOLECONTEXT pCtx = (PWDDMCONSOLECONTEXT)hDisplay;
|
||||
if (hDisplay != nullptr) {
|
||||
const auto pCtx = static_cast<PWDDMCONSOLECONTEXT>(hDisplay);
|
||||
ReleaseDeviceResources(pCtx);
|
||||
SafeRelease(pCtx->pDWriteTextFormat);
|
||||
SafeRelease(pCtx->pDWriteFactory);
|
||||
SafeRelease(pCtx->pD2DFactory);
|
||||
|
||||
RtlFreeHeap(RtlProcessHeap(), 0, (PVOID)pCtx->pwszGlyphRunAccel);
|
||||
RtlFreeHeap(RtlProcessHeap(), 0, (PVOID)pCtx);
|
||||
free(pCtx->pwszGlyphRunAccel);
|
||||
free(pCtx);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT
|
||||
ReadSettings(
|
||||
_Inout_ PWDDMCONSOLECONTEXT pCtx
|
||||
)
|
||||
) noexcept
|
||||
{
|
||||
auto hr = S_OK;
|
||||
DWORD Error = ERROR_SUCCESS;
|
||||
HKEY hKey = NULL;
|
||||
DWORD ValueType = REG_NONE;
|
||||
HKEY hKey = nullptr;
|
||||
auto ValueType = REG_NONE;
|
||||
DWORD ValueSize = 0;
|
||||
DWORD ValueData = 0;
|
||||
|
||||
if (pCtx == NULL) {
|
||||
if (pCtx == nullptr) {
|
||||
hr = E_INVALIDARG;
|
||||
}
|
||||
|
||||
@ -135,9 +135,9 @@ ReadSettings(
|
||||
|
||||
Error = RegQueryValueEx(hKey,
|
||||
REGSTR_VALUE_DISPLAY_INIT_DELAY,
|
||||
NULL,
|
||||
nullptr,
|
||||
&ValueType,
|
||||
(PBYTE)&ValueData,
|
||||
reinterpret_cast<PBYTE>(&ValueData),
|
||||
&ValueSize);
|
||||
|
||||
if ((Error == ERROR_SUCCESS) &&
|
||||
@ -150,20 +150,20 @@ ReadSettings(
|
||||
|
||||
Error = RegQueryValueEx(hKey,
|
||||
REGSTR_VALUE_FONT_SIZE,
|
||||
NULL,
|
||||
nullptr,
|
||||
&ValueType,
|
||||
(PBYTE)&ValueData,
|
||||
reinterpret_cast<PBYTE>(&ValueData),
|
||||
&ValueSize);
|
||||
|
||||
if ((Error == ERROR_SUCCESS) &&
|
||||
(ValueType == REG_DWORD) &&
|
||||
(ValueSize == sizeof(ValueData)) &&
|
||||
(ValueData > 0)) {
|
||||
pCtx->FontSize = (float)ValueData;
|
||||
pCtx->FontSize = static_cast<float>(ValueData);
|
||||
}
|
||||
}
|
||||
|
||||
if (hKey != NULL) {
|
||||
if (hKey != nullptr) {
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
@ -173,23 +173,23 @@ ReadSettings(
|
||||
HRESULT
|
||||
CreateTextLayout(
|
||||
_In_ PWDDMCONSOLECONTEXT pCtx,
|
||||
_In_reads_(StringLength) WCHAR *String,
|
||||
_In_reads_(StringLength) const wchar_t *String,
|
||||
_In_ size_t StringLength,
|
||||
_Out_ IDWriteTextLayout **ppTextLayout
|
||||
)
|
||||
) noexcept
|
||||
{
|
||||
auto hr = S_OK;
|
||||
|
||||
if (pCtx == NULL) {
|
||||
if (pCtx == nullptr) {
|
||||
hr = E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
hr = pCtx->pDWriteFactory->CreateTextLayout(String,
|
||||
static_cast<UINT32>(StringLength),
|
||||
gsl::narrow_cast<UINT32>(StringLength),
|
||||
pCtx->pDWriteTextFormat,
|
||||
(float)pCtx->DisplayMode.Width,
|
||||
pCtx->LineHeight != 0 ? pCtx->LineHeight : (float)pCtx->DisplayMode.Height,
|
||||
static_cast<float>(pCtx->DisplayMode.Width),
|
||||
pCtx->LineHeight != 0 ? pCtx->LineHeight : static_cast<float>(pCtx->DisplayMode.Height),
|
||||
ppTextLayout);
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ CreateDeviceResources(
|
||||
ReleaseDeviceResources(pCtx);
|
||||
}
|
||||
|
||||
HRESULT hr = CreateDXGIFactory1(IID_PPV_ARGS(&pCtx->pDXGIFactory2));
|
||||
auto hr = CreateDXGIFactory1(IID_PPV_ARGS(&pCtx->pDXGIFactory2));
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
hr = pCtx->pDXGIFactory2->QueryInterface(IID_PPV_ARGS(&pCtx->pDXGIFactoryDWM));
|
||||
@ -261,10 +261,10 @@ CreateDeviceResources(
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
DWORD DeviceFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT |
|
||||
D3D11_CREATE_DEVICE_SINGLETHREADED;
|
||||
const DWORD DeviceFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT |
|
||||
D3D11_CREATE_DEVICE_SINGLETHREADED;
|
||||
|
||||
D3D_FEATURE_LEVEL FeatureLevels[] = {
|
||||
static constexpr D3D_FEATURE_LEVEL FeatureLevels[] = {
|
||||
D3D_FEATURE_LEVEL_11_1,
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_10_1,
|
||||
@ -274,13 +274,13 @@ CreateDeviceResources(
|
||||
|
||||
hr = D3D11CreateDevice(pCtx->pDXGIAdapter1,
|
||||
D3D_DRIVER_TYPE_UNKNOWN,
|
||||
NULL,
|
||||
nullptr,
|
||||
DeviceFlags,
|
||||
FeatureLevels,
|
||||
&FeatureLevels[0],
|
||||
ARRAYSIZE(FeatureLevels),
|
||||
D3D11_SDK_VERSION,
|
||||
&pCtx->pD3DDevice,
|
||||
NULL,
|
||||
nullptr,
|
||||
&pCtx->pD3DDeviceContext);
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ CreateDeviceResources(
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
DXGI_MODE_DESC currentmode = {0};
|
||||
const DXGI_MODE_DESC currentmode = {0};
|
||||
hr = pCtx->pDXGIOutput->FindClosestMatchingMode(¤tmode,
|
||||
&pCtx->DisplayMode,
|
||||
pCtx->pD3DDevice);
|
||||
@ -298,8 +298,8 @@ CreateDeviceResources(
|
||||
if (fCreateSwapChain) {
|
||||
if (SUCCEEDED(hr)) {
|
||||
D3D11_VIEWPORT viewport;
|
||||
viewport.Width = (FLOAT)pCtx->DisplayMode.Width;
|
||||
viewport.Height = (FLOAT)pCtx->DisplayMode.Height;
|
||||
viewport.Width = static_cast<FLOAT>(pCtx->DisplayMode.Width);
|
||||
viewport.Height = static_cast<FLOAT>(pCtx->DisplayMode.Height);
|
||||
viewport.TopLeftX = 0;
|
||||
viewport.TopLeftY = 0;
|
||||
viewport.MinDepth = 0;
|
||||
@ -309,7 +309,7 @@ CreateDeviceResources(
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
DXGI_SWAP_CHAIN_DESC SwapChainDesc = { 0 };
|
||||
DXGI_SAMPLE_DESC LocalSampleDesc = { 1, 0 };
|
||||
const DXGI_SAMPLE_DESC LocalSampleDesc = { 1, 0 };
|
||||
|
||||
SwapChainDesc.BufferDesc.Width = 0;
|
||||
SwapChainDesc.BufferDesc.Height = 0;
|
||||
@ -322,7 +322,7 @@ CreateDeviceResources(
|
||||
SwapChainDesc.SampleDesc = LocalSampleDesc;
|
||||
SwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER;
|
||||
SwapChainDesc.BufferCount = 2;
|
||||
SwapChainDesc.OutputWindow = NULL;
|
||||
SwapChainDesc.OutputWindow = nullptr;
|
||||
SwapChainDesc.Windowed = FALSE;
|
||||
SwapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL;
|
||||
SwapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_NONPREROTATED;
|
||||
@ -338,8 +338,7 @@ CreateDeviceResources(
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
|
||||
D2D1_RENDER_TARGET_PROPERTIES props =
|
||||
const auto props =
|
||||
D2D1::RenderTargetProperties(
|
||||
D2D1_RENDER_TARGET_TYPE_DEFAULT,
|
||||
D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED),
|
||||
@ -376,14 +375,11 @@ WDDMConCreate(
|
||||
)
|
||||
{
|
||||
auto hr = S_OK;
|
||||
IDWriteTextLayout *pTextLayout = NULL;
|
||||
IDWriteTextLayout *pTextLayout = nullptr;
|
||||
DWRITE_TEXT_METRICS TextMetrics = {};
|
||||
PWDDMCONSOLECONTEXT pCtx =
|
||||
(PWDDMCONSOLECONTEXT)RtlAllocateHeap(RtlProcessHeap(),
|
||||
0,
|
||||
sizeof(WDDMCONSOLECONTEXT));
|
||||
const auto pCtx = static_cast<PWDDMCONSOLECONTEXT>(malloc(sizeof(WDDMCONSOLECONTEXT)));
|
||||
|
||||
if (pCtx == NULL) {
|
||||
if (pCtx == nullptr) {
|
||||
hr = E_OUTOFMEMORY;
|
||||
} else {
|
||||
RtlZeroMemory(pCtx, sizeof(WDDMCONSOLECONTEXT));
|
||||
@ -411,7 +407,7 @@ WDDMConCreate(
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
hr = pCtx->pDWriteFactory->CreateTextFormat(FONT_FACE,
|
||||
NULL,
|
||||
nullptr,
|
||||
DWRITE_FONT_WEIGHT_NORMAL,
|
||||
DWRITE_FONT_STYLE_NORMAL,
|
||||
DWRITE_FONT_STRETCH_NORMAL,
|
||||
@ -448,21 +444,20 @@ WDDMConCreate(
|
||||
#pragma warning(disable : 4996) // GetDesktopDpi is deprecated.
|
||||
pCtx->pD2DFactory->GetDesktopDpi(&pCtx->DpiX, &pCtx->DpiY);
|
||||
#pragma warning(pop)
|
||||
float MaxWidth = pTextLayout->GetMaxWidth();
|
||||
float MaxHeight = pTextLayout->GetMaxHeight();
|
||||
pCtx->GlyphWidth = (float)(ULONG)(pCtx->GlyphWidth);
|
||||
pCtx->LineHeight = (float)(ULONG)(pCtx->LineHeight);
|
||||
pCtx->DisplaySize.Width = (ULONG)(MaxWidth / pCtx->GlyphWidth);
|
||||
pCtx->DisplaySize.Height = (ULONG)(MaxHeight / pCtx->LineHeight) + 1;
|
||||
const auto MaxWidth = pTextLayout->GetMaxWidth();
|
||||
const auto MaxHeight = pTextLayout->GetMaxHeight();
|
||||
pCtx->GlyphWidth = floor(pCtx->GlyphWidth);
|
||||
pCtx->LineHeight = floor(pCtx->LineHeight);
|
||||
pCtx->DisplaySize.Width = static_cast<ULONG>(MaxWidth / pCtx->GlyphWidth);
|
||||
pCtx->DisplaySize.Height = static_cast<ULONG>(MaxHeight / pCtx->LineHeight) + 1;
|
||||
pCtx->DisplaySize.Width -= CONSOLE_MARGIN * 2;
|
||||
pCtx->DisplaySize.Height -= CONSOLE_MARGIN * 2;
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
pCtx->pwszGlyphRunAccel = (WCHAR*)RtlAllocateHeap(RtlProcessHeap(),
|
||||
0,
|
||||
sizeof(WCHAR) * (pCtx->DisplaySize.Width + 1));
|
||||
if (pCtx->pwszGlyphRunAccel == NULL) {
|
||||
const size_t width = pCtx->DisplaySize.Width;
|
||||
pCtx->pwszGlyphRunAccel = static_cast<WCHAR*>(malloc(sizeof(WCHAR) * (width + 1)));
|
||||
if (pCtx->pwszGlyphRunAccel == nullptr) {
|
||||
hr = E_OUTOFMEMORY;
|
||||
}
|
||||
}
|
||||
@ -470,8 +465,8 @@ WDDMConCreate(
|
||||
SafeRelease(pTextLayout);
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
*phDisplay = (HANDLE)pCtx;
|
||||
} else if (pCtx != NULL) {
|
||||
*phDisplay = pCtx;
|
||||
} else if (pCtx != nullptr) {
|
||||
WDDMConDestroy(pCtx);
|
||||
}
|
||||
|
||||
@ -502,12 +497,12 @@ WDDMConBeginUpdateDisplayBatch(
|
||||
)
|
||||
{
|
||||
auto hr = S_OK;
|
||||
PWDDMCONSOLECONTEXT pCtx = NULL;
|
||||
PWDDMCONSOLECONTEXT pCtx = nullptr;
|
||||
|
||||
if (hDisplay == NULL) {
|
||||
if (hDisplay == nullptr) {
|
||||
hr = E_INVALIDARG;
|
||||
} else {
|
||||
pCtx = (PWDDMCONSOLECONTEXT)hDisplay;
|
||||
pCtx = static_cast<PWDDMCONSOLECONTEXT>(hDisplay);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr) && pCtx->fInD2DBatch) {
|
||||
@ -535,12 +530,12 @@ WDDMConEndUpdateDisplayBatch(
|
||||
)
|
||||
{
|
||||
auto hr = S_OK;
|
||||
PWDDMCONSOLECONTEXT pCtx = NULL;
|
||||
PWDDMCONSOLECONTEXT pCtx = nullptr;
|
||||
|
||||
if (hDisplay == NULL) {
|
||||
if (hDisplay == nullptr) {
|
||||
hr = E_INVALIDARG;
|
||||
} else {
|
||||
pCtx = (PWDDMCONSOLECONTEXT)hDisplay;
|
||||
pCtx = static_cast<PWDDMCONSOLECONTEXT>(hDisplay);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr) && !pCtx->fInD2DBatch) {
|
||||
@ -568,17 +563,17 @@ HRESULT
|
||||
WINAPI
|
||||
WDDMConUpdateDisplay(
|
||||
_In_ HANDLE hDisplay,
|
||||
_In_ CD_IO_ROW_INFORMATION *pRowInformation,
|
||||
_In_ const CD_IO_ROW_INFORMATION *pRowInformation,
|
||||
_In_ BOOLEAN fInvalidate
|
||||
)
|
||||
{
|
||||
auto hr = S_OK;
|
||||
PWDDMCONSOLECONTEXT pCtx = NULL;
|
||||
PWDDMCONSOLECONTEXT pCtx = nullptr;
|
||||
|
||||
if (hDisplay == NULL || pRowInformation == NULL) {
|
||||
if (hDisplay == nullptr || pRowInformation == nullptr) {
|
||||
hr = E_INVALIDARG;
|
||||
} else {
|
||||
pCtx = (PWDDMCONSOLECONTEXT)hDisplay;
|
||||
pCtx = static_cast<PWDDMCONSOLECONTEXT>(hDisplay);
|
||||
}
|
||||
|
||||
// To prevent an infinite loop, we need to limit the number of times we try to render.
|
||||
@ -589,7 +584,7 @@ WDDMConUpdateDisplay(
|
||||
|
||||
ReRender:
|
||||
ULONG ColumnIndex = 0;
|
||||
float LineY = 0.0f;
|
||||
auto LineY = 0.0f;
|
||||
if (SUCCEEDED(hr) && pCtx->fOutputEnabled) {
|
||||
if (SUCCEEDED(hr) && !pCtx->fHaveDeviceResources) {
|
||||
hr = CreateDeviceResources(pCtx, TRUE);
|
||||
@ -604,15 +599,15 @@ ReRender:
|
||||
}
|
||||
|
||||
while (SUCCEEDED(hr)) {
|
||||
IDWriteTextLayout *pTextLayout = NULL;
|
||||
IDWriteTextLayout *pTextLayout = nullptr;
|
||||
if (fInvalidate ||
|
||||
(memcmp(&pRowInformation->New[ColumnIndex],
|
||||
&pRowInformation->Old[ColumnIndex],
|
||||
sizeof(CD_IO_CHARACTER)) != 0)) {
|
||||
PCD_IO_CHARACTER pCharacter = &pRowInformation->New[ColumnIndex];
|
||||
float CharacterOrigin = (ColumnIndex + CONSOLE_MARGIN) * pCtx->GlyphWidth;
|
||||
ULONG ColumnIndexStart = ColumnIndex;
|
||||
ULONG ColumnIndexReadAhead = ColumnIndex + 1;
|
||||
const auto* const pCharacter = &pRowInformation->New[ColumnIndex];
|
||||
const auto CharacterOrigin = (ColumnIndex + CONSOLE_MARGIN) * pCtx->GlyphWidth;
|
||||
const auto ColumnIndexStart = ColumnIndex;
|
||||
auto ColumnIndexReadAhead = ColumnIndex + 1;
|
||||
ULONG GlyphRunLength;
|
||||
|
||||
pCtx->pwszGlyphRunAccel[ColumnIndex] = pRowInformation->New[ColumnIndex].Character;
|
||||
@ -644,26 +639,26 @@ ReRender:
|
||||
ColumnIndex = ColumnIndexReadAhead - 1;
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
D2D1_RECT_F GlyphRectangle = D2D1::RectF(CharacterOrigin,
|
||||
LineY,
|
||||
CharacterOrigin + pCtx->GlyphWidth * GlyphRunLength,
|
||||
LineY + pCtx->LineHeight);
|
||||
D2D1_POINT_2F Origin = D2D1::Point2F(CharacterOrigin, LineY);
|
||||
auto GlyphRectangle = D2D1::RectF(CharacterOrigin,
|
||||
LineY,
|
||||
CharacterOrigin + pCtx->GlyphWidth * GlyphRunLength,
|
||||
LineY + pCtx->LineHeight);
|
||||
const auto Origin = D2D1::Point2F(CharacterOrigin, LineY);
|
||||
|
||||
if (ColumnIndexStart == 0) {
|
||||
GlyphRectangle.left = 0.0f;
|
||||
}
|
||||
|
||||
if ((UINT)pRowInformation->Index == 0) {
|
||||
if (static_cast<UINT>(pRowInformation->Index) == 0) {
|
||||
GlyphRectangle.top = 0.0f;
|
||||
}
|
||||
|
||||
if (ColumnIndex == pCtx->DisplaySize.Width - 1) {
|
||||
GlyphRectangle.right = (float)pCtx->DisplayMode.Width;
|
||||
GlyphRectangle.right = static_cast<float>(pCtx->DisplayMode.Width);
|
||||
}
|
||||
|
||||
if ((UINT)pRowInformation->Index == pCtx->DisplaySize.Height - 1) {
|
||||
GlyphRectangle.bottom = (float)pCtx->DisplayMode.Height;
|
||||
if (static_cast<UINT>(pRowInformation->Index) == pCtx->DisplaySize.Height - 1) {
|
||||
GlyphRectangle.bottom = static_cast<float>(pCtx->DisplayMode.Height);
|
||||
}
|
||||
|
||||
pCtx->pD2DColorBrush->SetColor(
|
||||
@ -696,13 +691,14 @@ ReRender:
|
||||
}
|
||||
}
|
||||
|
||||
if (FAILED(hr) && pCtx != NULL && pCtx->fHaveDeviceResources) {
|
||||
if (FAILED(hr) && pCtx != nullptr && pCtx->fHaveDeviceResources) {
|
||||
ReleaseDeviceResources(pCtx);
|
||||
RenderAttempts++;
|
||||
|
||||
if (RenderAttempts < MAX_RENDER_ATTEMPTS)
|
||||
{
|
||||
hr = S_OK;
|
||||
#pragma warning(suppress : 26438 26448)
|
||||
goto ReRender;
|
||||
}
|
||||
}
|
||||
@ -717,15 +713,15 @@ WINAPI
|
||||
WDDMConGetDisplaySize(
|
||||
_In_ HANDLE hDisplay,
|
||||
_In_ CD_IO_DISPLAY_SIZE *pDisplaySize
|
||||
)
|
||||
) noexcept
|
||||
{
|
||||
auto hr = S_OK;
|
||||
PWDDMCONSOLECONTEXT pCtx = NULL;
|
||||
PWDDMCONSOLECONTEXT pCtx = nullptr;
|
||||
|
||||
if (hDisplay == NULL) {
|
||||
if (hDisplay == nullptr) {
|
||||
hr = E_INVALIDARG;
|
||||
} else {
|
||||
pCtx = (PWDDMCONSOLECONTEXT)hDisplay;
|
||||
pCtx = static_cast<PWDDMCONSOLECONTEXT>(hDisplay);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
@ -743,12 +739,12 @@ WDDMConEnableDisplayAccess(
|
||||
)
|
||||
{
|
||||
auto hr = S_OK;
|
||||
PWDDMCONSOLECONTEXT pCtx = NULL;
|
||||
PWDDMCONSOLECONTEXT pCtx = nullptr;
|
||||
|
||||
if (hDisplay == NULL) {
|
||||
if (hDisplay == nullptr) {
|
||||
hr = E_INVALIDARG;
|
||||
} else {
|
||||
pCtx = (PWDDMCONSOLECONTEXT)hDisplay;
|
||||
pCtx = static_cast<PWDDMCONSOLECONTEXT>(hDisplay);
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr) &&
|
||||
|
||||
@ -32,11 +32,11 @@ HRESULT
|
||||
WINAPI
|
||||
WDDMConGetDisplaySize(
|
||||
_In_ HANDLE hDisplay,
|
||||
_In_ CD_IO_DISPLAY_SIZE* pDisplaySize);
|
||||
_In_ CD_IO_DISPLAY_SIZE* pDisplaySize) noexcept;
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
WDDMConUpdateDisplay(
|
||||
_In_ HANDLE hDisplay,
|
||||
_In_ CD_IO_ROW_INFORMATION* pRowInformation,
|
||||
_In_ const CD_IO_ROW_INFORMATION* pRowInformation,
|
||||
_In_ BOOLEAN fInvalidate);
|
||||
|
||||
24
src/renderer/wddmcon/oss_shim.h
Normal file
24
src/renderer/wddmcon/oss_shim.h
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef _Return_type_success_(return >= 0) LONG NTSTATUS;
|
||||
|
||||
#include "../host/conddkrefs.h"
|
||||
#include <condrv.h>
|
||||
|
||||
// This is a fake interface, not to be confused with the actual private one.
|
||||
MIDL_INTERFACE("e962a0bf-ba8c-4150-9939-4297b11329b6")
|
||||
IDXGISwapChainDWM : IUnknown
|
||||
{
|
||||
virtual HRESULT STDMETHODCALLTYPE Present(UINT SyncInterval, UINT Flags) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE GetBuffer(UINT Buffer, REFIID riid, void** ppSurface) = 0;
|
||||
};
|
||||
|
||||
// This is a fake interface, not to be confused with the actual private one.
|
||||
MIDL_INTERFACE("599628c0-c2c6-4720-8885-17abe0fd43f2")
|
||||
IDXGIFactoryDWM : IUnknown
|
||||
{
|
||||
virtual HRESULT STDMETHODCALLTYPE CreateSwapChain(IUnknown * pDevice, DXGI_SWAP_CHAIN_DESC * pDesc, IDXGIOutput * pTarget, IDXGISwapChainDWM * *ppSwapChain) = 0;
|
||||
};
|
||||
@ -4,29 +4,25 @@
|
||||
#pragma once
|
||||
|
||||
#define NOMINMAX
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <nt.h>
|
||||
#include <ntrtl.h>
|
||||
#include <nturtl.h>
|
||||
#include <Windows.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <condrv.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <exception>
|
||||
#include <typeinfo>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <dxgi.h>
|
||||
#include <dxgidwm.h>
|
||||
#include <dxgi1_2.h>
|
||||
#include <d3d11.h>
|
||||
#include <d2d1.h>
|
||||
#include <d2d1helper.h>
|
||||
#include <dwrite.h>
|
||||
|
||||
#ifdef __INSIDE_WINDOWS
|
||||
#include <nt.h>
|
||||
#include <ntrtl.h>
|
||||
#include <nturtl.h>
|
||||
#include <dxgidwm.h>
|
||||
#include <condrv.h>
|
||||
#else
|
||||
#include "oss_shim.h"
|
||||
#endif
|
||||
|
||||
// This includes support libraries from the CRT, STL, WIL, and GSL
|
||||
#include "LibraryIncludes.h"
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
@ -44,7 +44,7 @@ public:
|
||||
|
||||
#pragma endregion
|
||||
|
||||
virtual ~IApiRoutines(){};
|
||||
virtual ~IApiRoutines() = default;
|
||||
|
||||
#pragma region L1
|
||||
virtual void GetConsoleInputCodePageImpl(ULONG& codepage) noexcept = 0;
|
||||
|
||||
@ -29,15 +29,13 @@ enum class ReplyDataType
|
||||
class IWaitRoutine
|
||||
{
|
||||
public:
|
||||
IWaitRoutine(ReplyDataType type) :
|
||||
IWaitRoutine(ReplyDataType type) noexcept :
|
||||
_ReplyType(type)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~IWaitRoutine()
|
||||
{
|
||||
}
|
||||
virtual ~IWaitRoutine() = default;
|
||||
|
||||
virtual void MigrateUserBuffersOnTransitionToBackgroundWait(const void* oldBuffer, void* newBuffer) = 0;
|
||||
|
||||
@ -48,7 +46,7 @@ public:
|
||||
_Out_ DWORD* const pControlKeyState,
|
||||
_Out_ void* const pOutputData) = 0;
|
||||
|
||||
ReplyDataType GetReplyType() const
|
||||
ReplyDataType GetReplyType() const noexcept
|
||||
{
|
||||
return _ReplyType;
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ public:
|
||||
|
||||
// NOTE: This class must have a virtual method for the stored "this" pointers to match what we're actually looking for.
|
||||
// If there is no virtual method, we may have the "this" pointer be offset by 8 from the actual object that inherits ConsoleObjectHeader.
|
||||
virtual ~ConsoleObjectHeader(){};
|
||||
virtual ~ConsoleObjectHeader() = default;
|
||||
|
||||
[[nodiscard]] HRESULT AllocateIoHandle(const ConsoleHandleData::HandleType ulHandleType,
|
||||
const ACCESS_MASK amDesired,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user