2005-07-07 23:10:35 +00:00
|
|
|
|
/*
|
2005-04-05 19:04:07 +00:00
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
|
* PROJECT: ReactOS Serial enumerator driver
|
|
|
|
|
* FILE: drivers/bus/serenum/serenum.c
|
2005-06-13 21:51:42 +00:00
|
|
|
|
* PURPOSE: Serial enumerator driver entry point
|
2005-05-08 02:16:32 +00:00
|
|
|
|
*
|
2007-07-08 22:19:51 +00:00
|
|
|
|
* PROGRAMMERS: Herv<EFBFBD> Poussineau (hpoussin@reactos.org)
|
2005-04-05 19:04:07 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "serenum.h"
|
|
|
|
|
|
2014-02-03 00:13:57 +00:00
|
|
|
|
#include <debug.h>
|
|
|
|
|
|
2007-03-28 18:47:35 +00:00
|
|
|
|
static DRIVER_DISPATCH SerenumPnp;
|
|
|
|
|
static DRIVER_DISPATCH IrpStub;
|
|
|
|
|
static DRIVER_UNLOAD DriverUnload;
|
|
|
|
|
DRIVER_INITIALIZE DriverEntry;
|
|
|
|
|
|
2006-06-07 17:31:43 +00:00
|
|
|
|
static NTSTATUS NTAPI
|
2005-04-05 19:04:07 +00:00
|
|
|
|
SerenumPnp(
|
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
|
IN PIRP Irp)
|
|
|
|
|
{
|
|
|
|
|
if (((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
|
|
|
|
|
return SerenumFdoPnp(DeviceObject, Irp);
|
|
|
|
|
else
|
|
|
|
|
return SerenumPdoPnp(DeviceObject, Irp);
|
|
|
|
|
}
|
|
|
|
|
|
2006-06-07 17:31:43 +00:00
|
|
|
|
static VOID NTAPI
|
2005-04-05 19:04:07 +00:00
|
|
|
|
DriverUnload(IN PDRIVER_OBJECT DriverObject)
|
|
|
|
|
{
|
|
|
|
|
// nothing to do here yet
|
|
|
|
|
}
|
|
|
|
|
|
2006-06-07 17:31:43 +00:00
|
|
|
|
static NTSTATUS NTAPI
|
2005-04-05 19:04:07 +00:00
|
|
|
|
IrpStub(
|
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
|
IN PIRP Irp)
|
|
|
|
|
{
|
|
|
|
|
if (((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
|
|
|
|
|
{
|
2008-05-18 11:45:26 +00:00
|
|
|
|
/* Forward IRPs to lower device */
|
|
|
|
|
return ForwardIrpToLowerDeviceAndForget(DeviceObject, Irp);
|
2005-04-05 19:04:07 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2008-05-18 11:45:26 +00:00
|
|
|
|
/* Forward IRPs to attached FDO */
|
|
|
|
|
return ForwardIrpToAttachedFdoAndForget(DeviceObject, Irp);
|
2005-04-05 19:04:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Standard DriverEntry method.
|
|
|
|
|
*/
|
2006-06-07 17:31:43 +00:00
|
|
|
|
NTSTATUS NTAPI
|
2005-04-05 19:04:07 +00:00
|
|
|
|
DriverEntry(
|
|
|
|
|
IN PDRIVER_OBJECT DriverObject,
|
|
|
|
|
IN PUNICODE_STRING RegPath)
|
|
|
|
|
{
|
|
|
|
|
ULONG i;
|
2005-05-08 02:16:32 +00:00
|
|
|
|
|
2005-04-05 19:04:07 +00:00
|
|
|
|
DriverObject->DriverUnload = DriverUnload;
|
|
|
|
|
DriverObject->DriverExtension->AddDevice = SerenumAddDevice;
|
2005-05-08 02:16:32 +00:00
|
|
|
|
|
2005-12-18 20:50:26 +00:00
|
|
|
|
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
|
2005-04-05 19:04:07 +00:00
|
|
|
|
DriverObject->MajorFunction[i] = IrpStub;
|
2005-05-08 02:16:32 +00:00
|
|
|
|
|
2005-04-05 19:04:07 +00:00
|
|
|
|
//DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = SerialQueryInformation;
|
|
|
|
|
DriverObject->MajorFunction[IRP_MJ_PNP] = SerenumPnp;
|
|
|
|
|
//DriverObject->MajorFunction[IRP_MJ_POWER] = SerialPower;
|
2005-05-08 02:16:32 +00:00
|
|
|
|
|
2005-04-05 19:04:07 +00:00
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
|
}
|