xref: /reactos/drivers/serial/serenum/serenum.h (revision c2c66aff)
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS Serial enumerator driver
4  * FILE:            drivers/bus/serenum/serenum.h
5  * PURPOSE:         Serial enumerator driver header
6  *
7  * PROGRAMMERS:     Herv� Poussineau (hpoussin@reactos.org)
8  */
9 
10 #ifndef _SERENUM_PCH_
11 #define _SERENUM_PCH_
12 
13 #include <ntifs.h>
14 #include <ntddser.h>
15 
16 typedef enum
17 {
18   dsStopped,
19   dsStarted,
20   dsPaused,
21   dsRemoved,
22   dsSurpriseRemoved
23 } SERENUM_DEVICE_STATE;
24 
25 typedef struct _COMMON_DEVICE_EXTENSION
26 {
27 	BOOLEAN IsFDO;
28 	SERENUM_DEVICE_STATE PnpState;
29 } COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
30 
31 typedef struct _FDO_DEVICE_EXTENSION
32 {
33 	COMMON_DEVICE_EXTENSION Common;
34 
35 	PDEVICE_OBJECT LowerDevice;
36 	PDEVICE_OBJECT Pdo;
37 	IO_REMOVE_LOCK RemoveLock;
38 
39 	UNICODE_STRING SerenumInterfaceName;
40 
41 	PDEVICE_OBJECT AttachedPdo;
42 	ULONG Flags;
43 } FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
44 
45 typedef struct _PDO_DEVICE_EXTENSION
46 {
47 	COMMON_DEVICE_EXTENSION Common;
48 
49 	PDEVICE_OBJECT AttachedFdo;
50 
51 	UNICODE_STRING DeviceDescription; // REG_SZ
52 	UNICODE_STRING DeviceId;          // REG_SZ
53 	UNICODE_STRING InstanceId;        // REG_SZ
54 	UNICODE_STRING HardwareIds;       // REG_MULTI_SZ
55 	UNICODE_STRING CompatibleIds;     // REG_MULTI_SZ
56 } PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
57 
58 #define SERENUM_TAG 'ereS'
59 
60 /* Flags */
61 #define FLAG_ENUMERATION_DONE    0x01
62 
63 /************************************ detect.c */
64 
65 NTSTATUS
66 SerenumDetectPnpDevice(
67 	IN PDEVICE_OBJECT DeviceObject,
68 	IN PDEVICE_OBJECT LowerDevice);
69 
70 NTSTATUS
71 SerenumDetectLegacyDevice(
72 	IN PDEVICE_OBJECT DeviceObject,
73 	IN PDEVICE_OBJECT LowerDevice);
74 
75 /************************************ fdo.c */
76 
77 DRIVER_ADD_DEVICE SerenumAddDevice;
78 
79 NTSTATUS
80 SerenumFdoPnp(
81 	IN PDEVICE_OBJECT DeviceObject,
82 	IN PIRP Irp);
83 
84 /************************************ misc.c */
85 
86 NTSTATUS
87 SerenumInitMultiSzString(
88 	OUT PUNICODE_STRING Destination,
89 	... /* list of PCSZ */);
90 
91 NTSTATUS
92 ForwardIrpAndWait(
93 	IN PDEVICE_OBJECT DeviceObject,
94 	IN PIRP Irp);
95 
96 NTSTATUS NTAPI
97 ForwardIrpToLowerDeviceAndForget(
98 	IN PDEVICE_OBJECT DeviceObject,
99 	IN PIRP Irp);
100 
101 NTSTATUS NTAPI
102 ForwardIrpToAttachedFdoAndForget(
103 	IN PDEVICE_OBJECT DeviceObject,
104 	IN PIRP Irp);
105 
106 NTSTATUS NTAPI
107 ForwardIrpAndForget(
108 	IN PDEVICE_OBJECT DeviceObject,
109 	IN PIRP Irp);
110 
111 NTSTATUS
112 DuplicateUnicodeString(
113 	IN ULONG Flags,
114 	IN PCUNICODE_STRING SourceString,
115 	OUT PUNICODE_STRING DestinationString);
116 
117 /************************************ pdo.c */
118 
119 NTSTATUS
120 SerenumPdoPnp(
121 	IN PDEVICE_OBJECT DeviceObject,
122 	IN PIRP Irp);
123 
124 /************************************ serenum.c */
125 
126 NTSTATUS NTAPI
127 DriverEntry(
128 	IN PDRIVER_OBJECT DriverObject,
129 	IN PUNICODE_STRING RegPath);
130 
131 #endif /* _SERENUM_PCH_ */
132