mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Simplified driver initialization
svn path=/trunk/; revision=1221
This commit is contained in:
parent
73437d2939
commit
add4b2d35b
3 changed files with 45 additions and 57 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: beep.c,v 1.4 1999/10/16 12:41:42 ekohl Exp $
|
/* $Id: beep.c,v 1.5 2000/07/02 10:54:12 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -227,7 +227,8 @@ NTSTATUS BeepUnload(PDRIVER_OBJECT DriverObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
STDCALL NTSTATUS
|
NTSTATUS
|
||||||
|
STDCALL
|
||||||
DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Called by the system to initalize the driver
|
* FUNCTION: Called by the system to initalize the driver
|
||||||
|
@ -237,35 +238,14 @@ DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
||||||
* RETURNS: Success or failure
|
* RETURNS: Success or failure
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT DeviceObject;
|
|
||||||
PDEVICE_EXTENSION DeviceExtension;
|
PDEVICE_EXTENSION DeviceExtension;
|
||||||
NTSTATUS ret;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
ANSI_STRING ansi_device_name;
|
UNICODE_STRING DeviceName;
|
||||||
UNICODE_STRING device_name;
|
UNICODE_STRING SymlinkName;
|
||||||
ANSI_STRING asymlink_name;
|
NTSTATUS Status;
|
||||||
UNICODE_STRING symlink_name;
|
|
||||||
|
|
||||||
DbgPrint ("Beep Device Driver 0.0.2\n");
|
DbgPrint ("Beep Device Driver 0.0.2\n");
|
||||||
|
|
||||||
RtlInitAnsiString (&ansi_device_name, "\\Device\\Beep");
|
|
||||||
RtlAnsiStringToUnicodeString (&device_name, &ansi_device_name, TRUE);
|
|
||||||
ret = IoCreateDevice (DriverObject,
|
|
||||||
sizeof(DEVICE_EXTENSION),
|
|
||||||
&device_name,
|
|
||||||
FILE_DEVICE_BEEP,
|
|
||||||
0,
|
|
||||||
FALSE,
|
|
||||||
&DeviceObject);
|
|
||||||
if (ret!=STATUS_SUCCESS)
|
|
||||||
{
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* prelininary */
|
|
||||||
RtlInitAnsiString (&asymlink_name, "\\??\\Beep");
|
|
||||||
RtlAnsiStringToUnicodeString (&symlink_name, &asymlink_name, TRUE);
|
|
||||||
IoCreateSymbolicLink (&symlink_name, &device_name);
|
|
||||||
|
|
||||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = BeepCreate;
|
DriverObject->MajorFunction[IRP_MJ_CREATE] = BeepCreate;
|
||||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = BeepClose;
|
DriverObject->MajorFunction[IRP_MJ_CLOSE] = BeepClose;
|
||||||
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = BeepCleanup;
|
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = BeepCleanup;
|
||||||
|
@ -284,6 +264,20 @@ DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
||||||
SynchronizationEvent,
|
SynchronizationEvent,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
RtlInitUnicodeString (&DeviceName, L"\\Device\\Beep");
|
||||||
|
Status = IoCreateDevice (DriverObject,
|
||||||
|
sizeof(DEVICE_EXTENSION),
|
||||||
|
&DeviceName,
|
||||||
|
FILE_DEVICE_BEEP,
|
||||||
|
0,
|
||||||
|
FALSE,
|
||||||
|
&DeviceObject);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
return Status;
|
||||||
|
|
||||||
|
RtlInitUnicodeString (&SymlinkName, L"\\??\\Beep");
|
||||||
|
IoCreateSymbolicLink (&SymlinkName, &DeviceName);
|
||||||
|
|
||||||
return (STATUS_SUCCESS);
|
return (STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: blue.c,v 1.24 2000/06/29 23:35:47 dwelch Exp $
|
/* $Id: blue.c,v 1.25 2000/07/02 10:54:23 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -599,14 +599,13 @@ ScrDispatch (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
/*
|
/*
|
||||||
* Module entry point
|
* Module entry point
|
||||||
*/
|
*/
|
||||||
NTSTATUS STDCALL
|
NTSTATUS
|
||||||
|
STDCALL
|
||||||
DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
ANSI_STRING adevice_name;
|
UNICODE_STRING DeviceName;
|
||||||
UNICODE_STRING device_name;
|
UNICODE_STRING SymlinkName;
|
||||||
ANSI_STRING asymlink_name;
|
|
||||||
UNICODE_STRING symlink_name;
|
|
||||||
|
|
||||||
DbgPrint ("Screen Driver 0.0.6\n");
|
DbgPrint ("Screen Driver 0.0.6\n");
|
||||||
|
|
||||||
|
@ -616,22 +615,17 @@ DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
||||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = ScrWrite;
|
DriverObject->MajorFunction[IRP_MJ_WRITE] = ScrWrite;
|
||||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL ] = ScrIoControl;
|
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL ] = ScrIoControl;
|
||||||
|
|
||||||
RtlInitAnsiString (&adevice_name, "\\Device\\BlueScreen");
|
RtlInitUnicodeString (&DeviceName, L"\\Device\\BlueScreen");
|
||||||
RtlAnsiStringToUnicodeString (&device_name, &adevice_name, TRUE);
|
|
||||||
IoCreateDevice (DriverObject,
|
IoCreateDevice (DriverObject,
|
||||||
sizeof(DEVICE_EXTENSION),
|
sizeof(DEVICE_EXTENSION),
|
||||||
&device_name,
|
&DeviceName,
|
||||||
FILE_DEVICE_SCREEN,
|
FILE_DEVICE_SCREEN,
|
||||||
0,
|
0,
|
||||||
TRUE,
|
TRUE,
|
||||||
&DeviceObject);
|
&DeviceObject);
|
||||||
|
|
||||||
RtlInitAnsiString (&asymlink_name, "\\??\\BlueScreen");
|
RtlInitUnicodeString (&SymlinkName, L"\\??\\BlueScreen");
|
||||||
RtlAnsiStringToUnicodeString (&symlink_name, &asymlink_name, TRUE);
|
IoCreateSymbolicLink (&SymlinkName, &DeviceName);
|
||||||
IoCreateSymbolicLink (&symlink_name, &device_name);
|
|
||||||
|
|
||||||
RtlFreeUnicodeString (&device_name);
|
|
||||||
RtlFreeUnicodeString (&symlink_name);
|
|
||||||
|
|
||||||
return (STATUS_SUCCESS);
|
return (STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: null.c,v 1.3 1999/12/04 20:58:39 ea Exp $
|
/* $Id: null.c,v 1.4 2000/07/02 10:54:41 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -68,7 +68,8 @@ NTSTATUS NullUnload(PDRIVER_OBJECT DriverObject)
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS
|
||||||
|
STDCALL
|
||||||
DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Called by the system to initalize the driver
|
* FUNCTION: Called by the system to initalize the driver
|
||||||
|
@ -79,21 +80,11 @@ DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
NTSTATUS ret;
|
UNICODE_STRING DeviceName;
|
||||||
ANSI_STRING ansi_device_name;
|
NTSTATUS Status;
|
||||||
UNICODE_STRING device_name;
|
|
||||||
|
|
||||||
DbgPrint("Null Device Driver 0.0.2\n");
|
DbgPrint("Null Device Driver 0.0.2\n");
|
||||||
|
|
||||||
RtlInitAnsiString(&ansi_device_name,"\\Device\\NUL");
|
|
||||||
RtlAnsiStringToUnicodeString(&device_name,&ansi_device_name,TRUE);
|
|
||||||
ret = IoCreateDevice(DriverObject,0,&device_name,
|
|
||||||
FILE_DEVICE_NULL,0,FALSE,&DeviceObject);
|
|
||||||
if (ret!=STATUS_SUCCESS)
|
|
||||||
{
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
DeviceObject->Flags=0;
|
DeviceObject->Flags=0;
|
||||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = NullDispatch;
|
DriverObject->MajorFunction[IRP_MJ_CLOSE] = NullDispatch;
|
||||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = NullDispatch;
|
DriverObject->MajorFunction[IRP_MJ_CREATE] = NullDispatch;
|
||||||
|
@ -101,6 +92,15 @@ DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
||||||
DriverObject->MajorFunction[IRP_MJ_READ] = NullDispatch;
|
DriverObject->MajorFunction[IRP_MJ_READ] = NullDispatch;
|
||||||
DriverObject->DriverUnload = NullUnload;
|
DriverObject->DriverUnload = NullUnload;
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
RtlInitUnicodeString(&DeviceName,
|
||||||
|
L"\\Device\\Null");
|
||||||
|
Status = IoCreateDevice(DriverObject,
|
||||||
|
0,
|
||||||
|
&DeviceName,
|
||||||
|
FILE_DEVICE_NULL,
|
||||||
|
0,
|
||||||
|
FALSE,
|
||||||
|
&DeviceObject);
|
||||||
|
return (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue