ReactOS 0.4.17-dev-1190-g4c812f4
pnp.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: Serial port driver
4 * FILE: drivers/dd/serial/pnp.c
5 * PURPOSE: Serial IRP_MJ_PNP operations
6 *
7 * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
8 */
9/* FIXME: call IoAcquireRemoveLock/IoReleaseRemoveLock around each I/O operation */
10
11#include "serial.h"
12
13#include <stdio.h>
14#include <ndk/haltypes.h>
15#include <debug.h>
16
21 IN UART_TYPE UartType,
22 IN PULONG pComPortNumber OPTIONAL,
24{
26 PSERIAL_DEVICE_EXTENSION DeviceExtension = NULL;
28 WCHAR DeviceNameBuffer[32];
30
31 TRACE_(SERIAL, "SerialAddDeviceInternal()\n");
32
34 ASSERT(Pdo);
35
36 /* Create new device object */
37 _swprintf(DeviceNameBuffer, L"\\Device\\Serial%lu", IoGetConfigurationInformation()->SerialCount);
38 RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);
44 FALSE,
45 &Fdo);
46 if (!NT_SUCCESS(Status))
47 {
48 WARN_(SERIAL, "IoCreateDevice() failed with status 0x%08x\n", Status);
49 Fdo = NULL;
50 goto ByeBye;
51 }
52 DeviceExtension = (PSERIAL_DEVICE_EXTENSION)Fdo->DeviceExtension;
53 RtlZeroMemory(DeviceExtension, sizeof(SERIAL_DEVICE_EXTENSION));
54
55 /* Register device interface */
56 Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_COMPORT, NULL, &DeviceExtension->SerialInterfaceName);
57 if (!NT_SUCCESS(Status))
58 {
59 WARN_(SERIAL, "IoRegisterDeviceInterface() failed with status 0x%08x\n", Status);
60 goto ByeBye;
61 }
62
64 if (pComPortNumber == NULL)
65 DeviceExtension->ComPort = DeviceExtension->SerialPortNumber + 1;
66 else
67 DeviceExtension->ComPort = *pComPortNumber;
68 DeviceExtension->Pdo = Pdo;
69 DeviceExtension->PnpState = dsStopped;
70 DeviceExtension->UartType = UartType;
71 Status = InitializeCircularBuffer(&DeviceExtension->InputBuffer, 16);
72 if (!NT_SUCCESS(Status)) goto ByeBye;
73 Status = InitializeCircularBuffer(&DeviceExtension->OutputBuffer, 16);
74 if (!NT_SUCCESS(Status)) goto ByeBye;
75 IoInitializeRemoveLock(&DeviceExtension->RemoveLock, SERIAL_TAG, 0, 0);
76 KeInitializeSpinLock(&DeviceExtension->InputBufferLock);
77 KeInitializeSpinLock(&DeviceExtension->OutputBufferLock);
79 KeInitializeDpc(&DeviceExtension->ReceivedByteDpc, SerialReceiveByte, DeviceExtension);
80 KeInitializeDpc(&DeviceExtension->SendByteDpc, SerialSendByte, DeviceExtension);
81 KeInitializeDpc(&DeviceExtension->CompleteIrpDpc, SerialCompleteIrp, DeviceExtension);
83 if (!NT_SUCCESS(Status))
84 {
85 WARN_(SERIAL, "IoAttachDeviceToDeviceStackSafe() failed with status 0x%08x\n", Status);
86 goto ByeBye;
87 }
88 if (DeviceExtension->LowerDevice->Flags & DO_POWER_PAGABLE)
89 Fdo->Flags |= DO_POWER_PAGABLE;
90 if (DeviceExtension->LowerDevice->Flags & DO_BUFFERED_IO)
91 Fdo->Flags |= DO_BUFFERED_IO;
92 if (DeviceExtension->LowerDevice->Flags & DO_DIRECT_IO)
93 Fdo->Flags |= DO_DIRECT_IO;
94
95 /* Choose default strategy */
96 if ((Fdo->Flags & (DO_BUFFERED_IO | DO_DIRECT_IO)) == 0)
97 Fdo->Flags |= DO_BUFFERED_IO;
98
99 Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
100 if (pFdo)
101 {
102 *pFdo = Fdo;
103 }
104
105 return STATUS_SUCCESS;
106
107ByeBye:
108 if (Fdo)
109 {
110 FreeCircularBuffer(&DeviceExtension->InputBuffer);
111 FreeCircularBuffer(&DeviceExtension->OutputBuffer);
113 }
114 return Status;
115}
116
121{
122 /* Serial.sys is a legacy driver. AddDevice is called once
123 * with a NULL Pdo just after the driver initialization.
124 * Detect this case and return success.
125 */
126 if (Pdo == NULL)
127 return STATUS_SUCCESS;
128
129 /* We have here a PDO not null. It represents a real serial
130 * port. So call the internal AddDevice function.
131 */
133}
134
139 IN PCM_RESOURCE_LIST ResourceListTranslated)
140{
141 PSERIAL_DEVICE_EXTENSION DeviceExtension;
142 WCHAR DeviceNameBuffer[32];
144 WCHAR LinkNameBuffer[32];
145 UNICODE_STRING LinkName;
146 WCHAR ComPortBuffer[32];
147 UNICODE_STRING ComPort;
148 ULONG Vector = 0;
149 ULONG i;
150 UCHAR IER;
151 KIRQL Dirql;
154 BOOLEAN ShareInterrupt = TRUE;
155 OBJECT_ATTRIBUTES objectAttributes;
156 PUCHAR ComPortBase;
158 HANDLE hKey;
160
161 DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
162
163 ASSERT(DeviceExtension);
164
165 if (!ResourceList)
166 {
167 WARN_(SERIAL, "No allocated resources sent to driver\n");
169 }
170 if (ResourceList->Count != 1)
171 {
172 WARN_(SERIAL, "Wrong number of allocated resources sent to driver\n");
174 }
175 if (ResourceList->List[0].PartialResourceList.Version != 1
176 || ResourceList->List[0].PartialResourceList.Revision != 1
177 || ResourceListTranslated->List[0].PartialResourceList.Version != 1
178 || ResourceListTranslated->List[0].PartialResourceList.Revision != 1)
179 {
180 WARN_(SERIAL, "Revision mismatch: %u.%u != 1.1 or %u.%u != 1.1\n",
181 ResourceList->List[0].PartialResourceList.Version,
182 ResourceList->List[0].PartialResourceList.Revision,
183 ResourceListTranslated->List[0].PartialResourceList.Version,
184 ResourceListTranslated->List[0].PartialResourceList.Revision);
186 }
187
188 DeviceExtension->BaudRate = 19200;
189 DeviceExtension->BaseAddress = 0;
190 Dirql = 0;
191 for (i = 0; i < ResourceList->List[0].PartialResourceList.Count; i++)
192 {
193 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[i];
194 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptorTranslated = &ResourceListTranslated->List[0].PartialResourceList.PartialDescriptors[i];
195 switch (PartialDescriptor->Type)
196 {
198 if (PartialDescriptor->u.Port.Length < 7)
200 if (DeviceExtension->BaseAddress != 0)
201 return STATUS_UNSUCCESSFUL;
202 DeviceExtension->BaseAddress = PartialDescriptor->u.Port.Start.u.LowPart;
203 break;
205 Dirql = (KIRQL)PartialDescriptorTranslated->u.Interrupt.Level;
206 Vector = PartialDescriptorTranslated->u.Interrupt.Vector;
207 Affinity = PartialDescriptorTranslated->u.Interrupt.Affinity;
208 if (PartialDescriptorTranslated->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
210 else
212 ShareInterrupt = (PartialDescriptorTranslated->ShareDisposition == CmResourceShareShared);
213 break;
214 }
215 }
216 INFO_(SERIAL, "New COM port. Base = 0x%lx, Irql = %u\n",
217 DeviceExtension->BaseAddress, Dirql);
218 if (!DeviceExtension->BaseAddress)
220 if (!Dirql)
222 ComPortBase = ULongToPtr(DeviceExtension->BaseAddress);
223
224 /* Test if we are trying to start the serial port used for debugging */
225 INFO_(SERIAL, "Comparing addresses: KdComPortInUse: %p, ComPortBase: %p\n", KdComPortInUse, ComPortBase);
226 if (KdComPortInUse == ComPortBase)
227 {
228 INFO_(SERIAL, "Failing IRP_MN_START_DEVICE as this serial port is used for debugging\n");
230 }
231
232 if (DeviceExtension->UartType == UartUnknown)
233 DeviceExtension->UartType = SerialDetectUartType(ComPortBase);
234
235 /* Get current settings */
236 DeviceExtension->MCR = READ_PORT_UCHAR(SER_MCR(ComPortBase));
237 DeviceExtension->MSR = READ_PORT_UCHAR(SER_MSR(ComPortBase));
238 DeviceExtension->WaitMask = 0;
239
240 /* Set baud rate */
241 Status = SerialSetBaudRate(DeviceExtension, DeviceExtension->BaudRate);
242 if (!NT_SUCCESS(Status))
243 {
244 WARN_(SERIAL, "SerialSetBaudRate() failed with status 0x%08x\n", Status);
245 return Status;
246 }
247
248 /* Set line control */
249 DeviceExtension->SerialLineControl.StopBits = STOP_BIT_1;
250 DeviceExtension->SerialLineControl.Parity = NO_PARITY;
251 DeviceExtension->SerialLineControl.WordLength = 8;
252 Status = SerialSetLineControl(DeviceExtension, &DeviceExtension->SerialLineControl);
253 if (!NT_SUCCESS(Status))
254 {
255 WARN_(SERIAL, "SerialSetLineControl() failed with status 0x%08x\n", Status);
256 return Status;
257 }
258
259 /* Clear receive/transmit buffers */
260 if (DeviceExtension->UartType >= Uart16550A)
261 {
262 /* 16550 UARTs also have FIFO queues, but they are unusable due to a bug */
263 WRITE_PORT_UCHAR(SER_FCR(ComPortBase),
265 }
266
267 /* Create link \DosDevices\COMX -> \Device\SerialX */
268 _swprintf(DeviceNameBuffer, L"\\Device\\Serial%lu", DeviceExtension->SerialPortNumber);
269 _swprintf(LinkNameBuffer, L"\\DosDevices\\COM%lu", DeviceExtension->ComPort);
270 _swprintf(ComPortBuffer, L"COM%lu", DeviceExtension->ComPort);
271 RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);
272 RtlInitUnicodeString(&LinkName, LinkNameBuffer);
273 RtlInitUnicodeString(&ComPort, ComPortBuffer);
275 if (!NT_SUCCESS(Status))
276 {
277 WARN_(SERIAL, "IoCreateSymbolicLink() failed with status 0x%08x\n", Status);
278 return Status;
279 }
280
281 /* Connect interrupt and enable them */
283 &DeviceExtension->Interrupt, SerialInterruptService,
285 Vector, Dirql, Dirql,
286 InterruptMode, ShareInterrupt,
287 Affinity, FALSE);
288 if (!NT_SUCCESS(Status))
289 {
290 WARN_(SERIAL, "IoConnectInterrupt() failed with status 0x%08x\n", Status);
292 IoDeleteSymbolicLink(&LinkName);
293 return Status;
294 }
295
296 /* Write an entry value under HKLM\HARDWARE\DeviceMap\SERIALCOMM */
297 /* This step is not mandatory, so don't exit in case of error */
298 RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\HARDWARE\\DeviceMap\\SERIALCOMM");
300 Status = ZwCreateKey(&hKey, KEY_SET_VALUE, &objectAttributes, 0, NULL, REG_OPTION_VOLATILE, NULL);
301 if (NT_SUCCESS(Status))
302 {
303 /* Key = \Device\Serialx, Value = COMx */
304 ZwSetValueKey(hKey, &DeviceName, 0, REG_SZ, ComPortBuffer, ComPort.Length + sizeof(WCHAR));
305 ZwClose(hKey);
306 }
307
308 DeviceExtension->PnpState = dsStarted;
309
310 /* Activate interrupt modes */
311 IER = READ_PORT_UCHAR(SER_IER(ComPortBase));
313 WRITE_PORT_UCHAR(SER_IER(ComPortBase), IER);
314
315 /* Activate DTR, RTS */
316 DeviceExtension->MCR |= SR_MCR_DTR | SR_MCR_RTS;
317 WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
318
319 /* Activate serial interface */
321 /* We don't really care if the call succeeded or not... */
322
323 return STATUS_SUCCESS;
324}
325
329 IN PIRP Irp)
330{
331 PSERIAL_DEVICE_EXTENSION DeviceExtension;
336
338 MinorFunction = Stack->MinorFunction;
339
340 switch (MinorFunction)
341 {
342 /* FIXME: do all these minor functions
343 IRP_MN_QUERY_REMOVE_DEVICE 0x1
344 IRP_MN_REMOVE_DEVICE 0x2
345 {
346 TRACE_(SERIAL, "IRP_MJ_PNP / IRP_MN_REMOVE_DEVICE\n");
347 IoAcquireRemoveLock
348 IoReleaseRemoveLockAndWait
349 pass request to DeviceExtension-LowerDriver
350 disable interface
351 IoDeleteDevice(Fdo) and/or IoDetachDevice
352 break;
353 }
354 IRP_MN_CANCEL_REMOVE_DEVICE 0x3
355 IRP_MN_STOP_DEVICE 0x4
356 IRP_MN_QUERY_STOP_DEVICE 0x5
357 IRP_MN_CANCEL_STOP_DEVICE 0x6
358 IRP_MN_FILTER_RESOURCE_REQUIREMENTS (optional) 0xd
359 IRP_MN_QUERY_PNP_DEVICE_STATE (optional) 0x14
360 IRP_MN_DEVICE_USAGE_NOTIFICATION (required or optional) 0x16
361 */
362 case IRP_MN_START_DEVICE: /* 0x0 */
363 {
364 TRACE_(SERIAL, "IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
365
366 /* Call lower driver */
367 DeviceExtension = DeviceObject->DeviceExtension;
369
370 ASSERT(DeviceExtension->PnpState == dsStopped);
371
372 if (IoForwardIrpSynchronously(DeviceExtension->LowerDevice, Irp))
373 {
374 Status = Irp->IoStatus.Status;
375 if (NT_SUCCESS(Status))
376 {
379 Stack->Parameters.StartDevice.AllocatedResources,
380 Stack->Parameters.StartDevice.AllocatedResourcesTranslated);
381 }
382 }
383
384 break;
385 }
386 case IRP_MN_QUERY_DEVICE_RELATIONS: /* (optional) 0x7 */
387 {
388 switch (Stack->Parameters.QueryDeviceRelations.Type)
389 {
390 case BusRelations:
391 {
392 PDEVICE_RELATIONS DeviceRelations;
393
394 TRACE_(SERIAL, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
395
396 DeviceRelations = ExAllocatePoolWithTag(PagedPool,
398 SERIAL_TAG);
399
400 if (!DeviceRelations)
401 {
403 break;
404 }
405
406 DeviceRelations->Count = 0;
407 Information = (ULONG_PTR)DeviceRelations;
409 break;
410 }
411 case RemovalRelations:
412 {
413 PDEVICE_RELATIONS DeviceRelations;
414
415 TRACE_(SERIAL, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n");
416
417 DeviceRelations = ExAllocatePoolWithTag(PagedPool,
419 SERIAL_TAG);
420
421 if (!DeviceRelations)
422 {
424 break;
425 }
426
427 DeviceRelations->Count = 0;
428 Information = (ULONG_PTR)DeviceRelations;
430 break;
431 }
432 default:
433 TRACE_(SERIAL, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
434 Stack->Parameters.QueryDeviceRelations.Type);
436 }
437 break;
438 }
439 case IRP_MN_QUERY_INTERFACE: /* (optional) 0x8 */
440 {
441 TRACE_(SERIAL, "IRP_MJ_PNP / IRP_MN_QUERY_INTERFACE\n");
443 }
444 case IRP_MN_QUERY_CAPABILITIES: /* (optional) 0x9 */
445 {
446 TRACE_(SERIAL, "IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n");
447
448 DeviceExtension = DeviceObject->DeviceExtension;
449
450 if (IoForwardIrpSynchronously(DeviceExtension->LowerDevice, Irp))
451 {
452 Status = Irp->IoStatus.Status;
453 }
454 else
455 {
457 }
458
459 break;
460 }
461 case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* (optional) 0xd */
462 {
463 TRACE_(SERIAL, "IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
465 }
466 case IRP_MN_SURPRISE_REMOVAL: /* 0x17 */
467 {
468 WCHAR LinkNameBuffer[32];
469 WCHAR DeviceNameBuffer[32];
470 UNICODE_STRING LinkName;
474 HANDLE hKey;
475
476 TRACE_(SERIAL, "IRP_MJ_PNP / IRP_MN_SURPRISE_REMOVAL\n");
477
478 DeviceExtension = DeviceObject->DeviceExtension;
479 DeviceExtension->PnpState = dsSurpriseRemoved;
480
482
483 if (DeviceExtension->Interrupt)
484 {
485 IoDisconnectInterrupt(DeviceExtension->Interrupt);
486 DeviceExtension->Interrupt = NULL;
487 }
488
489 _swprintf(LinkNameBuffer, L"\\DosDevices\\COM%lu", DeviceExtension->ComPort);
490 RtlInitUnicodeString(&LinkName, LinkNameBuffer);
491 IoDeleteSymbolicLink(&LinkName);
492
493 _swprintf(DeviceNameBuffer, L"\\Device\\Serial%lu", DeviceExtension->SerialPortNumber);
494 RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);
495 RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\HARDWARE\\DeviceMap\\SERIALCOMM");
497
498 if (NT_SUCCESS(ZwOpenKey(&hKey, KEY_SET_VALUE, &ObjectAttributes)))
499 {
501 ZwClose(hKey);
502 }
503
505 }
506 default:
507 {
508 TRACE_(SERIAL, "Unknown minor function 0x%x\n", MinorFunction);
510 }
511 }
512
513 Irp->IoStatus.Information = Information;
514 Irp->IoStatus.Status = Status;
516 return Status;
517}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
unsigned char BOOLEAN
Definition: actypes.h:127
#define REG_SZ
Definition: layer.c:22
LONG NTSTATUS
Definition: precomp.h:26
#define ULongToPtr(ul)
Definition: basetsd.h:86
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
NTSTATUS InitializeCircularBuffer(IN PCIRCULAR_BUFFER pBuffer, IN ULONG BufferSize)
NTSTATUS FreeCircularBuffer(IN PCIRCULAR_BUFFER pBuffer)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
ULONG_PTR KAFFINITY
Definition: compat.h:85
#define TRACE_(x)
Definition: compat.h:76
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:712
#define L(x)
Definition: resources.c:13
@ dsSurpriseRemoved
Definition: pci.h:39
UART_TYPE SerialDetectUartType(IN PUCHAR BaseAddress)
Definition: legacy.c:16
VOID NTAPI SerialReceiveByte(IN PKDPC Dpc, IN PVOID pDeviceExtension, IN PVOID Unused1, IN PVOID Unused2)
Definition: misc.c:30
VOID NTAPI SerialSendByte(IN PKDPC Dpc, IN PVOID pDeviceExtension, IN PVOID Unused1, IN PVOID Unused2)
Definition: misc.c:67
VOID NTAPI SerialCompleteIrp(IN PKDPC Dpc, IN PVOID pDeviceExtension, IN PVOID pIrp, IN PVOID Unused)
Definition: misc.c:105
NTSTATUS NTAPI SerialPnpStartDevice(IN PDEVICE_OBJECT DeviceObject, IN PCM_RESOURCE_LIST ResourceList, IN PCM_RESOURCE_LIST ResourceListTranslated)
Definition: pnp.c:136
NTSTATUS NTAPI SerialAddDeviceInternal(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT Pdo, IN UART_TYPE UartType, IN PULONG pComPortNumber OPTIONAL, OUT PDEVICE_OBJECT *pFdo OPTIONAL)
Definition: pnp.c:18
UART_TYPE
Definition: serial.h:30
@ Uart16550A
Definition: serial.h:35
@ UartUnknown
Definition: serial.h:31
#define SER_MSR(x)
Definition: serial.h:161
#define SR_MCR_DTR
Definition: serial.h:150
#define SR_IER_LSR_CHANGE
Definition: serial.h:115
DRIVER_DISPATCH SerialPnp
Definition: serial.h:288
#define SR_IER_THR_EMPTY
Definition: serial.h:114
#define SR_FCR_CLEAR_RCVR
Definition: serial.h:129
#define SR_FCR_CLEAR_XMIT
Definition: serial.h:130
struct _SERIAL_DEVICE_EXTENSION * PSERIAL_DEVICE_EXTENSION
#define SERIAL_TAG
Definition: serial.h:100
DRIVER_ADD_DEVICE SerialAddDevice
Definition: serial.h:280
#define SER_FCR(x)
Definition: serial.h:127
#define SER_IER(x)
Definition: serial.h:112
#define SR_MCR_RTS
Definition: serial.h:151
#define SER_MCR(x)
Definition: serial.h:149
#define SR_IER_DATA_RECEIVED
Definition: serial.h:113
KSERVICE_ROUTINE SerialInterruptService
Definition: serial.h:268
#define SR_IER_MSR_CHANGE
Definition: serial.h:116
#define ULONG_PTR
Definition: config.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
#define PagedPool
Definition: env_spec_w32.h:308
FxDevice * pFdo
FxAutoRegKey hKey
NTSYSAPI NTSTATUS NTAPI ZwDeleteValueKey(__in IN HANDLE Key, __in IN PUNICODE_STRING ValueName)
Status
Definition: gdiplustypes.h:24
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PUCHAR KdComPortInUse
Definition: usage.c:17
_In_ UCXUSBDEVICE _In_ PDEVICE_OBJECT Pdo
Definition: hubucx.h:280
DRIVER_DISPATCH ForwardIrpAndForget
Definition: i8042prt.h:341
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Returns a pointer to the I/O manager's global configuration information structure.
Definition: iorsrce.c:998
@ dsStopped
Definition: isapnp.h:30
@ dsStarted
Definition: isapnp.h:31
_In_ PIRP Irp
Definition: kse.h:79
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
#define FILE_DEVICE_SERIAL_PORT
Definition: serial.c:44
#define NO_PARITY
Definition: serial.c:89
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:115
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1063
#define KEY_SET_VALUE
Definition: nt_native.h:1020
#define STOP_BIT_1
Definition: ntddser.h:215
@ NotificationEvent
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1038
NTSTATUS NTAPI IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice, IN OUT PDEVICE_OBJECT *AttachedToDeviceObject)
Definition: device.c:987
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1261
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
Definition: deviface.c:1451
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
Definition: deviface.c:1807
#define IoCompleteRequest
Definition: irp.c:1272
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1657
VOID NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject)
Definition: irq.c:142
NTSTATUS NTAPI IoConnectInterrupt(OUT PKINTERRUPT *InterruptObject, IN PKSERVICE_ROUTINE ServiceRoutine, IN PVOID ServiceContext, IN PKSPIN_LOCK SpinLock, IN ULONG Vector, IN KIRQL Irql, IN KIRQL SynchronizeIrql, IN KINTERRUPT_MODE InterruptMode, IN BOOLEAN ShareVector, IN KAFFINITY ProcessorEnableMask, IN BOOLEAN FloatingSave)
Definition: irq.c:23
#define STATUS_REVISION_MISMATCH
Definition: ntstatus.h:419
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
short WCHAR
Definition: pedump.c:58
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define CmResourceTypePort
Definition: restypes.h:104
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: restypes.h:117
#define CmResourceTypeInterrupt
Definition: restypes.h:105
@ Latched
Definition: miniport.h:81
@ LevelSensitive
Definition: miniport.h:80
enum _KINTERRUPT_MODE KINTERRUPT_MODE
#define INFO_(ch,...)
Definition: debug.h:159
#define WARN_(ch,...)
Definition: debug.h:157
NTSTATUS NTAPI SerialSetBaudRate(IN PSERIAL_DEVICE_EXTENSION DeviceExtension, IN ULONG NewBaudRate)
Definition: devctrl.c:50
NTSTATUS NTAPI SerialSetLineControl(IN PSERIAL_DEVICE_EXTENSION DeviceExtension, IN PSERIAL_LINE_CONTROL NewSettings)
Definition: devctrl.c:88
#define STATUS_SUCCESS
Definition: shellext.h:65
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494::@496 Port
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494::@497 Interrupt
SERIAL_LINE_CONTROL SerialLineControl
Definition: serial.h:65
PKINTERRUPT Interrupt
Definition: serial.h:60
PDEVICE_OBJECT LowerDevice
Definition: serial.h:51
KSPIN_LOCK OutputBufferLock
Definition: serial.h:78
UART_TYPE UartType
Definition: serial.h:66
KSPIN_LOCK InputBufferLock
Definition: serial.h:76
IO_REMOVE_LOCK RemoveLock
Definition: serial.h:53
KEVENT InputBufferNotEmpty
Definition: serial.h:74
UNICODE_STRING SerialInterfaceName
Definition: serial.h:80
CIRCULAR_BUFFER InputBuffer
Definition: serial.h:75
SERIAL_DEVICE_STATE PnpState
Definition: serial.h:52
CIRCULAR_BUFFER OutputBuffer
Definition: serial.h:77
PDEVICE_OBJECT Pdo
Definition: serial.h:50
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: typedefs.h:53
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NTAPI
Definition: typedefs.h:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2705
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3281
_In_ UCHAR _In_ UCHAR MinorFunction
Definition: wdfdevice.h:1705
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ WDFDEVICE Fdo
Definition: wdffdo.h:461
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309
@ CmResourceShareShared
Definition: cmtypes.h:243
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:174
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE InterruptMode
Definition: iofuncs.h:806
#define IoInitializeRemoveLock(Lock, AllocateTag, MaxLockedMinutes, HighWatermark)
Definition: iofuncs.h:2840
@ RemovalRelations
Definition: iotypes.h:2157
@ BusRelations
Definition: iotypes.h:2154
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_START_DEVICE
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define DO_POWER_PAGABLE
#define IRP_MN_QUERY_CAPABILITIES