28 WCHAR DeviceNameBuffer[32];
31 TRACE_(SERIAL,
"SerialAddDeviceInternal()\n");
48 WARN_(SERIAL,
"IoCreateDevice() failed with status 0x%08x\n",
Status);
59 WARN_(SERIAL,
"IoRegisterDeviceInterface() failed with status 0x%08x\n",
Status);
64 if (pComPortNumber ==
NULL)
67 DeviceExtension->
ComPort = *pComPortNumber;
68 DeviceExtension->
Pdo =
Pdo;
70 DeviceExtension->
UartType = UartType;
85 WARN_(SERIAL,
"IoAttachDeviceToDeviceStackSafe() failed with status 0x%08x\n",
Status);
99 Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
142 WCHAR DeviceNameBuffer[32];
144 WCHAR LinkNameBuffer[32];
146 WCHAR ComPortBuffer[32];
167 WARN_(SERIAL,
"No allocated resources sent to driver\n");
172 WARN_(SERIAL,
"Wrong number of allocated resources sent to driver\n");
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)
180 WARN_(SERIAL,
"Revision mismatch: %u.%u != 1.1 or %u.%u != 1.1\n",
183 ResourceListTranslated->List[0].PartialResourceList.Version,
184 ResourceListTranslated->List[0].PartialResourceList.Revision);
195 switch (PartialDescriptor->
Type)
198 if (PartialDescriptor->
u.
Port.Length < 7)
216 INFO_(SERIAL,
"New COM port. Base = 0x%lx, Irql = %u\n",
225 INFO_(SERIAL,
"Comparing addresses: KdComPortInUse: %p, ComPortBase: %p\n",
KdComPortInUse, ComPortBase);
228 INFO_(SERIAL,
"Failing IRP_MN_START_DEVICE as this serial port is used for debugging\n");
244 WARN_(SERIAL,
"SerialSetBaudRate() failed with status 0x%08x\n",
Status);
255 WARN_(SERIAL,
"SerialSetLineControl() failed with status 0x%08x\n",
Status);
269 swprintf(LinkNameBuffer,
L"\\DosDevices\\COM%lu", DeviceExtension->
ComPort);
277 WARN_(SERIAL,
"IoCreateSymbolicLink() failed with status 0x%08x\n",
Status);
290 WARN_(SERIAL,
"IoConnectInterrupt() failed with status 0x%08x\n",
Status);
369 TRACE_(SERIAL,
"IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
384 Stack->Parameters.StartDevice.AllocatedResources,
385 Stack->Parameters.StartDevice.AllocatedResourcesTranslated);
393 switch (
Stack->Parameters.QueryDeviceRelations.Type)
397 TRACE_(SERIAL,
"IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
402 TRACE_(SERIAL,
"IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n");
406 TRACE_(SERIAL,
"IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
407 Stack->Parameters.QueryDeviceRelations.Type);
414 TRACE_(SERIAL,
"IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define FILE_DEVICE_SECURE_OPEN
NTSTATUS InitializeCircularBuffer(IN PCIRCULAR_BUFFER pBuffer, IN ULONG BufferSize)
NTSTATUS FreeCircularBuffer(IN PCIRCULAR_BUFFER pBuffer)
#define NT_SUCCESS(StatCode)
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
UART_TYPE SerialDetectUartType(IN PUCHAR BaseAddress)
VOID NTAPI SerialReceiveByte(IN PKDPC Dpc, IN PVOID pDeviceExtension, IN PVOID Unused1, IN PVOID Unused2)
VOID NTAPI SerialSendByte(IN PKDPC Dpc, IN PVOID pDeviceExtension, IN PVOID Unused1, IN PVOID Unused2)
VOID NTAPI SerialCompleteIrp(IN PKDPC Dpc, IN PVOID pDeviceExtension, IN PVOID pIrp, IN PVOID Unused)
NTSTATUS NTAPI SerialPnpStartDevice(IN PDEVICE_OBJECT DeviceObject, IN PCM_RESOURCE_LIST ResourceList, IN PCM_RESOURCE_LIST ResourceListTranslated)
NTSTATUS NTAPI SerialAddDeviceInternal(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT Pdo, IN UART_TYPE UartType, IN PULONG pComPortNumber OPTIONAL, OUT PDEVICE_OBJECT *pFdo OPTIONAL)
#define SR_IER_LSR_CHANGE
DRIVER_DISPATCH SerialPnp
#define SR_FCR_CLEAR_RCVR
#define SR_FCR_CLEAR_XMIT
struct _SERIAL_DEVICE_EXTENSION * PSERIAL_DEVICE_EXTENSION
DRIVER_ADD_DEVICE SerialAddDevice
#define SR_IER_DATA_RECEIVED
KSERVICE_ROUTINE SerialInterruptService
#define SR_IER_MSR_CHANGE
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeInitializeSpinLock(sl)
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
#define CmResourceTypePort
#define CmResourceTypeInterrupt
DRIVER_DISPATCH ForwardIrpAndForget
#define OBJ_KERNEL_HANDLE
#define OBJ_CASE_INSENSITIVE
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Returns a pointer to the I/O manager's global configuration information structure.
#define FILE_DEVICE_SERIAL_PORT
#define InitializeObjectAttributes(p, n, a, r, s)
#define CM_RESOURCE_INTERRUPT_LATCHED
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define REG_OPTION_VOLATILE
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)
NTSTATUS NTAPI IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice, IN OUT PDEVICE_OBJECT *AttachedToDeviceObject)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
#define IoCompleteRequest
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
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)
NTSTATUS NTAPI IoCreateSymbolicLink(IN PUNICODE_STRING SymbolicLinkName, IN PUNICODE_STRING DeviceName)
NTSTATUS NTAPI IoDeleteSymbolicLink(IN PUNICODE_STRING SymbolicLinkName)
#define STATUS_REVISION_MISMATCH
#define READ_PORT_UCHAR(p)
#define WRITE_PORT_UCHAR(p, d)
enum _KINTERRUPT_MODE KINTERRUPT_MODE
NTSTATUS NTAPI SerialSetBaudRate(IN PSERIAL_DEVICE_EXTENSION DeviceExtension, IN ULONG NewBaudRate)
NTSTATUS NTAPI SerialSetLineControl(IN PSERIAL_DEVICE_EXTENSION DeviceExtension, IN PSERIAL_LINE_CONTROL NewSettings)
PULONG MinorVersion OPTIONAL
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@391::@393 Port
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@391 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@391::@394 Interrupt
SERIAL_LINE_CONTROL SerialLineControl
PDEVICE_OBJECT LowerDevice
KSPIN_LOCK OutputBufferLock
KSPIN_LOCK InputBufferLock
IO_REMOVE_LOCK RemoveLock
KEVENT InputBufferNotEmpty
UNICODE_STRING SerialInterfaceName
CIRCULAR_BUFFER InputBuffer
SERIAL_DEVICE_STATE PnpState
CIRCULAR_BUFFER OutputBuffer
#define RtlZeroMemory(Destination, Length)
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
_In_ UCHAR _In_ UCHAR MinorFunction
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
_Must_inspect_result_ _In_ WDFDEVICE Fdo
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT Pdo
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE InterruptMode
#define IoInitializeRemoveLock(Lock, AllocateTag, MaxLockedMinutes, HighWatermark)
#define IRP_MN_START_DEVICE
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_DEVICE_RELATIONS