https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d684f906320d909786536…
commit d684f906320d9097865369ee94dbf1fc6890277b
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sat Dec 14 18:05:45 2019 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Dec 15 03:36:17 2019 +0100
[BLUE] Code formatting, add SAL2 annotations, and update file source headers.
---
drivers/setup/blue/blue.c | 1255 ++++++++++++++-------------
drivers/setup/blue/blue.h | 72 +-
drivers/setup/blue/font.c | 32 +-
sdk/include/reactos/drivers/blue/ntddblue.h | 40 +-
4 files changed, 709 insertions(+), 690 deletions(-)
diff --git a/drivers/setup/blue/blue.c b/drivers/setup/blue/blue.c
index 7aa4f9d5d2e..23335819b5a 100644
--- a/drivers/setup/blue/blue.c
+++ b/drivers/setup/blue/blue.c
@@ -1,11 +1,10 @@
/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: services/dd/blue/blue.c
- * PURPOSE: Console (blue screen) device driver
- * PROGRAMMER: Eric Kohl
- * UPDATE HISTORY:
- * ??? Created
+ * PROJECT: ReactOS Console Text-Mode Device Driver
+ * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Driver Management Functions.
+ * COPYRIGHT: Copyright 1999 Boudewijn Dekker
+ * Copyright 1999-2019 Eric Kohl
+ * Copyright 2006 Filip Navara
*/
/* INCLUDES ******************************************************************/
@@ -20,69 +19,69 @@
* [[character][attribute]][[character][attribute]]....
*/
-
/* TYPEDEFS ***************************************************************/
typedef struct _DEVICE_EXTENSION
{
- PUCHAR VideoMemory; /* Pointer to video memory */
- ULONG CursorSize;
- INT CursorVisible;
+ PUCHAR VideoMemory; /* Pointer to video memory */
+ ULONG CursorSize;
+ INT CursorVisible;
USHORT CharAttribute;
- ULONG Mode;
- UCHAR ScanLines; /* Height of a text line */
- USHORT Rows; /* Number of rows */
- USHORT Columns; /* Number of columns */
+ ULONG Mode;
+ UCHAR ScanLines; /* Height of a text line */
+ USHORT Rows; /* Number of rows */
+ USHORT Columns; /* Number of columns */
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
typedef struct _VGA_REGISTERS
{
- UCHAR CRT[24];
- UCHAR Attribute[21];
- UCHAR Graphics[9];
- UCHAR Sequencer[5];
- UCHAR Misc;
+ UCHAR CRT[24];
+ UCHAR Attribute[21];
+ UCHAR Graphics[9];
+ UCHAR Sequencer[5];
+ UCHAR Misc;
} VGA_REGISTERS, *PVGA_REGISTERS;
static const VGA_REGISTERS VidpMode3Regs =
{
- /* CRT Controller Registers */
- {0x5F, 0x4F, 0x50, 0x82, 0x55, 0x81, 0xBF, 0x1F, 0x00, 0x47, 0x1E, 0x00,
+ /* CRT Controller Registers */
+ {0x5F, 0x4F, 0x50, 0x82, 0x55, 0x81, 0xBF, 0x1F, 0x00, 0x47, 0x1E, 0x00,
0x00, 0x00, 0x05, 0xF0, 0x9C, 0x8E, 0x8F, 0x28, 0x1F, 0x96, 0xB9, 0xA3},
- /* Attribute Controller Registers */
- {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B,
+ /* Attribute Controller Registers */
+ {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B,
0x3C, 0x3D, 0x3E, 0x3F, 0x0C, 0x00, 0x0F, 0x08, 0x00},
- /* Graphics Controller Registers */
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0E, 0x00, 0xFF},
- /* Sequencer Registers */
- {0x03, 0x00, 0x03, 0x00, 0x02},
- /* Misc Output Register */
- 0x67
+ /* Graphics Controller Registers */
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0E, 0x00, 0xFF},
+ /* Sequencer Registers */
+ {0x03, 0x00, 0x03, 0x00, 0x02},
+ /* Misc Output Register */
+ 0x67
};
static const UCHAR DefaultPalette[] =
{
- 0, 0, 0,
- 0, 0, 0xC0,
- 0, 0xC0, 0,
- 0, 0xC0, 0xC0,
- 0xC0, 0, 0,
- 0xC0, 0, 0xC0,
- 0xC0, 0xC0, 0,
- 0xC0, 0xC0, 0xC0,
- 0x80, 0x80, 0x80,
- 0, 0, 0xFF,
- 0, 0xFF, 0,
- 0, 0xFF, 0xFF,
- 0xFF, 0, 0,
- 0xFF, 0, 0xFF,
- 0xFF, 0xFF, 0,
- 0xFF, 0xFF, 0xFF
+ 0, 0, 0,
+ 0, 0, 0xC0,
+ 0, 0xC0, 0,
+ 0, 0xC0, 0xC0,
+ 0xC0, 0, 0,
+ 0xC0, 0, 0xC0,
+ 0xC0, 0xC0, 0,
+ 0xC0, 0xC0, 0xC0,
+ 0x80, 0x80, 0x80,
+ 0, 0, 0xFF,
+ 0, 0xFF, 0,
+ 0, 0xFF, 0xFF,
+ 0xFF, 0, 0,
+ 0xFF, 0, 0xFF,
+ 0xFF, 0xFF, 0,
+ 0xFF, 0xFF, 0xFF
};
/* FUNCTIONS **************************************************************/
-static VOID FASTCALL
+static VOID
+FASTCALL
ScrSetRegisters(const VGA_REGISTERS *Registers)
{
UINT32 i;
@@ -96,7 +95,7 @@ ScrSetRegisters(const VGA_REGISTERS *Registers)
/* Write sequencer registers */
for (i = 1; i < sizeof(Registers->Sequencer); i++)
-{
+ {
WRITE_PORT_UCHAR(SEQ, i);
WRITE_PORT_UCHAR(SEQDATA, Registers->Sequencer[i]);
}
@@ -131,72 +130,74 @@ ScrSetRegisters(const VGA_REGISTERS *Registers)
WRITE_PORT_UCHAR(ATTRIB, Registers->Attribute[i]);
}
- /* Set the PEL mask. */
+ /* Set the PEL mask */
WRITE_PORT_UCHAR(PELMASK, 0xff);
}
-static VOID FASTCALL
-ScrAcquireOwnership(PDEVICE_EXTENSION DeviceExtension)
+static VOID
+FASTCALL
+ScrAcquireOwnership(
+ _In_ PDEVICE_EXTENSION DeviceExtension)
{
- unsigned int offset;
+ ULONG offset;
UCHAR data, value;
ULONG Index;
ScrSetRegisters(&VidpMode3Regs);
- /* Disable screen and enable palette access. */
+ /* Disable screen and enable palette access */
READ_PORT_UCHAR(STATUS);
WRITE_PORT_UCHAR(ATTRIB, 0x00);
for (Index = 0; Index < sizeof(DefaultPalette) / 3; Index++)
{
- WRITE_PORT_UCHAR(PELINDEX, Index);
- WRITE_PORT_UCHAR(PELDATA, DefaultPalette[Index * 3] >> 2);
- WRITE_PORT_UCHAR(PELDATA, DefaultPalette[Index * 3 + 1] >> 2);
- WRITE_PORT_UCHAR(PELDATA, DefaultPalette[Index * 3 + 2] >> 2);
+ WRITE_PORT_UCHAR(PELINDEX, Index);
+ WRITE_PORT_UCHAR(PELDATA, DefaultPalette[Index * 3] >> 2);
+ WRITE_PORT_UCHAR(PELDATA, DefaultPalette[Index * 3 + 1] >> 2);
+ WRITE_PORT_UCHAR(PELDATA, DefaultPalette[Index * 3 + 2] >> 2);
}
- /* Enable screen and disable palette access. */
+ /* Enable screen and disable palette access */
READ_PORT_UCHAR(STATUS);
WRITE_PORT_UCHAR(ATTRIB, 0x20);
- /* get current output position */
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSLO);
- offset = READ_PORT_UCHAR (CRTC_DATA);
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
- offset += (READ_PORT_UCHAR (CRTC_DATA) << 8);
-
- /* switch blinking characters off */
- READ_PORT_UCHAR (ATTRC_INPST1);
- value = READ_PORT_UCHAR (ATTRC_WRITEREG);
- WRITE_PORT_UCHAR (ATTRC_WRITEREG, 0x10);
- data = READ_PORT_UCHAR (ATTRC_READREG);
+ /* Get current output position */
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSORPOSLO);
+ offset = READ_PORT_UCHAR(CRTC_DATA);
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSORPOSHI);
+ offset += (READ_PORT_UCHAR(CRTC_DATA) << 8);
+
+ /* Switch blinking characters off */
+ READ_PORT_UCHAR(ATTRC_INPST1);
+ value = READ_PORT_UCHAR(ATTRC_WRITEREG);
+ WRITE_PORT_UCHAR(ATTRC_WRITEREG, 0x10);
+ data = READ_PORT_UCHAR(ATTRC_READREG);
data = data & ~0x08;
- WRITE_PORT_UCHAR (ATTRC_WRITEREG, data);
- WRITE_PORT_UCHAR (ATTRC_WRITEREG, value);
- READ_PORT_UCHAR (ATTRC_INPST1);
-
- /* read screen information from crt controller */
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_COLUMNS);
- DeviceExtension->Columns = READ_PORT_UCHAR (CRTC_DATA) + 1;
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_ROWS);
- DeviceExtension->Rows = READ_PORT_UCHAR (CRTC_DATA);
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_OVERFLOW);
- data = READ_PORT_UCHAR (CRTC_DATA);
+ WRITE_PORT_UCHAR(ATTRC_WRITEREG, data);
+ WRITE_PORT_UCHAR(ATTRC_WRITEREG, value);
+ READ_PORT_UCHAR(ATTRC_INPST1);
+
+ /* Read screen information from CRT controller */
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_COLUMNS);
+ DeviceExtension->Columns = READ_PORT_UCHAR(CRTC_DATA) + 1;
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_ROWS);
+ DeviceExtension->Rows = READ_PORT_UCHAR(CRTC_DATA);
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_OVERFLOW);
+ data = READ_PORT_UCHAR(CRTC_DATA);
DeviceExtension->Rows |= (((data & 0x02) << 7) | ((data & 0x40)
<< 3));
DeviceExtension->Rows++;
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_SCANLINES);
- DeviceExtension->ScanLines = (READ_PORT_UCHAR (CRTC_DATA) & 0x1F) + 1;
-
- /* show blinking cursor */
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORSTART);
- WRITE_PORT_UCHAR (CRTC_DATA, (DeviceExtension->ScanLines - 1) & 0x1F);
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSOREND);
- data = READ_PORT_UCHAR (CRTC_DATA) & 0xE0;
- WRITE_PORT_UCHAR (CRTC_DATA,
- data | ((DeviceExtension->ScanLines - 1) & 0x1F));
-
- /* calculate number of text rows */
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_SCANLINES);
+ DeviceExtension->ScanLines = (READ_PORT_UCHAR(CRTC_DATA) & 0x1F) + 1;
+
+ /* Show blinking cursor */
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSORSTART);
+ WRITE_PORT_UCHAR(CRTC_DATA, (DeviceExtension->ScanLines - 1) & 0x1F);
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSOREND);
+ data = READ_PORT_UCHAR(CRTC_DATA) & 0xE0;
+ WRITE_PORT_UCHAR(CRTC_DATA,
+ data | ((DeviceExtension->ScanLines - 1) & 0x1F));
+
+ /* Calculate number of text rows */
DeviceExtension->Rows =
DeviceExtension->Rows / DeviceExtension->ScanLines;
#ifdef BOCHS_30ROWS
@@ -206,20 +207,21 @@ ScrAcquireOwnership(PDEVICE_EXTENSION DeviceExtension)
/* Upload a default font for the default codepage 437 */
ScrLoadFontTable(437);
- DPRINT ("%d Columns %d Rows %d Scanlines\n",
- DeviceExtension->Columns,
- DeviceExtension->Rows,
- DeviceExtension->ScanLines);
+ DPRINT("%d Columns %d Rows %d Scanlines\n",
+ DeviceExtension->Columns,
+ DeviceExtension->Rows,
+ DeviceExtension->ScanLines);
}
-NTSTATUS NTAPI
-DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);
-
static DRIVER_DISPATCH ScrCreate;
-static NTSTATUS NTAPI
-ScrCreate(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
+static NTSTATUS
+NTAPI
+ScrCreate(
+ _In_ PDEVICE_OBJECT DeviceObject,
+ _In_ PIRP Irp)
{
+#define FOREGROUND_LIGHTGRAY (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)
+
PDEVICE_EXTENSION DeviceExtension;
PHYSICAL_ADDRESS BaseAddress;
NTSTATUS Status;
@@ -230,14 +232,14 @@ ScrCreate(PDEVICE_OBJECT DeviceObject,
{
ScrAcquireOwnership(DeviceExtension);
- /* get pointer to video memory */
+ /* Get a pointer to the video memory */
BaseAddress.QuadPart = VIDMEM_BASE;
DeviceExtension->VideoMemory =
- (PUCHAR)MmMapIoSpace (BaseAddress, DeviceExtension->Rows *
DeviceExtension->Columns * 2, MmNonCached);
+ (PUCHAR)MmMapIoSpace(BaseAddress, DeviceExtension->Rows *
DeviceExtension->Columns * 2, MmNonCached);
}
else
{
- /* store dummy values here */
+ /* Store dummy values */
DeviceExtension->Columns = 1;
DeviceExtension->Rows = 1;
DeviceExtension->ScanLines = 1;
@@ -246,34 +248,35 @@ ScrCreate(PDEVICE_OBJECT DeviceObject,
DeviceExtension->CursorSize = 5; /* FIXME: value correct?? */
DeviceExtension->CursorVisible = TRUE;
- /* more initialization */
- DeviceExtension->CharAttribute = 0x17; /* light grey on blue */
+ /* More initialization */
+ DeviceExtension->CharAttribute = BACKGROUND_BLUE | FOREGROUND_LIGHTGRAY;
DeviceExtension->Mode = ENABLE_PROCESSED_OUTPUT |
ENABLE_WRAP_AT_EOL_OUTPUT;
Status = STATUS_SUCCESS;
Irp->IoStatus.Status = Status;
- IoCompleteRequest (Irp, IO_NO_INCREMENT);
-
- return (Status);
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return Status;
}
static DRIVER_DISPATCH ScrWrite;
-static NTSTATUS NTAPI
-ScrWrite(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
+static NTSTATUS
+NTAPI
+ScrWrite(
+ _In_ PDEVICE_OBJECT DeviceObject,
+ _In_ PIRP Irp)
{
- PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation (Irp);
+ PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation(Irp);
PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
NTSTATUS Status;
- char *pch = Irp->UserBuffer;
+ PCHAR pch = Irp->UserBuffer;
PUCHAR vidmem;
- unsigned int i;
- int j, offset;
- int cursorx, cursory;
- int rows, columns;
- int processed = DeviceExtension->Mode & ENABLE_PROCESSED_OUTPUT;
+ ULONG i;
+ ULONG j, offset;
+ USHORT cursorx, cursory;
+ USHORT rows, columns;
+ BOOLEAN processed = !!(DeviceExtension->Mode & ENABLE_PROCESSED_OUTPUT);
if (InbvCheckDisplayOwnership())
{
@@ -281,610 +284,621 @@ ScrWrite(PDEVICE_OBJECT DeviceObject,
Status = STATUS_SUCCESS;
Irp->IoStatus.Status = Status;
- IoCompleteRequest (Irp, IO_NO_INCREMENT);
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}
vidmem = DeviceExtension->VideoMemory;
- rows = DeviceExtension->Rows;
+ rows = DeviceExtension->Rows;
columns = DeviceExtension->Columns;
_disable();
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
- offset = READ_PORT_UCHAR (CRTC_DATA)<<8;
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSLO);
- offset += READ_PORT_UCHAR (CRTC_DATA);
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSORPOSHI);
+ offset = READ_PORT_UCHAR(CRTC_DATA)<<8;
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSORPOSLO);
+ offset += READ_PORT_UCHAR(CRTC_DATA);
_enable();
- cursory = offset / columns;
- cursorx = offset % columns;
- if( processed == 0 )
- {
- /* raw output mode */
- // FIXME: Does the buffer only contains chars? or chars + attributes?
- // FIXME2: Fix buffer overflow.
- memcpy( &vidmem[(cursorx * 2) + (cursory * columns * 2)], pch,
stk->Parameters.Write.Length );
- offset += (stk->Parameters.Write.Length / 2);
- }
- else {
- for (i = 0; i < stk->Parameters.Write.Length; i++, pch++)
- {
- switch (*pch)
+ cursory = (USHORT)(offset / columns);
+ cursorx = (USHORT)(offset % columns);
+ if (!processed)
+ {
+ /* Raw output mode */
+ // FIXME: Does the buffer only contains chars? or chars + attributes?
+ // FIXME2: Fix buffer overflow.
+ RtlCopyMemory(&vidmem[(cursorx * 2) + (cursory * columns * 2)],
+ pch, stk->Parameters.Write.Length);
+ offset += (stk->Parameters.Write.Length / 2);
+ }
+ else
+ {
+ /* Cooked output mode */
+ for (i = 0; i < stk->Parameters.Write.Length; i++, pch++)
{
- case '\b':
- if (cursorx > 0)
- {
- cursorx--;
- }
- else if (cursory > 0)
- {
- cursorx = columns - 1;
- cursory--;
- }
- vidmem[(cursorx * 2) + (cursory * columns * 2)] = ' ';
- vidmem[(cursorx * 2) + (cursory * columns * 2) + 1] = (char)
DeviceExtension->CharAttribute;
- break;
-
- case '\n':
- cursory++;
- cursorx = 0;
- break;
-
- case '\r':
- cursorx = 0;
- break;
-
- case '\t':
- offset = TAB_WIDTH - (cursorx % TAB_WIDTH);
- for (j = 0; j < offset; j++)
- {
- vidmem[(cursorx * 2) + (cursory * columns * 2)] = ' ';
- cursorx++;
-
- if (cursorx >= columns)
+ switch (*pch)
+ {
+ case '\b':
+ {
+ if (cursorx > 0)
+ {
+ cursorx--;
+ }
+ else if (cursory > 0)
{
- cursory++;
- cursorx = 0;
+ cursorx = columns - 1;
+ cursory--;
}
- }
- break;
+ vidmem[(cursorx * 2) + (cursory * columns * 2)] = ' ';
+ vidmem[(cursorx * 2) + (cursory * columns * 2) + 1] =
(char)DeviceExtension->CharAttribute;
+ break;
+ }
- default:
- vidmem[(cursorx * 2) + (cursory * columns * 2)] = *pch;
- vidmem[(cursorx * 2) + (cursory * columns * 2) + 1] = (char)
DeviceExtension->CharAttribute;
- cursorx++;
- if (cursorx >= columns)
- {
- cursory++;
- cursorx = 0;
- }
- break;
- }
+ case '\n':
+ cursory++;
+ cursorx = 0;
+ break;
- /* Scroll up the contents of the screen if we are at the end */
- if (cursory >= rows)
- {
- unsigned short *LinePtr;
-
- memcpy (vidmem,
- &vidmem[columns * 2],
- columns * (rows - 1) * 2);
-
- LinePtr = (unsigned short *) &vidmem[columns * (rows - 1) * 2];
-
- for (j = 0; j < columns; j++)
- {
- LinePtr[j] = DeviceExtension->CharAttribute << 8;
- }
- cursory = rows - 1;
- for (j = 0; j < columns; j++)
- {
- vidmem[(j * 2) + (cursory * columns * 2)] = ' ';
- vidmem[(j * 2) + (cursory * columns * 2) + 1] =
(char)DeviceExtension->CharAttribute;
- }
+ case '\r':
+ cursorx = 0;
+ break;
+
+ case '\t':
+ {
+ offset = TAB_WIDTH - (cursorx % TAB_WIDTH);
+ for (j = 0; j < offset; j++)
+ {
+ vidmem[(cursorx * 2) + (cursory * columns * 2)] = ' ';
+ cursorx++;
+
+ if (cursorx >= columns)
+ {
+ cursory++;
+ cursorx = 0;
+ }
+ }
+ break;
+ }
+
+ default:
+ {
+ vidmem[(cursorx * 2) + (cursory * columns * 2)] = *pch;
+ vidmem[(cursorx * 2) + (cursory * columns * 2) + 1] =
(char)DeviceExtension->CharAttribute;
+ cursorx++;
+ if (cursorx >= columns)
+ {
+ cursory++;
+ cursorx = 0;
+ }
+ break;
+ }
+ }
+
+ /* Scroll up the contents of the screen if we are at the end */
+ if (cursory >= rows)
+ {
+ PUSHORT LinePtr;
+
+ RtlCopyMemory(vidmem,
+ &vidmem[columns * 2],
+ columns * (rows - 1) * 2);
+
+ LinePtr = (PUSHORT)&vidmem[columns * (rows - 1) * 2];
+
+ for (j = 0; j < columns; j++)
+ {
+ LinePtr[j] = DeviceExtension->CharAttribute << 8;
+ }
+ cursory = rows - 1;
+ for (j = 0; j < columns; j++)
+ {
+ vidmem[(j * 2) + (cursory * columns * 2)] = ' ';
+ vidmem[(j * 2) + (cursory * columns * 2) + 1] =
(char)DeviceExtension->CharAttribute;
+ }
+ }
}
- }
- /* Set the cursor position */
- offset = (cursory * columns) + cursorx;
+ /* Set the cursor position */
+ offset = (cursory * columns) + cursorx;
}
_disable();
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSLO);
- WRITE_PORT_UCHAR (CRTC_DATA, offset);
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSORPOSLO);
+ WRITE_PORT_UCHAR(CRTC_DATA, offset);
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSORPOSHI);
offset >>= 8;
- WRITE_PORT_UCHAR (CRTC_DATA, offset);
+ WRITE_PORT_UCHAR(CRTC_DATA, offset);
_enable();
Status = STATUS_SUCCESS;
Irp->IoStatus.Status = Status;
- IoCompleteRequest (Irp, IO_NO_INCREMENT);
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}
static DRIVER_DISPATCH ScrIoControl;
-static NTSTATUS NTAPI
-ScrIoControl(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
+static NTSTATUS
+NTAPI
+ScrIoControl(
+ _In_ PDEVICE_OBJECT DeviceObject,
+ _In_ PIRP Irp)
{
- PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation (Irp);
- PDEVICE_EXTENSION DeviceExtension;
- NTSTATUS Status;
+ NTSTATUS Status;
+ PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation(Irp);
+ PDEVICE_EXTENSION DeviceExtension;
- DeviceExtension = DeviceObject->DeviceExtension;
- switch (stk->Parameters.DeviceIoControl.IoControlCode)
+ DeviceExtension = DeviceObject->DeviceExtension;
+ switch (stk->Parameters.DeviceIoControl.IoControlCode)
{
- case IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO:
+ case IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO:
{
- PCONSOLE_SCREEN_BUFFER_INFO pcsbi =
(PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer;
- int rows = DeviceExtension->Rows;
- int columns = DeviceExtension->Columns;
- unsigned int offset;
-
- if (!InbvCheckDisplayOwnership())
- {
- /* read cursor position from crtc */
- _disable();
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSLO);
- offset = READ_PORT_UCHAR (CRTC_DATA);
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
- offset += (READ_PORT_UCHAR (CRTC_DATA) << 8);
- _enable();
- }
- else
- {
- offset = 0;
- }
-
- pcsbi->dwSize.X = columns;
- pcsbi->dwSize.Y = rows;
-
- pcsbi->dwCursorPosition.X = (SHORT)(offset % columns);
- pcsbi->dwCursorPosition.Y = (SHORT)(offset / columns);
-
- pcsbi->wAttributes = DeviceExtension->CharAttribute;
-
- pcsbi->srWindow.Left = 0;
- pcsbi->srWindow.Right = columns - 1;
- pcsbi->srWindow.Top = 0;
- pcsbi->srWindow.Bottom = rows - 1;
-
- pcsbi->dwMaximumWindowSize.X = columns;
- pcsbi->dwMaximumWindowSize.Y = rows;
-
- Irp->IoStatus.Information = sizeof (CONSOLE_SCREEN_BUFFER_INFO);
- Status = STATUS_SUCCESS;
- }
- break;
+ PCONSOLE_SCREEN_BUFFER_INFO pcsbi =
(PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer;
+ USHORT rows = DeviceExtension->Rows;
+ USHORT columns = DeviceExtension->Columns;
+ ULONG offset;
- case IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO:
- {
- PCONSOLE_SCREEN_BUFFER_INFO pcsbi =
(PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer;
- unsigned int offset;
-
- if ( pcsbi->dwCursorPosition.X < 0 || pcsbi->dwCursorPosition.X >=
DeviceExtension->Columns ||
- pcsbi->dwCursorPosition.Y < 0 || pcsbi->dwCursorPosition.Y >=
DeviceExtension->Rows )
- {
- Irp->IoStatus.Information = 0;
- Status = STATUS_INVALID_PARAMETER;
- break;
- }
-
- DeviceExtension->CharAttribute = pcsbi->wAttributes;
- offset = (pcsbi->dwCursorPosition.Y * DeviceExtension->Columns) +
- pcsbi->dwCursorPosition.X;
-
- if (!InbvCheckDisplayOwnership())
- {
- _disable();
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSLO);
- WRITE_PORT_UCHAR (CRTC_DATA, offset);
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
- WRITE_PORT_UCHAR (CRTC_DATA, offset>>8);
- _enable();
- }
-
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
- }
- break;
+ if (!InbvCheckDisplayOwnership())
+ {
+ /* read cursor position from crtc */
+ _disable();
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSORPOSLO);
+ offset = READ_PORT_UCHAR(CRTC_DATA);
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSORPOSHI);
+ offset += (READ_PORT_UCHAR(CRTC_DATA) << 8);
+ _enable();
+ }
+ else
+ {
+ offset = 0;
+ }
- case IOCTL_CONSOLE_GET_CURSOR_INFO:
- {
- PCONSOLE_CURSOR_INFO pcci =
(PCONSOLE_CURSOR_INFO)Irp->AssociatedIrp.SystemBuffer;
+ pcsbi->dwSize.X = columns;
+ pcsbi->dwSize.Y = rows;
- pcci->dwSize = DeviceExtension->CursorSize;
- pcci->bVisible = DeviceExtension->CursorVisible;
+ pcsbi->dwCursorPosition.X = (SHORT)(offset % columns);
+ pcsbi->dwCursorPosition.Y = (SHORT)(offset / columns);
- Irp->IoStatus.Information = sizeof (CONSOLE_CURSOR_INFO);
- Status = STATUS_SUCCESS;
+ pcsbi->wAttributes = DeviceExtension->CharAttribute;
+
+ pcsbi->srWindow.Left = 0;
+ pcsbi->srWindow.Right = columns - 1;
+ pcsbi->srWindow.Top = 0;
+ pcsbi->srWindow.Bottom = rows - 1;
+
+ pcsbi->dwMaximumWindowSize.X = columns;
+ pcsbi->dwMaximumWindowSize.Y = rows;
+
+ Irp->IoStatus.Information = sizeof(CONSOLE_SCREEN_BUFFER_INFO);
+ Status = STATUS_SUCCESS;
+ break;
}
- break;
- case IOCTL_CONSOLE_SET_CURSOR_INFO:
+ case IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO:
{
- PCONSOLE_CURSOR_INFO pcci =
(PCONSOLE_CURSOR_INFO)Irp->AssociatedIrp.SystemBuffer;
- UCHAR data, value;
- ULONG size, height;
+ PCONSOLE_SCREEN_BUFFER_INFO pcsbi =
(PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer;
+ ULONG Offset;
- DeviceExtension->CursorSize = pcci->dwSize;
- DeviceExtension->CursorVisible = pcci->bVisible;
+ if ( pcsbi->dwCursorPosition.X < 0 || pcsbi->dwCursorPosition.X
>= DeviceExtension->Columns ||
+ pcsbi->dwCursorPosition.Y < 0 || pcsbi->dwCursorPosition.Y
>= DeviceExtension->Rows )
+ {
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_INVALID_PARAMETER;
+ break;
+ }
+
+ DeviceExtension->CharAttribute = pcsbi->wAttributes;
- if (!InbvCheckDisplayOwnership())
- {
- height = DeviceExtension->ScanLines;
- data = (pcci->bVisible) ? 0x00 : 0x20;
+ Offset = (pcsbi->dwCursorPosition.Y * DeviceExtension->Columns) +
+ pcsbi->dwCursorPosition.X;
- size = (pcci->dwSize * height) / 100;
- if (size < 1)
+ if (!InbvCheckDisplayOwnership())
{
- size = 1;
+ _disable();
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSORPOSLO);
+ WRITE_PORT_UCHAR(CRTC_DATA, Offset);
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSORPOSHI);
+ WRITE_PORT_UCHAR(CRTC_DATA, Offset >> 8);
+ _enable();
}
- data |= (UCHAR)(height - size);
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
+ }
+
+ case IOCTL_CONSOLE_GET_CURSOR_INFO:
+ {
+ PCONSOLE_CURSOR_INFO pcci =
(PCONSOLE_CURSOR_INFO)Irp->AssociatedIrp.SystemBuffer;
- _disable();
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORSTART);
- WRITE_PORT_UCHAR (CRTC_DATA, data);
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSOREND);
- value = READ_PORT_UCHAR (CRTC_DATA) & 0xE0;
- WRITE_PORT_UCHAR (CRTC_DATA, value | (height - 1));
+ pcci->dwSize = DeviceExtension->CursorSize;
+ pcci->bVisible = DeviceExtension->CursorVisible;
- _enable();
- }
+ Irp->IoStatus.Information = sizeof(CONSOLE_CURSOR_INFO);
+ Status = STATUS_SUCCESS;
+ break;
+ }
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
+ case IOCTL_CONSOLE_SET_CURSOR_INFO:
+ {
+ PCONSOLE_CURSOR_INFO pcci =
(PCONSOLE_CURSOR_INFO)Irp->AssociatedIrp.SystemBuffer;
+ UCHAR data, value;
+ ULONG size, height;
+
+ DeviceExtension->CursorSize = pcci->dwSize;
+ DeviceExtension->CursorVisible = pcci->bVisible;
+
+ if (!InbvCheckDisplayOwnership())
+ {
+ height = DeviceExtension->ScanLines;
+ data = (pcci->bVisible) ? 0x00 : 0x20;
+
+ size = (pcci->dwSize * height) / 100;
+ if (size < 1)
+ size = 1;
+
+ data |= (UCHAR)(height - size);
+
+ _disable();
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSORSTART);
+ WRITE_PORT_UCHAR(CRTC_DATA, data);
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSOREND);
+ value = READ_PORT_UCHAR(CRTC_DATA) & 0xE0;
+ WRITE_PORT_UCHAR(CRTC_DATA, value | (height - 1));
+ _enable();
+ }
+
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
}
- break;
- case IOCTL_CONSOLE_GET_MODE:
+ case IOCTL_CONSOLE_GET_MODE:
{
- PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer;
+ PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer;
- pcm->dwMode = DeviceExtension->Mode;
+ pcm->dwMode = DeviceExtension->Mode;
- Irp->IoStatus.Information = sizeof(CONSOLE_MODE);
- Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = sizeof(CONSOLE_MODE);
+ Status = STATUS_SUCCESS;
+ break;
}
- break;
- case IOCTL_CONSOLE_SET_MODE:
+ case IOCTL_CONSOLE_SET_MODE:
{
- PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer;
+ PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer;
- DeviceExtension->Mode = pcm->dwMode;
+ DeviceExtension->Mode = pcm->dwMode;
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
}
- break;
- case IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE:
+ case IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE:
{
- POUTPUT_ATTRIBUTE Buf = (POUTPUT_ATTRIBUTE)Irp->AssociatedIrp.SystemBuffer;
- PUCHAR vidmem;
- int offset;
- ULONG dwCount;
- ULONG nMaxLength = Buf->nLength;
-
- if ( Buf->dwCoord.X < 0 || Buf->dwCoord.X >=
DeviceExtension->Columns ||
- Buf->dwCoord.Y < 0 || Buf->dwCoord.Y >=
DeviceExtension->Rows )
- {
- Buf->dwTransfered = 0;
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
- break;
- }
-
- if (!InbvCheckDisplayOwnership())
- {
- vidmem = DeviceExtension->VideoMemory;
- offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
- (Buf->dwCoord.X * 2) + 1;
-
- nMaxLength = min(nMaxLength,
- (DeviceExtension->Rows - Buf->dwCoord.Y)
- * DeviceExtension->Columns - Buf->dwCoord.X);
-
- for (dwCount = 0; dwCount < nMaxLength; dwCount++)
+ POUTPUT_ATTRIBUTE Buf =
(POUTPUT_ATTRIBUTE)Irp->AssociatedIrp.SystemBuffer;
+ PUCHAR vidmem;
+ int offset;
+ ULONG dwCount;
+ ULONG nMaxLength = Buf->nLength;
+
+ if ( Buf->dwCoord.X < 0 || Buf->dwCoord.X >=
DeviceExtension->Columns ||
+ Buf->dwCoord.Y < 0 || Buf->dwCoord.Y >=
DeviceExtension->Rows )
+ {
+ Buf->dwTransfered = 0;
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
+ }
+
+ if (!InbvCheckDisplayOwnership())
{
- vidmem[offset + (dwCount * 2)] = (char) Buf->wAttribute;
+ vidmem = DeviceExtension->VideoMemory;
+ offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
+ (Buf->dwCoord.X * 2) + 1;
+
+ nMaxLength = min(nMaxLength,
+ (DeviceExtension->Rows - Buf->dwCoord.Y)
+ * DeviceExtension->Columns - Buf->dwCoord.X);
+
+ for (dwCount = 0; dwCount < nMaxLength; dwCount++)
+ {
+ vidmem[offset + (dwCount * 2)] = (char)Buf->wAttribute;
+ }
}
- }
- Buf->dwTransfered = nMaxLength;
+ Buf->dwTransfered = nMaxLength;
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
}
- break;
- case IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE:
+ case IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE:
{
- POUTPUT_ATTRIBUTE Buf = (POUTPUT_ATTRIBUTE)Irp->AssociatedIrp.SystemBuffer;
- PUSHORT pAttr = (PUSHORT)MmGetSystemAddressForMdl(Irp->MdlAddress);
- PUCHAR vidmem;
- int offset;
- ULONG dwCount;
- ULONG nMaxLength;
-
- if ( Buf->dwCoord.X < 0 || Buf->dwCoord.X >=
DeviceExtension->Columns ||
- Buf->dwCoord.Y < 0 || Buf->dwCoord.Y >=
DeviceExtension->Rows )
- {
- Buf->dwTransfered = 0;
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
- break;
- }
-
- if (!InbvCheckDisplayOwnership())
- {
- vidmem = DeviceExtension->VideoMemory;
- offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
- (Buf->dwCoord.X * 2) + 1;
-
- nMaxLength = min(stk->Parameters.DeviceIoControl.OutputBufferLength,
- (DeviceExtension->Rows - Buf->dwCoord.Y)
- * DeviceExtension->Columns - Buf->dwCoord.X);
-
- for (dwCount = 0; dwCount < nMaxLength; dwCount++, pAttr++)
+ POUTPUT_ATTRIBUTE Buf =
(POUTPUT_ATTRIBUTE)Irp->AssociatedIrp.SystemBuffer;
+ PUSHORT pAttr = (PUSHORT)MmGetSystemAddressForMdl(Irp->MdlAddress);
+ PUCHAR vidmem;
+ int offset;
+ ULONG dwCount;
+ ULONG nMaxLength;
+
+ if ( Buf->dwCoord.X < 0 || Buf->dwCoord.X >=
DeviceExtension->Columns ||
+ Buf->dwCoord.Y < 0 || Buf->dwCoord.Y >=
DeviceExtension->Rows )
{
- *((char *)pAttr) = vidmem[offset + (dwCount * 2)];
+ Buf->dwTransfered = 0;
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
}
- Buf->dwTransfered = dwCount;
- }
- else
- {
- Buf->dwTransfered = 0;
- }
+ if (!InbvCheckDisplayOwnership())
+ {
+ vidmem = DeviceExtension->VideoMemory;
+ offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
+ (Buf->dwCoord.X * 2) + 1;
+
+ nMaxLength = min(stk->Parameters.DeviceIoControl.OutputBufferLength,
+ (DeviceExtension->Rows - Buf->dwCoord.Y)
+ * DeviceExtension->Columns - Buf->dwCoord.X);
+
+ for (dwCount = 0; dwCount < nMaxLength; dwCount++, pAttr++)
+ {
+ *((PCHAR)pAttr) = vidmem[offset + (dwCount * 2)];
+ }
- Irp->IoStatus.Information = sizeof(OUTPUT_ATTRIBUTE);
- Status = STATUS_SUCCESS;
+ Buf->dwTransfered = dwCount;
+ }
+ else
+ {
+ Buf->dwTransfered = 0;
+ }
+
+ Irp->IoStatus.Information = sizeof(OUTPUT_ATTRIBUTE);
+ Status = STATUS_SUCCESS;
+ break;
}
- break;
- case IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE:
+ case IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE:
{
- COORD *pCoord = (COORD *)MmGetSystemAddressForMdl(Irp->MdlAddress);
- CHAR *pAttr = (CHAR *)(pCoord + 1);
- PUCHAR vidmem;
- int offset;
- ULONG dwCount;
- ULONG nMaxLength;
-
- if ( pCoord->X < 0 || pCoord->X >= DeviceExtension->Columns ||
- pCoord->Y < 0 || pCoord->Y >= DeviceExtension->Rows )
- {
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
- break;
- }
-
- if (!InbvCheckDisplayOwnership())
- {
- vidmem = DeviceExtension->VideoMemory;
- offset = (pCoord->Y * DeviceExtension->Columns * 2) +
- (pCoord->X * 2) + 1;
-
- nMaxLength = min(stk->Parameters.DeviceIoControl.OutputBufferLength -
sizeof(COORD),
- (DeviceExtension->Rows - pCoord->Y)
- * DeviceExtension->Columns - pCoord->X);
-
- for (dwCount = 0; dwCount < nMaxLength; dwCount++, pAttr++)
+ PCOORD pCoord = (PCOORD)MmGetSystemAddressForMdl(Irp->MdlAddress);
+ PCHAR pAttr = (PCHAR)(pCoord + 1);
+ PUCHAR vidmem;
+ int offset;
+ ULONG dwCount;
+ ULONG nMaxLength;
+
+ if ( pCoord->X < 0 || pCoord->X >= DeviceExtension->Columns
||
+ pCoord->Y < 0 || pCoord->Y >= DeviceExtension->Rows )
{
- vidmem[offset + (dwCount * 2)] = *pAttr;
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
+ }
+
+ if (!InbvCheckDisplayOwnership())
+ {
+ vidmem = DeviceExtension->VideoMemory;
+ offset = (pCoord->Y * DeviceExtension->Columns * 2) +
+ (pCoord->X * 2) + 1;
+
+ nMaxLength = min(stk->Parameters.DeviceIoControl.OutputBufferLength -
sizeof(COORD),
+ (DeviceExtension->Rows - pCoord->Y)
+ * DeviceExtension->Columns - pCoord->X);
+
+ for (dwCount = 0; dwCount < nMaxLength; dwCount++, pAttr++)
+ {
+ vidmem[offset + (dwCount * 2)] = *pAttr;
+ }
}
- }
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
}
- break;
- case IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE:
- DeviceExtension->CharAttribute =
(USHORT)*(PUSHORT)Irp->AssociatedIrp.SystemBuffer;
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
- break;
+ case IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE:
+ DeviceExtension->CharAttribute =
(USHORT)*(PUSHORT)Irp->AssociatedIrp.SystemBuffer;
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
- case IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER:
+ case IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER:
{
- POUTPUT_CHARACTER Buf = (POUTPUT_CHARACTER)Irp->AssociatedIrp.SystemBuffer;
- PUCHAR vidmem;
- int offset;
- ULONG dwCount;
- ULONG nMaxLength = Buf->nLength;
-
- if ( Buf->dwCoord.X < 0 || Buf->dwCoord.X >=
DeviceExtension->Columns ||
- Buf->dwCoord.Y < 0 || Buf->dwCoord.Y >=
DeviceExtension->Rows )
- {
- Buf->dwTransfered = 0;
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
- break;
- }
-
- if (!InbvCheckDisplayOwnership())
- {
- vidmem = DeviceExtension->VideoMemory;
- offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
- (Buf->dwCoord.X * 2);
-
- nMaxLength = min(nMaxLength,
- (DeviceExtension->Rows - Buf->dwCoord.Y)
- * DeviceExtension->Columns - Buf->dwCoord.X);
-
- for (dwCount = 0; dwCount < nMaxLength; dwCount++)
+ POUTPUT_CHARACTER Buf =
(POUTPUT_CHARACTER)Irp->AssociatedIrp.SystemBuffer;
+ PUCHAR vidmem;
+ int offset;
+ ULONG dwCount;
+ ULONG nMaxLength = Buf->nLength;
+
+ if ( Buf->dwCoord.X < 0 || Buf->dwCoord.X >=
DeviceExtension->Columns ||
+ Buf->dwCoord.Y < 0 || Buf->dwCoord.Y >=
DeviceExtension->Rows )
{
- vidmem[offset + (dwCount * 2)] = (char) Buf->cCharacter;
+ Buf->dwTransfered = 0;
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
}
- }
- Buf->dwTransfered = nMaxLength;
+ if (!InbvCheckDisplayOwnership())
+ {
+ vidmem = DeviceExtension->VideoMemory;
+ offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
+ (Buf->dwCoord.X * 2);
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
+ nMaxLength = min(nMaxLength,
+ (DeviceExtension->Rows - Buf->dwCoord.Y)
+ * DeviceExtension->Columns - Buf->dwCoord.X);
+
+ for (dwCount = 0; dwCount < nMaxLength; dwCount++)
+ {
+ vidmem[offset + (dwCount * 2)] = (char)Buf->cCharacter;
+ }
+ }
+
+ Buf->dwTransfered = nMaxLength;
+
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
}
- break;
- case IOCTL_CONSOLE_READ_OUTPUT_CHARACTER:
+ case IOCTL_CONSOLE_READ_OUTPUT_CHARACTER:
{
- POUTPUT_CHARACTER Buf = (POUTPUT_CHARACTER)Irp->AssociatedIrp.SystemBuffer;
- LPSTR pChar = (LPSTR)MmGetSystemAddressForMdl(Irp->MdlAddress);
- PUCHAR vidmem;
- int offset;
- ULONG dwCount;
- ULONG nMaxLength;
-
- if ( Buf->dwCoord.X < 0 || Buf->dwCoord.X >=
DeviceExtension->Columns ||
- Buf->dwCoord.Y < 0 || Buf->dwCoord.Y >=
DeviceExtension->Rows )
- {
- Buf->dwTransfered = 0;
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
- break;
- }
-
- if (!InbvCheckDisplayOwnership())
- {
- vidmem = DeviceExtension->VideoMemory;
- offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
- (Buf->dwCoord.X * 2);
-
- nMaxLength = min(stk->Parameters.DeviceIoControl.OutputBufferLength,
- (DeviceExtension->Rows - Buf->dwCoord.Y)
- * DeviceExtension->Columns - Buf->dwCoord.X);
-
- for (dwCount = 0; dwCount < nMaxLength; dwCount++, pChar++)
+ POUTPUT_CHARACTER Buf =
(POUTPUT_CHARACTER)Irp->AssociatedIrp.SystemBuffer;
+ PCHAR pChar = (PCHAR)MmGetSystemAddressForMdl(Irp->MdlAddress);
+ PUCHAR vidmem;
+ int offset;
+ ULONG dwCount;
+ ULONG nMaxLength;
+
+ if ( Buf->dwCoord.X < 0 || Buf->dwCoord.X >=
DeviceExtension->Columns ||
+ Buf->dwCoord.Y < 0 || Buf->dwCoord.Y >=
DeviceExtension->Rows )
{
- *pChar = vidmem[offset + (dwCount * 2)];
+ Buf->dwTransfered = 0;
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
}
- Buf->dwTransfered = dwCount;
- }
- else
- {
- Buf->dwTransfered = 0;
- }
+ if (!InbvCheckDisplayOwnership())
+ {
+ vidmem = DeviceExtension->VideoMemory;
+ offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) +
+ (Buf->dwCoord.X * 2);
+
+ nMaxLength = min(stk->Parameters.DeviceIoControl.OutputBufferLength,
+ (DeviceExtension->Rows - Buf->dwCoord.Y)
+ * DeviceExtension->Columns - Buf->dwCoord.X);
+
+ for (dwCount = 0; dwCount < nMaxLength; dwCount++, pChar++)
+ {
+ *pChar = vidmem[offset + (dwCount * 2)];
+ }
+
+ Buf->dwTransfered = dwCount;
+ }
+ else
+ {
+ Buf->dwTransfered = 0;
+ }
- Irp->IoStatus.Information = sizeof(OUTPUT_ATTRIBUTE);
- Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = sizeof(OUTPUT_ATTRIBUTE);
+ Status = STATUS_SUCCESS;
+ break;
}
- break;
- case IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER:
+ case IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER:
{
- COORD *pCoord = (COORD *)MmGetSystemAddressForMdl(Irp->MdlAddress);
- LPSTR pChar = (CHAR *)(pCoord + 1);
- PUCHAR vidmem;
- int offset;
- ULONG dwCount;
- ULONG nMaxLength;
-
- if ( pCoord->X < 0 || pCoord->X >= DeviceExtension->Columns ||
- pCoord->Y < 0 || pCoord->Y >= DeviceExtension->Rows )
- {
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
- break;
- }
-
- if (!InbvCheckDisplayOwnership())
- {
- vidmem = DeviceExtension->VideoMemory;
- offset = (pCoord->Y * DeviceExtension->Columns * 2) +
- (pCoord->X * 2);
-
- nMaxLength = min(stk->Parameters.DeviceIoControl.OutputBufferLength -
sizeof(COORD),
- (DeviceExtension->Rows - pCoord->Y)
- * DeviceExtension->Columns - pCoord->X);
-
- for (dwCount = 0; dwCount < nMaxLength; dwCount++, pChar++)
+ PCOORD pCoord = (PCOORD)MmGetSystemAddressForMdl(Irp->MdlAddress);
+ PCHAR pChar = (PCHAR)(pCoord + 1);
+ PUCHAR vidmem;
+ int offset;
+ ULONG dwCount;
+ ULONG nMaxLength;
+
+ if ( pCoord->X < 0 || pCoord->X >= DeviceExtension->Columns
||
+ pCoord->Y < 0 || pCoord->Y >= DeviceExtension->Rows )
{
- vidmem[offset + (dwCount * 2)] = *pChar;
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
}
- }
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
+ if (!InbvCheckDisplayOwnership())
+ {
+ vidmem = DeviceExtension->VideoMemory;
+ offset = (pCoord->Y * DeviceExtension->Columns * 2) +
+ (pCoord->X * 2);
+
+ nMaxLength = min(stk->Parameters.DeviceIoControl.OutputBufferLength -
sizeof(COORD),
+ (DeviceExtension->Rows - pCoord->Y)
+ * DeviceExtension->Columns - pCoord->X);
+
+ for (dwCount = 0; dwCount < nMaxLength; dwCount++, pChar++)
+ {
+ vidmem[offset + (dwCount * 2)] = *pChar;
+ }
+ }
+
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
}
- break;
- case IOCTL_CONSOLE_DRAW:
+ case IOCTL_CONSOLE_DRAW:
{
- PCONSOLE_DRAW ConsoleDraw;
- PUCHAR Src, Dest;
- UINT32 SrcDelta, DestDelta, i, Offset;
-
- if (!InbvCheckDisplayOwnership())
- {
- ConsoleDraw = (PCONSOLE_DRAW) MmGetSystemAddressForMdl(Irp->MdlAddress);
- Src = (PUCHAR) (ConsoleDraw + 1);
- SrcDelta = ConsoleDraw->SizeX * 2;
- Dest = DeviceExtension->VideoMemory +
- (ConsoleDraw->Y * DeviceExtension->Columns + ConsoleDraw->X)
* 2;
- DestDelta = DeviceExtension->Columns * 2;
-
- for (i = 0; i < ConsoleDraw->SizeY; i++)
+ PCONSOLE_DRAW ConsoleDraw;
+ PUCHAR Src, Dest;
+ UINT32 SrcDelta, DestDelta, i, Offset;
+
+ if (!InbvCheckDisplayOwnership())
{
- RtlCopyMemory(Dest, Src, SrcDelta);
- Src += SrcDelta;
- Dest += DestDelta;
- }
+ ConsoleDraw = (PCONSOLE_DRAW)
MmGetSystemAddressForMdl(Irp->MdlAddress);
+ Src = (PUCHAR) (ConsoleDraw + 1);
+ SrcDelta = ConsoleDraw->SizeX * 2;
+ Dest = DeviceExtension->VideoMemory +
+ (ConsoleDraw->Y * DeviceExtension->Columns +
ConsoleDraw->X) * 2;
+ DestDelta = DeviceExtension->Columns * 2;
+
+ for (i = 0; i < ConsoleDraw->SizeY; i++)
+ {
+ RtlCopyMemory(Dest, Src, SrcDelta);
+ Src += SrcDelta;
+ Dest += DestDelta;
+ }
- Offset = (ConsoleDraw->CursorY * DeviceExtension->Columns) +
- ConsoleDraw->CursorX;
+ Offset = (ConsoleDraw->CursorY * DeviceExtension->Columns) +
+ ConsoleDraw->CursorX;
- _disable();
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSLO);
- WRITE_PORT_UCHAR (CRTC_DATA, Offset);
- WRITE_PORT_UCHAR (CRTC_COMMAND, CRTC_CURSORPOSHI);
- WRITE_PORT_UCHAR (CRTC_DATA, Offset >> 8);
- _enable();
- }
+ _disable();
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSORPOSLO);
+ WRITE_PORT_UCHAR(CRTC_DATA, Offset);
+ WRITE_PORT_UCHAR(CRTC_COMMAND, CRTC_CURSORPOSHI);
+ WRITE_PORT_UCHAR(CRTC_DATA, Offset >> 8);
+ _enable();
+ }
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
}
- break;
- case IOCTL_CONSOLE_LOADFONT:
- {
- UINT32 CodePage = (UINT32)*(PULONG)Irp->AssociatedIrp.SystemBuffer;
+ case IOCTL_CONSOLE_LOADFONT:
+ {
+ ULONG CodePage = *(PULONG)Irp->AssociatedIrp.SystemBuffer;
- if (!InbvCheckDisplayOwnership())
- {
+ if (!InbvCheckDisplayOwnership())
+ {
/* Upload a font for the codepage if needed */
ScrLoadFontTable(CodePage);
- }
+ }
- Irp->IoStatus.Information = 0;
- Status = STATUS_SUCCESS;
- }
- break;
+ Irp->IoStatus.Information = 0;
+ Status = STATUS_SUCCESS;
+ break;
+ }
- default:
- Status = STATUS_NOT_IMPLEMENTED;
+ default:
+ Status = STATUS_NOT_IMPLEMENTED;
}
- Irp->IoStatus.Status = Status;
- IoCompleteRequest (Irp, IO_NO_INCREMENT);
+ Irp->IoStatus.Status = Status;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return Status;
+ return Status;
}
static DRIVER_DISPATCH ScrDispatch;
-static NTSTATUS NTAPI
-ScrDispatch(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
+static NTSTATUS
+NTAPI
+ScrDispatch(
+ _In_ PDEVICE_OBJECT DeviceObject,
+ _In_ PIRP Irp)
{
- PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation(Irp);
NTSTATUS Status;
+ PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation(Irp);
switch (stk->MajorFunction)
{
@@ -897,51 +911,50 @@ ScrDispatch(PDEVICE_OBJECT DeviceObject,
break;
}
-
Irp->IoStatus.Status = Status;
- IoCompleteRequest (Irp, IO_NO_INCREMENT);
-
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}
-
/*
* Module entry point
*/
-NTSTATUS NTAPI
-DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
+NTSTATUS
+NTAPI
+DriverEntry(
+ _In_ PDRIVER_OBJECT DriverObject,
+ _In_ PUNICODE_STRING RegistryPath)
{
- PDEVICE_OBJECT DeviceObject;
NTSTATUS Status;
+ PDEVICE_OBJECT DeviceObject;
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\BlueScreen");
UNICODE_STRING SymlinkName = RTL_CONSTANT_STRING(L"\\??\\BlueScreen");
- DPRINT ("Screen Driver 0.0.6\n");
+ DPRINT("Screen Driver 0.0.6\n");
DriverObject->MajorFunction[IRP_MJ_CREATE] = ScrCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = ScrDispatch;
DriverObject->MajorFunction[IRP_MJ_READ] = ScrDispatch;
DriverObject->MajorFunction[IRP_MJ_WRITE] = ScrWrite;
- DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL ] = ScrIoControl;
-
- Status = IoCreateDevice (DriverObject,
- sizeof(DEVICE_EXTENSION),
- &DeviceName,
- FILE_DEVICE_SCREEN,
- FILE_DEVICE_SECURE_OPEN,
- TRUE,
- &DeviceObject);
-
+ DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = ScrIoControl;
+
+ Status = IoCreateDevice(DriverObject,
+ sizeof(DEVICE_EXTENSION),
+ &DeviceName,
+ FILE_DEVICE_SCREEN,
+ FILE_DEVICE_SECURE_OPEN,
+ TRUE,
+ &DeviceObject);
if (!NT_SUCCESS(Status))
{
return Status;
}
- Status = IoCreateSymbolicLink (&SymlinkName, &DeviceName);
+ Status = IoCreateSymbolicLink(&SymlinkName, &DeviceName);
if (NT_SUCCESS(Status))
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
else
- IoDeleteDevice (DeviceObject);
+ IoDeleteDevice(DeviceObject);
return Status;
}
diff --git a/drivers/setup/blue/blue.h b/drivers/setup/blue/blue.h
index a137f8f9711..b18edfc2e04 100644
--- a/drivers/setup/blue/blue.h
+++ b/drivers/setup/blue/blue.h
@@ -1,9 +1,9 @@
/*
- * PROJECT: ReactOS Setup Driver
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: drivers/setup/blue/font.h
- * PURPOSE: Loading specific fonts into VGA
- * PROGRAMMERS: Aleksey Bragin (aleksey(a)reactos.org)
+ * PROJECT: ReactOS Console Text-Mode Device Driver
+ * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Main Header File.
+ * COPYRIGHT: Copyright 1999 Boudewijn Dekker
+ * Copyright 1999-2019 Eric Kohl
*/
#ifndef _BLUE_PCH_
@@ -11,34 +11,43 @@
#include <wdm.h>
+#define TAG_BLUE 'EULB'
+
+#define TAB_WIDTH 8
+#define MAX_PATH 260
+
typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES;
// Define material that normally comes from PSDK
// This is mandatory to prevent any inclusion of
// user-mode stuff.
-typedef struct tagCOORD {
- SHORT X;
- SHORT Y;
+typedef struct tagCOORD
+{
+ SHORT X;
+ SHORT Y;
} COORD, *PCOORD;
-typedef struct tagSMALL_RECT {
- SHORT Left;
- SHORT Top;
- SHORT Right;
- SHORT Bottom;
+typedef struct tagSMALL_RECT
+{
+ SHORT Left;
+ SHORT Top;
+ SHORT Right;
+ SHORT Bottom;
} SMALL_RECT;
-typedef struct tagCONSOLE_SCREEN_BUFFER_INFO {
- COORD dwSize;
- COORD dwCursorPosition;
- USHORT wAttributes;
- SMALL_RECT srWindow;
- COORD dwMaximumWindowSize;
+typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
+{
+ COORD dwSize;
+ COORD dwCursorPosition;
+ USHORT wAttributes;
+ SMALL_RECT srWindow;
+ COORD dwMaximumWindowSize;
} CONSOLE_SCREEN_BUFFER_INFO, *PCONSOLE_SCREEN_BUFFER_INFO;
-typedef struct tagCONSOLE_CURSOR_INFO {
- ULONG dwSize;
- BOOLEAN bVisible;
+typedef struct tagCONSOLE_CURSOR_INFO
+{
+ ULONG dwSize;
+ INT bVisible; // BOOL
} CONSOLE_CURSOR_INFO, *PCONSOLE_CURSOR_INFO;
#define ENABLE_PROCESSED_OUTPUT 0x0001
@@ -47,7 +56,17 @@ typedef struct tagCONSOLE_CURSOR_INFO {
#include <blue/ntddblue.h>
#include <ndk/inbvfuncs.h>
-#define TAG_BLUE 'EULB'
+/*
+ * Color attributes for text and screen background
+ */
+#define FOREGROUND_BLUE 0x0001
+#define FOREGROUND_GREEN 0x0002
+#define FOREGROUND_RED 0x0004
+#define FOREGROUND_INTENSITY 0x0008
+#define BACKGROUND_BLUE 0x0010
+#define BACKGROUND_GREEN 0x0020
+#define BACKGROUND_RED 0x0040
+#define BACKGROUND_INTENSITY 0x0080
typedef struct _CFHEADER
{
@@ -113,10 +132,6 @@ typedef struct _CFFILE
#define ATTRC_READREG ((PUCHAR)0x3c1)
#define ATTRC_INPST1 ((PUCHAR)0x3da)
-#define TAB_WIDTH 8
-
-#define MAX_PATH 260
-
#define MISC (PUCHAR)0x3c2
#define SEQ (PUCHAR)0x3c4
#define SEQDATA (PUCHAR)0x3c5
@@ -130,7 +145,6 @@ typedef struct _CFFILE
#define PELINDEX (PUCHAR)0x3c8
#define PELDATA (PUCHAR)0x3c9
-void ScrLoadFontTable(UINT32 CodePage);
-NTSTATUS ExtractFont(UINT32 CodePage, PUCHAR FontBitField);
+VOID ScrLoadFontTable(_In_ ULONG CodePage);
#endif /* _BLUE_PCH_ */
diff --git a/drivers/setup/blue/font.c b/drivers/setup/blue/font.c
index 0312b005d77..ba315f9e594 100644
--- a/drivers/setup/blue/font.c
+++ b/drivers/setup/blue/font.c
@@ -1,12 +1,11 @@
/*
-* PROJECT: ReactOS Setup Driver
-* LICENSE: GPL - See COPYING in the top level directory
-* FILE: drivers/setup/blue/font.c
-* PURPOSE: Loading specific fonts into VGA
-* PROGRAMMERS: Aleksey Bragin (aleksey(a)reactos.org)
-* Colin Finck (mail(a)colinfinck.de)
-* Christoph von Wittich (christoph_vw(a)reactos.org)
-*/
+ * PROJECT: ReactOS Console Text-Mode Device Driver
+ * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Loading specific fonts into VGA.
+ * COPYRIGHT: Copyright 2008-2019 Aleksey Bragin (aleksey(a)reactos.org)
+ * Copyright 2008-2019 Colin Finck (mail(a)colinfinck.de)
+ * Copyright 2008-2019 Christoph von Wittich (christoph_vw(a)reactos.org)
+ */
/* INCLUDES ***************************************************************/
@@ -17,15 +16,16 @@
#define NDEBUG
#include <debug.h>
-VOID OpenBitPlane();
-VOID CloseBitPlane();
-VOID LoadFont(PUCHAR Bitplane, PUCHAR FontBitfield);
+NTSTATUS ExtractFont(_In_ ULONG CodePage, _In_ PUCHAR FontBitField);
+VOID OpenBitPlane(VOID);
+VOID CloseBitPlane(VOID);
+VOID LoadFont(_In_ PUCHAR Bitplane, _In_ PUCHAR FontBitfield);
/* FUNCTIONS ****************************************************************/
VOID
ScrLoadFontTable(
- UINT32 CodePage)
+ _In_ ULONG CodePage)
{
PHYSICAL_ADDRESS BaseAddress;
PUCHAR Bitplane;
@@ -67,8 +67,8 @@ ScrLoadFontTable(
NTSTATUS
ExtractFont(
- UINT32 CodePage,
- PUCHAR FontBitField)
+ _In_ ULONG CodePage,
+ _In_ PUCHAR FontBitField)
{
BOOLEAN bFoundFile = FALSE;
HANDLE Handle;
@@ -299,8 +299,8 @@ CloseBitPlane(VOID)
VOID
LoadFont(
- PUCHAR Bitplane,
- PUCHAR FontBitfield)
+ _In_ PUCHAR Bitplane,
+ _In_ PUCHAR FontBitfield)
{
UINT32 i, j;
diff --git a/sdk/include/reactos/drivers/blue/ntddblue.h
b/sdk/include/reactos/drivers/blue/ntddblue.h
index 755538556ac..50ef34d2365 100644
--- a/sdk/include/reactos/drivers/blue/ntddblue.h
+++ b/sdk/include/reactos/drivers/blue/ntddblue.h
@@ -8,13 +8,11 @@
#define IOCTL_CONSOLE_GET_MODE CTL_CODE(FILE_DEVICE_SCREEN, 0x805,
METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_CONSOLE_SET_MODE CTL_CODE(FILE_DEVICE_SCREEN, 0x806,
METHOD_BUFFERED, FILE_WRITE_ACCESS)
-
#define IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE CTL_CODE(FILE_DEVICE_SCREEN, 0x810,
METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE CTL_CODE(FILE_DEVICE_SCREEN, 0x811,
METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE CTL_CODE(FILE_DEVICE_SCREEN, 0x812,
METHOD_IN_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE CTL_CODE(FILE_DEVICE_SCREEN, 0x813,
METHOD_BUFFERED, FILE_WRITE_ACCESS)
-
#define IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER CTL_CODE(FILE_DEVICE_SCREEN, 0x820,
METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_CONSOLE_READ_OUTPUT_CHARACTER CTL_CODE(FILE_DEVICE_SCREEN, 0x821,
METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER CTL_CODE(FILE_DEVICE_SCREEN, 0x822,
METHOD_IN_DIRECT, FILE_ANY_ACCESS)
@@ -23,44 +21,38 @@
#define IOCTL_CONSOLE_LOADFONT CTL_CODE(FILE_DEVICE_SCREEN, 0x840,
METHOD_IN_DIRECT, FILE_WRITE_ACCESS)
-
/* TYPEDEFS **************************************************************/
-
typedef struct tagCONSOLE_MODE
{
- ULONG dwMode;
+ ULONG dwMode;
} CONSOLE_MODE, *PCONSOLE_MODE;
-
typedef struct tagOUTPUT_ATTRIBUTE
{
- USHORT wAttribute;
- ULONG nLength;
- COORD dwCoord;
- ULONG dwTransfered;
+ USHORT wAttribute;
+ ULONG nLength;
+ COORD dwCoord;
+ ULONG dwTransfered;
} OUTPUT_ATTRIBUTE, *POUTPUT_ATTRIBUTE;
-
typedef struct tagOUTPUT_CHARACTER
{
- CHAR cCharacter;
- ULONG nLength;
- COORD dwCoord;
- ULONG dwTransfered;
+ CHAR cCharacter;
+ ULONG nLength;
+ COORD dwCoord;
+ ULONG dwTransfered;
} OUTPUT_CHARACTER, *POUTPUT_CHARACTER;
-
typedef struct tagCONSOLE_DRAW
{
- ULONG X; /* Origin */
- ULONG Y;
- ULONG SizeX; /* Size of the screen buffer (chars) */
- ULONG SizeY;
- ULONG CursorX; /* New cursor position (screen-relative) */
- ULONG CursorY;
- /* Followed by screen buffer in char/attrib format */
+ ULONG X; /* Origin */
+ ULONG Y;
+ ULONG SizeX; /* Size of the screen buffer (chars) */
+ ULONG SizeY;
+ ULONG CursorX; /* New cursor position (screen-relative) */
+ ULONG CursorY;
+ /* Followed by screen buffer in char/attrib format */
} CONSOLE_DRAW, *PCONSOLE_DRAW;
-
#endif /* _NTDDBLUE_H_INCLUDED_ */