[ROSAPPS]
[reactos.git] / rosapps / drivers / green / green.h
1 #include <stdarg.h>
2 #include <ntifs.h>
3 #include <ndk/iotypes.h>
4 #include <ndk/obfuncs.h>
5 #include <windef.h>
6 #define WINBASEAPI
7 typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES;
8 #include <ntddser.h>
9 #include <kbdmou.h>
10 #include <wincon.h>
11 #include <drivers/blue/ntddblue.h>
12
13 #define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE 1
14 #define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING 2
15
16 #define INFINITE -1
17 #define KEYBOARD_BUFFER_SIZE 100
18
19 typedef enum
20 {
21 GreenPDO,
22 ScreenPDO,
23 KeyboardPDO,
24 GreenFDO,
25 ScreenFDO,
26 KeyboardFDO,
27 PassThroughFDO,
28 } GREEN_DEVICE_TYPE;
29
30 typedef struct _COMMON_DEVICE_EXTENSION
31 {
32 GREEN_DEVICE_TYPE Type;
33 } COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
34
35 /* For PassThroughFDO devices */
36 typedef struct _COMMON_FDO_DEVICE_EXTENSION
37 {
38 GREEN_DEVICE_TYPE Type;
39 PDEVICE_OBJECT LowerDevice;
40 } COMMON_FDO_DEVICE_EXTENSION, *PCOMMON_FDO_DEVICE_EXTENSION;
41
42 /* For KeyboardFDO devices */
43 typedef struct _KEYBOARD_DEVICE_EXTENSION
44 {
45 COMMON_FDO_DEVICE_EXTENSION Common;
46 PDEVICE_OBJECT Green;
47
48 CONNECT_DATA ClassInformation;
49 HANDLE WorkerThreadHandle;
50 KDPC KeyboardDpc;
51
52 ULONG ActiveQueue;
53 ULONG InputDataCount[2];
54 KEYBOARD_INPUT_DATA KeyboardInputData[2][KEYBOARD_BUFFER_SIZE];
55 } KEYBOARD_DEVICE_EXTENSION, *PKEYBOARD_DEVICE_EXTENSION;
56
57 /* For ScreenFDO devices */
58 typedef struct _SCREEN_DEVICE_EXTENSION
59 {
60 COMMON_FDO_DEVICE_EXTENSION Common;
61 PDEVICE_OBJECT Green;
62
63 PUCHAR VideoMemory; /* Pointer to video memory */
64 USHORT CharAttribute; /* Current color attribute */
65 ULONG Mode;
66 UCHAR ScanLines; /* Height of a text line */
67 UCHAR Rows; /* Number of rows */
68 UCHAR Columns; /* Number of columns */
69 UCHAR TabWidth;
70
71 ULONG LogicalOffset; /* Position of the cursor */
72
73 UCHAR SendBuffer[1024];
74 ULONG SendBufferPosition;
75 PDEVICE_OBJECT PreviousBlue;
76 } SCREEN_DEVICE_EXTENSION, *PSCREEN_DEVICE_EXTENSION;
77
78 /* For GreenFDO devices */
79 typedef struct _GREEN_DEVICE_EXTENSION
80 {
81 COMMON_FDO_DEVICE_EXTENSION Common;
82 PDEVICE_OBJECT Serial;
83
84 SERIAL_LINE_CONTROL LineControl;
85 SERIAL_TIMEOUTS Timeouts;
86
87 PDEVICE_OBJECT KeyboardPdo;
88 PDEVICE_OBJECT ScreenPdo;
89 PDEVICE_OBJECT KeyboardFdo;
90 PDEVICE_OBJECT ScreenFdo;
91 } GREEN_DEVICE_EXTENSION, *PGREEN_DEVICE_EXTENSION;
92
93 typedef struct _GREEN_DRIVER_EXTENSION
94 {
95 UNICODE_STRING RegistryPath;
96
97 UNICODE_STRING AttachedDeviceName;
98 ULONG DeviceReported;
99 ULONG SampleRate;
100
101 PDEVICE_OBJECT GreenMainDO;
102 PDEVICE_OBJECT LowerDevice;
103 } GREEN_DRIVER_EXTENSION, *PGREEN_DRIVER_EXTENSION;
104
105 /************************************ createclose.c */
106
107 NTSTATUS
108 GreenCreate(
109 IN PDEVICE_OBJECT DeviceObject,
110 IN PIRP Irp);
111
112 NTSTATUS
113 GreenClose(
114 IN PDEVICE_OBJECT DeviceObject,
115 IN PIRP Irp);
116
117 /************************************ dispatch.c */
118
119 NTSTATUS NTAPI
120 GreenDispatch(
121 IN PDEVICE_OBJECT DeviceObject,
122 IN PIRP Irp);
123
124 /************************************ keyboard.c */
125
126 NTSTATUS
127 KeyboardAddDevice(
128 IN PDRIVER_OBJECT DriverObject,
129 IN PDEVICE_OBJECT Pdo);
130
131 NTSTATUS
132 KeyboardInternalDeviceControl(
133 IN PDEVICE_OBJECT DeviceObject,
134 IN PIRP Irp);
135
136 /************************************ misc.c */
137
138 NTSTATUS
139 GreenDeviceIoControl(
140 IN PDEVICE_OBJECT DeviceObject,
141 IN ULONG CtlCode,
142 IN PVOID InputBuffer OPTIONAL,
143 IN ULONG InputBufferSize,
144 IN OUT PVOID OutputBuffer OPTIONAL,
145 IN OUT PULONG OutputBufferSize);
146
147 NTSTATUS
148 ReadRegistryEntries(
149 IN PUNICODE_STRING RegistryPath,
150 IN PGREEN_DRIVER_EXTENSION DriverExtension);
151
152 /************************************ pnp.c */
153
154 NTSTATUS NTAPI
155 GreenAddDevice(
156 IN PDRIVER_OBJECT DriverObject,
157 IN PDEVICE_OBJECT Pdo);
158
159 NTSTATUS
160 GreenPnp(
161 IN PDEVICE_OBJECT DeviceObject,
162 IN PIRP Irp);
163
164 /************************************ power.c */
165
166 NTSTATUS
167 GreenPower(
168 IN PDEVICE_OBJECT DeviceObject,
169 IN PIRP Irp);
170
171 /************************************ screen.c */
172
173 NTSTATUS
174 ScreenAddDevice(
175 IN PDRIVER_OBJECT DriverObject,
176 IN PDEVICE_OBJECT Pdo);
177
178 NTSTATUS
179 ScreenWrite(
180 IN PDEVICE_OBJECT DeviceObject,
181 IN PIRP Irp);
182
183 NTSTATUS
184 ScreenDeviceControl(
185 IN PDEVICE_OBJECT DeviceObject,
186 IN PIRP Irp);
187
188 /************************************ green.c */
189
190 NTSTATUS
191 GreenDuplicateUnicodeString(
192 IN ULONG Flags,
193 IN PCUNICODE_STRING SourceString,
194 OUT PUNICODE_STRING DestinationString);