mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Add DebugOut device driver
svn path=/trunk/; revision=4741
This commit is contained in:
parent
5882d8441a
commit
fe8db53413
9 changed files with 200 additions and 1 deletions
|
@ -56,7 +56,7 @@ DRIVERS_LIB = bzip2
|
|||
# Kernel mode device drivers
|
||||
# Obsolete: ide
|
||||
# beep blue floppy null parallel ramdrv serenum serial vga videoprt
|
||||
DEVICE_DRIVERS = beep blue floppy null serial vga videoprt
|
||||
DEVICE_DRIVERS = beep blue debugout floppy null serial vga videoprt
|
||||
|
||||
# Kernel mode input drivers
|
||||
# keyboard mouclass psaux sermouse
|
||||
|
|
|
@ -45,6 +45,7 @@ copy /Y drivers\bus\isapnp\isapnp.sys %BOOTCD_DIR%\disk\reactos
|
|||
|
||||
copy /Y drivers\dd\beep\beep.sys %BOOTCD_DIR%\disk\reactos
|
||||
copy /Y drivers\dd\blue\blue.sys %BOOTCD_DIR%\disk\reactos
|
||||
copy /Y drivers\dd\debugout\debugout.sys %BOOTCD_DIR%\disk\reactos
|
||||
copy /Y drivers\dd\floppy\floppy.sys %BOOTCD_DIR%\disk\reactos
|
||||
copy /Y drivers\dd\null\null.sys %BOOTCD_DIR%\disk\reactos
|
||||
copy /Y drivers\dd\serial\serial.sys %BOOTCD_DIR%\disk\reactos
|
||||
|
|
|
@ -134,6 +134,13 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Class2","ImagePath",0x00020000,"system32
|
|||
HKLM,"SYSTEM\CurrentControlSet\Services\Class2","Start",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Class2","Type",0x00010001,0x00000001
|
||||
|
||||
; Debug output driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DebugOut","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DebugOut","Group",0x00000000,"Debug"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DebugOut","ImagePath",0x00020000,"system32\drivers\debugout.sys"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DebugOut","Start",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DebugOut","Type",0x00010001,0x00000001
|
||||
|
||||
; Disk class driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Disk","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Disk","Group",0x00000000,"SCSI Class"
|
||||
|
|
|
@ -19,6 +19,7 @@ isapnp.sys = 3
|
|||
|
||||
beep.sys = 3
|
||||
blue.sys = 3
|
||||
debugout.sys = 3
|
||||
floppy.sys = 3
|
||||
null.sys = 3
|
||||
serial.sys = 3
|
||||
|
|
7
reactos/drivers/dd/debugout/.cvsignore
Normal file
7
reactos/drivers/dd/debugout/.cvsignore
Normal file
|
@ -0,0 +1,7 @@
|
|||
base.tmp
|
||||
junk.tmp
|
||||
temp.exp
|
||||
debugout.coff
|
||||
*.sym
|
||||
*.o
|
||||
*.sys
|
130
reactos/drivers/dd/debugout/debugout.c
Normal file
130
reactos/drivers/dd/debugout/debugout.c
Normal file
|
@ -0,0 +1,130 @@
|
|||
/* $Id: debugout.c,v 1.1 2003/05/22 15:11:29 gvg Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/debugout.c
|
||||
* PURPOSE: Debug output device driver
|
||||
* PROGRAMMER: Ge van Geldorp (ge@gse.nl)
|
||||
* UPDATE HISTORY:
|
||||
* 2003/05/22: Created
|
||||
* NOTES:
|
||||
* In your usermode application, do something like this:
|
||||
*
|
||||
* DebugHandle = CreateFile("\\\\.\\DebugOut",
|
||||
* GENERIC_WRITE,
|
||||
* 0,
|
||||
* NULL,
|
||||
* OPEN_EXISTING,
|
||||
* FILE_ATTRIBUTE_NORMAL,
|
||||
* NULL);
|
||||
*
|
||||
* and write to your hearts content to DebugHandle.
|
||||
*/
|
||||
|
||||
/* INCLUDES */
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
/* FUNCTIONS */
|
||||
NTSTATUS STDCALL_FUNC
|
||||
DebugOutDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION piosStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
NTSTATUS nErrCode;
|
||||
char *Start;
|
||||
char Buf[513];
|
||||
unsigned Remaining;
|
||||
unsigned Length;
|
||||
|
||||
nErrCode = STATUS_SUCCESS;
|
||||
|
||||
switch(piosStack->MajorFunction)
|
||||
{
|
||||
/* opening and closing handles to the device */
|
||||
case IRP_MJ_CREATE:
|
||||
case IRP_MJ_CLOSE:
|
||||
break;
|
||||
|
||||
/* write data */
|
||||
case IRP_MJ_WRITE:
|
||||
Remaining = piosStack->Parameters.Write.Length;
|
||||
Start = Irp->AssociatedIrp.SystemBuffer;
|
||||
while (0 < Remaining)
|
||||
{
|
||||
Length = Remaining;
|
||||
if (sizeof(Buf) - 1 < Length)
|
||||
{
|
||||
Length = sizeof(Buf) - 1;
|
||||
}
|
||||
RtlCopyMemory(Buf, Start, Length);
|
||||
Buf[Length] = '\0';
|
||||
DbgPrint("%s", Buf);
|
||||
Remaining -= Length;
|
||||
Start += Length;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Information = piosStack->Parameters.Write.Length;
|
||||
break;
|
||||
|
||||
/* read data */
|
||||
case IRP_MJ_READ:
|
||||
Irp->IoStatus.Information = 0;
|
||||
nErrCode = STATUS_END_OF_FILE;
|
||||
break;
|
||||
|
||||
/* unsupported operations */
|
||||
default:
|
||||
nErrCode = STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = nErrCode;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return nErrCode;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
DebugOutUnload(PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
||||
{
|
||||
PDEVICE_OBJECT DebugOutDevice;
|
||||
UNICODE_STRING DeviceName;
|
||||
UNICODE_STRING DosName;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* register driver routines */
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = (PDRIVER_DISPATCH) DebugOutDispatch;
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = (PDRIVER_DISPATCH) DebugOutDispatch;
|
||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = (PDRIVER_DISPATCH) DebugOutDispatch;
|
||||
DriverObject->MajorFunction[IRP_MJ_READ] = (PDRIVER_DISPATCH) DebugOutDispatch;
|
||||
/* DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = (PDRIVER_DISPATCH) DebugOutDispatch; */
|
||||
DriverObject->DriverUnload = (PDRIVER_UNLOAD) DebugOutUnload;
|
||||
|
||||
/* create device */
|
||||
RtlInitUnicodeStringFromLiteral(&DeviceName, L"\\Device\\DebugOut");
|
||||
|
||||
Status = IoCreateDevice(DriverObject, 0, &DeviceName, FILE_DEVICE_NULL,
|
||||
0, FALSE, &DebugOutDevice);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
RtlInitUnicodeStringFromLiteral(&DosName, L"\\DosDevices\\DebugOut");
|
||||
Status = IoCreateSymbolicLink(&DosName, &DeviceName);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
IoDeleteDevice(DebugOutDevice);
|
||||
return Status;
|
||||
}
|
||||
|
||||
DebugOutDevice->Flags |= DO_BUFFERED_IO;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
39
reactos/drivers/dd/debugout/debugout.rc
Normal file
39
reactos/drivers/dd/debugout/debugout.rc
Normal file
|
@ -0,0 +1,39 @@
|
|||
|
||||
#include <defines.h>
|
||||
#include <reactos/resource.h>
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
|
||||
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", RES_STR_COMPANY_NAME
|
||||
VALUE "FileDescription", "Debug output Device Driver\0"
|
||||
VALUE "FileVersion", "0.0.1\0"
|
||||
VALUE "InternalName", "debug\0"
|
||||
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
|
||||
VALUE "OriginalFilename", "debugout.sys\0"
|
||||
VALUE "ProductName", RES_STR_PRODUCT_NAME
|
||||
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
13
reactos/drivers/dd/debugout/makefile
Normal file
13
reactos/drivers/dd/debugout/makefile
Normal file
|
@ -0,0 +1,13 @@
|
|||
# $Id: makefile,v 1.1 2003/05/22 15:11:29 gvg Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_TYPE = driver
|
||||
|
||||
TARGET_NAME = debugout
|
||||
|
||||
TARGET_OBJECTS = debugout.o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
|
@ -44,6 +44,7 @@ copy drivers\input\mouclass\mouclass.sys %ROS_INSTALL%\system32\drivers
|
|||
copy drivers\input\psaux\psaux.sys %ROS_INSTALL%\system32\drivers
|
||||
copy drivers\dd\blue\blue.sys %ROS_INSTALL%\system32\drivers
|
||||
copy drivers\dd\beep\beep.sys %ROS_INSTALL%\system32\drivers
|
||||
copy drivers\dd\debugout\debugout.sys %ROS_INSTALL%\system32\drivers
|
||||
copy drivers\dd\null\null.sys %ROS_INSTALL%\system32\drivers
|
||||
copy drivers\dd\serial\serial.sys %ROS_INSTALL%\system32\drivers
|
||||
copy drivers\dd\serenum\serenum.sys %ROS_INSTALL%\system32\drivers
|
||||
|
|
Loading…
Reference in a new issue