37 (OutputBufferSize) ? *OutputBufferSize : 0,
43 WARN_(SERENUM,
"IoBuildDeviceIoControlRequest() failed\n");
51 INFO_(SERENUM,
"Operation pending\n");
58 *OutputBufferSize =
IoStatus.Information;
95 INFO_(SERENUM,
"Bytes received: %lu/%lu\n",
152 Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
159 ASSERT(PdoDeviceExtension);
216 DueTime.QuadPart = milliseconds * -10;
253 TRACE_(SERENUM,
"COM port initialization, check for device enumerate\n");
268 TRACE_(SERENUM,
"COM port setup, 1st phase\n");
271 &BaudRate,
sizeof(BaudRate),
NULL, 0);
292 TRACE_(SERENUM,
"Wait for response, 1st phase\n");
301 &Timeouts,
sizeof(Timeouts),
NULL,
NULL);
305 if (
Size != 0)
goto CollectPnpComDeviceId;
308 TRACE_(SERENUM,
"COM port setup, 2nd phase\n");
322 TRACE_(SERENUM,
"Wait for response, 2nd phase\n");
331 if (TotalBytesReceived != 0)
goto CollectPnpComDeviceId;
336 if ((Msr &
SERIAL_DSR_STATE) == 0)
goto VerifyDisconnect;
else goto ConnectIdle;
339CollectPnpComDeviceId:
340 TRACE_(SERENUM,
"Collect PnP COM device ID\n");
345 &Timeouts,
sizeof(Timeouts),
NULL,
NULL);
349 TotalBytesReceived +=
Size;
350 Size =
sizeof(PerfStats);
355 for (
i = 0;
i < TotalBytesReceived;
i++)
360 if (TotalBytesReceived == 1 || BufferContainsEndId)
369 if (!BufferContainsBeginId)
goto ConnectIdle;
370 if (!BufferContainsEndId)
goto ConnectIdle;
379 TRACE_(SERENUM,
"Verify disconnect\n");
391 TRACE_(SERENUM,
"Connect idle\n");
400 &BaudRate,
sizeof(BaudRate),
NULL,
NULL);
408 if (TotalBytesReceived == 0)
416 TRACE_(SERENUM,
"Disconnect idle\n");
426 &BaudRate,
sizeof(BaudRate),
NULL,
NULL);
463 TRACE_(SERENUM,
"SerenumDetectLegacyDevice(DeviceObject %p, LowerDevice %p)\n",
481 TRACE_(SERENUM,
"Reset UART\n");
488 TRACE_(SERENUM,
"Set communications parameters\n");
497 &BaudRate,
sizeof(BaudRate),
NULL,
NULL);
508 TRACE_(SERENUM,
"Flush receive buffer\n");
517 TRACE_(SERENUM,
"Enable DTR/RTS\n");
526 TRACE_(SERENUM,
"Set timeout to 500 microseconds\n");
532 &Timeouts,
sizeof(Timeouts),
NULL,
NULL);
536 TRACE_(SERENUM,
"Fill the read buffer\n");
#define NT_SUCCESS(StatCode)
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
static NTSTATUS ReportDetectedPnpDevice(IN PUCHAR Buffer, IN ULONG BufferLength)
NTSTATUS SerenumDetectPnpDevice(IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT LowerDevice)
NTSTATUS SerenumDetectLegacyDevice(IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT LowerDevice)
static BOOLEAN IsValidPnpIdString(IN PUCHAR Buffer, IN ULONG BufferLength)
NTSTATUS SerenumInitMultiSzString(OUT PUNICODE_STRING Destination,...)
ULONG ReportDetectedDevice
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
_Must_inspect_result_ _In_opt_ PVOID _In_opt_ PVOID InstanceId
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 RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
NTSTATUS DuplicateUnicodeString(IN ULONG Flags, IN PCUNICODE_STRING SourceString, OUT PUNICODE_STRING DestinationString)
#define OBJ_KERNEL_HANDLE
#define SERIAL_PURGE_RXCLEAR
#define SERIAL_PURGE_RXABORT
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
#define FILE_AUTOGENERATED_DEVICE_NAME
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define IOCTL_SERIAL_SET_LINE_CONTROL
#define IOCTL_SERIAL_SET_TIMEOUTS
#define IOCTL_SERIAL_SET_MODEM_CONTROL
#define IOCTL_SERIAL_SET_FIFO_CONTROL
#define IOCTL_SERIAL_GET_STATS
#define IOCTL_SERIAL_CLR_DTR
#define IOCTL_SERIAL_SET_BAUD_RATE
#define IOCTL_SERIAL_CLR_RTS
#define IOCTL_SERIAL_GET_MODEMSTATUS
#define IOCTL_SERIAL_SET_DTR
#define IOCTL_SERIAL_SET_RTS
#define IOCTL_SERIAL_PURGE
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)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
NTSTATUS NTAPI ObOpenObjectByPointer(IN PVOID Object, IN ULONG HandleAttributes, IN PACCESS_STATE PassedAccessState, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PHANDLE Handle)
#define FILE_DEVICE_CONTROLLER
PULONG MinorVersion OPTIONAL
PDEVICE_OBJECT AttachedPdo[2]
UNICODE_STRING InstanceId
UNICODE_STRING DeviceDescription
UNICODE_STRING HardwareIds
COMMON_DEVICE_EXTENSION Common
UNICODE_STRING CompatibleIds
PDEVICE_OBJECT AttachedFdo
ULONG WriteTotalTimeoutMultiplier
ULONG ReadTotalTimeoutConstant
ULONG WriteTotalTimeoutConstant
ULONG ReadTotalTimeoutMultiplier
ULONG ReadIntervalTimeout
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
#define RtlZeroMemory(Destination, Length)
#define STATUS_DEVICE_NOT_CONNECTED
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
_In_ WDFDPC _In_ BOOLEAN Wait
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
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
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
_In_ WDFTIMER _In_ LONGLONG DueTime
#define DO_BUS_ENUMERATED_DEVICE