[NTOS:MM] Implement and use MiAcquirePfnLockAtDpcLevel/MiReleasePfnLockFromDpcLevel.
[reactos.git] / drivers / serial / serenum / serenum.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Serial enumerator driver
4 * FILE: drivers/bus/serenum/serenum.c
5 * PURPOSE: Serial enumerator driver entry point
6 *
7 * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
8 */
9
10 #include "serenum.h"
11
12 #include <debug.h>
13
14 static DRIVER_DISPATCH SerenumPnp;
15 static DRIVER_DISPATCH IrpStub;
16 static DRIVER_UNLOAD DriverUnload;
17 DRIVER_INITIALIZE DriverEntry;
18
19 static NTSTATUS NTAPI
20 SerenumPnp(
21 IN PDEVICE_OBJECT DeviceObject,
22 IN PIRP Irp)
23 {
24 if (((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
25 return SerenumFdoPnp(DeviceObject, Irp);
26 else
27 return SerenumPdoPnp(DeviceObject, Irp);
28 }
29
30 static VOID NTAPI
31 DriverUnload(IN PDRIVER_OBJECT DriverObject)
32 {
33 // nothing to do here yet
34 }
35
36 static NTSTATUS NTAPI
37 IrpStub(
38 IN PDEVICE_OBJECT DeviceObject,
39 IN PIRP Irp)
40 {
41 if (((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
42 {
43 /* Forward IRPs to lower device */
44 return ForwardIrpToLowerDeviceAndForget(DeviceObject, Irp);
45 }
46 else
47 {
48 /* Forward IRPs to attached FDO */
49 return ForwardIrpToAttachedFdoAndForget(DeviceObject, Irp);
50 }
51 }
52
53 /*
54 * Standard DriverEntry method.
55 */
56 NTSTATUS NTAPI
57 DriverEntry(
58 IN PDRIVER_OBJECT DriverObject,
59 IN PUNICODE_STRING RegPath)
60 {
61 ULONG i;
62
63 DriverObject->DriverUnload = DriverUnload;
64 DriverObject->DriverExtension->AddDevice = SerenumAddDevice;
65
66 for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
67 DriverObject->MajorFunction[i] = IrpStub;
68
69 //DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = SerialQueryInformation;
70 DriverObject->MajorFunction[IRP_MJ_PNP] = SerenumPnp;
71 //DriverObject->MajorFunction[IRP_MJ_POWER] = SerialPower;
72
73 return STATUS_SUCCESS;
74 }