Bug fixes and redesign of a few ioctls

svn path=/trunk/; revision=1585
This commit is contained in:
Phillip Susi 2001-01-31 02:24:46 +00:00
parent 20916cab69
commit 79c82716fa

View file

@ -1,4 +1,4 @@
/* $Id: blue.c,v 1.28 2000/09/29 15:03:21 jean Exp $ /* $Id: blue.c,v 1.29 2001/01/31 02:24:46 phreak Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -286,9 +286,7 @@ STDCALL ScrIoControl (PDEVICE_OBJECT DeviceObject, PIRP Irp)
PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation (Irp); PIO_STACK_LOCATION stk = IoGetCurrentIrpStackLocation (Irp);
PDEVICE_EXTENSION DeviceExtension; PDEVICE_EXTENSION DeviceExtension;
NTSTATUS Status; NTSTATUS Status;
DeviceExtension = DeviceObject->DeviceExtension; DeviceExtension = DeviceObject->DeviceExtension;
switch (stk->Parameters.DeviceIoControl.IoControlCode) switch (stk->Parameters.DeviceIoControl.IoControlCode)
{ {
case IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO: case IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO:
@ -462,24 +460,21 @@ STDCALL ScrIoControl (PDEVICE_OBJECT DeviceObject, PIRP Irp)
case IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE: case IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE:
{ {
POUTPUT_ATTRIBUTE Buf = (POUTPUT_ATTRIBUTE)Irp->AssociatedIrp.SystemBuffer; COORD *pCoord = (COORD *)MmGetSystemAddressForMdl(Irp->MdlAddress);
PWORD pAttr = (PWORD)MmGetSystemAddressForMdl(Irp->MdlAddress); CHAR *pAttr = (CHAR *)(pCoord + 1);
char *vidmem; char *vidmem;
int offset; int offset;
DWORD dwCount; DWORD dwCount;
vidmem = DeviceExtension->VideoMemory; vidmem = DeviceExtension->VideoMemory;
offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) + offset = (pCoord->Y * DeviceExtension->Columns * 2) +
(Buf->dwCoord.X * 2) + 1; (pCoord->X * 2) + 1;
for (dwCount = 0; dwCount < stk->Parameters.Write.Length; dwCount++, pAttr++) for (dwCount = 0; dwCount < (stk->Parameters.Write.Length - sizeof( COORD )); dwCount++, pAttr++)
{ {
vidmem[offset + (dwCount * 2)] = (char) *pAttr; vidmem[offset + (dwCount * 2)] = *pAttr;
} }
Irp->IoStatus.Information = 0;
Buf->dwTransfered = dwCount;
Irp->IoStatus.Information = sizeof(OUTPUT_ATTRIBUTE);
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
} }
break; break;
@ -542,24 +537,23 @@ STDCALL ScrIoControl (PDEVICE_OBJECT DeviceObject, PIRP Irp)
case IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER: case IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER:
{ {
POUTPUT_CHARACTER Buf = (POUTPUT_CHARACTER)Irp->AssociatedIrp.SystemBuffer; COORD *pCoord;
LPSTR pChar = (LPSTR)MmGetSystemAddressForMdl(Irp->MdlAddress); LPSTR pChar;
char *vidmem; char *vidmem;
int offset; int offset;
DWORD dwCount; DWORD dwCount;
pCoord = (COORD *)MmGetSystemAddressForMdl(Irp->MdlAddress);
pChar = (CHAR *)(pCoord + 1);
vidmem = DeviceExtension->VideoMemory; vidmem = DeviceExtension->VideoMemory;
offset = (Buf->dwCoord.Y * DeviceExtension->Columns * 2) + offset = (pCoord->Y * DeviceExtension->Columns * 2) +
(Buf->dwCoord.X * 2) + 1; (pCoord->X * 2);
for (dwCount = 0; dwCount < stk->Parameters.Write.Length; dwCount++, pChar++) for (dwCount = 0; dwCount < (stk->Parameters.Write.Length - sizeof( COORD )); dwCount++, pChar++)
{ {
vidmem[offset + (dwCount * 2)] = (char) *pChar; vidmem[offset + (dwCount * 2)] = *pChar;
} }
Buf->dwTransfered = dwCount; Irp->IoStatus.Information = 0;
Irp->IoStatus.Information = sizeof(OUTPUT_ATTRIBUTE);
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
} }
break; break;