No need to write "Serenum:" at the start of each debug string

svn path=/trunk/; revision=21659
This commit is contained in:
Hervé Poussineau 2006-04-18 19:26:48 +00:00
parent 57c69510f1
commit ffd89368ef
4 changed files with 117 additions and 112 deletions

View file

@ -13,7 +13,7 @@
#include "serenum.h" #include "serenum.h"
static NTSTATUS static NTSTATUS
SerenumDeviceIoControl( DeviceIoControl(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN ULONG CtlCode, IN ULONG CtlCode,
IN PVOID InputBuffer OPTIONAL, IN PVOID InputBuffer OPTIONAL,
@ -39,7 +39,7 @@ SerenumDeviceIoControl(
&IoStatus); &IoStatus);
if (Irp == NULL) if (Irp == NULL)
{ {
DPRINT("Serenum: IoBuildDeviceIoControlRequest() failed\n"); DPRINT("IoBuildDeviceIoControlRequest() failed\n");
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
} }
@ -47,7 +47,7 @@ SerenumDeviceIoControl(
if (Status == STATUS_PENDING) if (Status == STATUS_PENDING)
{ {
DPRINT("Serenum: Operation pending\n"); DPRINT("Operation pending\n");
KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL); KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
Status = IoStatus.Status; Status = IoStatus.Status;
} }
@ -61,7 +61,7 @@ SerenumDeviceIoControl(
} }
static NTSTATUS static NTSTATUS
SerenumSendIrp( SendIrp(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN ULONG MajorFunction) IN ULONG MajorFunction)
{ {
@ -71,7 +71,7 @@ SerenumSendIrp(
NTSTATUS Status; NTSTATUS Status;
KeInitializeEvent(&Event, NotificationEvent, FALSE); KeInitializeEvent(&Event, NotificationEvent, FALSE);
Irp = IoBuildSynchronousFsdRequest( Irp = IoBuildSynchronousFsdRequest(
MajorFunction, MajorFunction,
DeviceObject, DeviceObject,
@ -82,15 +82,15 @@ SerenumSendIrp(
&IoStatus); &IoStatus);
if (Irp == NULL) if (Irp == NULL)
{ {
DPRINT("Serenum: IoBuildSynchronousFsdRequest() failed\n"); DPRINT("IoBuildSynchronousFsdRequest() failed\n");
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
} }
Status = IoCallDriver(DeviceObject, Irp); Status = IoCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING) if (Status == STATUS_PENDING)
{ {
DPRINT("Serenum: Operation pending\n"); DPRINT("Operation pending\n");
KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL); KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
Status = IoStatus.Status; Status = IoStatus.Status;
} }
@ -129,7 +129,7 @@ ReadBytes(
KeWaitForSingleObject(&event, Suspended, KernelMode, FALSE, NULL); KeWaitForSingleObject(&event, Suspended, KernelMode, FALSE, NULL);
Status = ioStatus.Status; Status = ioStatus.Status;
} }
DPRINT("Serenum: bytes received: %lu/%lu\n", DPRINT("Bytes received: %lu/%lu\n",
ioStatus.Information, BufferSize); ioStatus.Information, BufferSize);
*FilledBytes = ioStatus.Information; *FilledBytes = ioStatus.Information;
return Status; return Status;
@ -149,7 +149,7 @@ ReportDetectedDevice(
PFDO_DEVICE_EXTENSION FdoDeviceExtension; PFDO_DEVICE_EXTENSION FdoDeviceExtension;
NTSTATUS Status; NTSTATUS Status;
DPRINT("Serenum: ReportDetectedDevice() called with %wZ (%wZ) detected\n", DeviceId, DeviceDescription); DPRINT("ReportDetectedDevice() called with %wZ (%wZ) detected\n", DeviceId, DeviceDescription);
Status = IoCreateDevice( Status = IoCreateDevice(
DeviceObject->DriverObject, DeviceObject->DriverObject,
@ -210,12 +210,12 @@ ByeBye:
} }
static BOOLEAN static BOOLEAN
SerenumIsValidPnpIdString( IsValidPnpIdString(
IN PUCHAR Buffer, IN PUCHAR Buffer,
IN ULONG BufferLength) IN ULONG BufferLength)
{ {
/* FIXME: SerenumIsValidPnpIdString not implemented */ /* FIXME: IsValidPnpIdString not implemented */
DPRINT1("Serenum: SerenumIsValidPnpIdString() unimplemented\n"); DPRINT1("IsValidPnpIdString() unimplemented\n");
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -226,7 +226,7 @@ ReportDetectedPnpDevice(
{ {
ULONG i; ULONG i;
/* FIXME: ReportDetectedPnpDevice not implemented */ /* FIXME: ReportDetectedPnpDevice not implemented */
DPRINT1("Serenum: ReportDetectedPnpDevice() unimplemented\n"); DPRINT1("ReportDetectedPnpDevice() unimplemented\n");
DPRINT1(""); DPRINT1("");
for (i = 0; i < BufferLength; i++) for (i = 0; i < BufferLength; i++)
DbgPrint("%c", Buffer[i]); DbgPrint("%c", Buffer[i]);
@ -239,7 +239,8 @@ ReportDetectedPnpDevice(
#define END_ID ')' #define END_ID ')'
static NTSTATUS static NTSTATUS
SerenumWait(ULONG milliseconds) Wait(
IN ULONG milliseconds)
{ {
KTIMER Timer; KTIMER Timer;
LARGE_INTEGER DueTime; LARGE_INTEGER DueTime;
@ -267,114 +268,114 @@ SerenumDetectPnpDevice(
SERIAL_TIMEOUTS Timeouts; SERIAL_TIMEOUTS Timeouts;
SERIALPERF_STATS PerfStats; SERIALPERF_STATS PerfStats;
NTSTATUS Status; NTSTATUS Status;
/* Open port */ /* Open port */
Status = SerenumSendIrp(LowerDevice, IRP_MJ_CREATE); Status = SendIrp(LowerDevice, IRP_MJ_CREATE);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
/* 1. COM port initialization, check for device enumerate */ /* 1. COM port initialization, check for device enumerate */
CHECKPOINT; CHECKPOINT;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
SerenumWait(200); Wait(200);
Size = sizeof(Msr); Size = sizeof(Msr);
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
NULL, 0, &Msr, &Size); NULL, 0, &Msr, &Size);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
if ((Msr & SERIAL_DSR_STATE) == 0) goto SerenumDisconnectIdle; if ((Msr & SERIAL_DSR_STATE) == 0) goto DisconnectIdle;
/* 2. COM port setup, 1st phase */ /* 2. COM port setup, 1st phase */
CHECKPOINT; CHECKPOINT;
BaudRate = 1200; BaudRate = 1200;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
&BaudRate, sizeof(BaudRate), NULL, 0); &BaudRate, sizeof(BaudRate), NULL, 0);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Lcr.WordLength = 7; Lcr.WordLength = 7;
Lcr.Parity = NO_PARITY; Lcr.Parity = NO_PARITY;
Lcr.StopBits = STOP_BIT_1; Lcr.StopBits = STOP_BIT_1;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
&Lcr, sizeof(Lcr), NULL, NULL); &Lcr, sizeof(Lcr), NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
SerenumWait(200); Wait(200);
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
SerenumWait(200); Wait(200);
/* 3. Wait for response, 1st phase */ /* 3. Wait for response, 1st phase */
CHECKPOINT; CHECKPOINT;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Timeouts.ReadIntervalTimeout = 0; Timeouts.ReadIntervalTimeout = 0;
Timeouts.ReadTotalTimeoutMultiplier = 0; Timeouts.ReadTotalTimeoutMultiplier = 0;
Timeouts.ReadTotalTimeoutConstant = 200; Timeouts.ReadTotalTimeoutConstant = 200;
Timeouts.WriteTotalTimeoutMultiplier = Timeouts.WriteTotalTimeoutConstant = 0; Timeouts.WriteTotalTimeoutMultiplier = Timeouts.WriteTotalTimeoutConstant = 0;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
&Timeouts, sizeof(Timeouts), NULL, NULL); &Timeouts, sizeof(Timeouts), NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer), &Size); Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer), &Size);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
if (Size != 0) goto SerenumCollectPnpComDeviceId; if (Size != 0) goto CollectPnpComDeviceId;
/* 4. COM port setup, 2nd phase */ /* 4. COM port setup, 2nd phase */
CHECKPOINT; CHECKPOINT;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Purge = SERIAL_PURGE_RXABORT | SERIAL_PURGE_RXCLEAR; Purge = SERIAL_PURGE_RXABORT | SERIAL_PURGE_RXCLEAR;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_PURGE, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_PURGE,
&Purge, 0, NULL, NULL); &Purge, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
SerenumWait(200); Wait(200);
/* 5. Wait for response, 2nd phase */ /* 5. Wait for response, 2nd phase */
CHECKPOINT; CHECKPOINT;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Status = ReadBytes(LowerDevice, Buffer, 1, &TotalBytesReceived); Status = ReadBytes(LowerDevice, Buffer, 1, &TotalBytesReceived);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
if (TotalBytesReceived != 0) goto SerenumCollectPnpComDeviceId; if (TotalBytesReceived != 0) goto CollectPnpComDeviceId;
Size = sizeof(Msr); Size = sizeof(Msr);
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
NULL, 0, &Msr, &Size); NULL, 0, &Msr, &Size);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
if ((Msr & SERIAL_DSR_STATE) == 0) goto SerenumVerifyDisconnect; else goto SerenumConnectIdle; if ((Msr & SERIAL_DSR_STATE) == 0) goto VerifyDisconnect; else goto ConnectIdle;
/* 6. Collect PnP COM device ID */ /* 6. Collect PnP COM device ID */
SerenumCollectPnpComDeviceId: CollectPnpComDeviceId:
CHECKPOINT; CHECKPOINT;
Timeouts.ReadIntervalTimeout = 200; Timeouts.ReadIntervalTimeout = 200;
Timeouts.ReadTotalTimeoutMultiplier = 0; Timeouts.ReadTotalTimeoutMultiplier = 0;
Timeouts.ReadTotalTimeoutConstant = 2200; Timeouts.ReadTotalTimeoutConstant = 2200;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
&Timeouts, sizeof(Timeouts), NULL, NULL); &Timeouts, sizeof(Timeouts), NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Status = ReadBytes(LowerDevice, &Buffer[TotalBytesReceived], sizeof(Buffer) - TotalBytesReceived, &Size); Status = ReadBytes(LowerDevice, &Buffer[TotalBytesReceived], sizeof(Buffer) - TotalBytesReceived, &Size);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
TotalBytesReceived += Size; TotalBytesReceived += Size;
Size = sizeof(PerfStats); Size = sizeof(PerfStats);
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_STATS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_STATS,
NULL, 0, &PerfStats, &Size); NULL, 0, &PerfStats, &Size);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
if (PerfStats.FrameErrorCount + PerfStats.ParityErrorCount != 0) goto SerenumConnectIdle; if (PerfStats.FrameErrorCount + PerfStats.ParityErrorCount != 0) goto ConnectIdle;
for (i = 0; i < TotalBytesReceived; i++) for (i = 0; i < TotalBytesReceived; i++)
{ {
if (Buffer[i] == BEGIN_ID) BufferContainsBeginId = TRUE; if (Buffer[i] == BEGIN_ID) BufferContainsBeginId = TRUE;
@ -382,50 +383,50 @@ SerenumCollectPnpComDeviceId:
} }
if (TotalBytesReceived == 1 || BufferContainsEndId) if (TotalBytesReceived == 1 || BufferContainsEndId)
{ {
if (SerenumIsValidPnpIdString(Buffer, TotalBytesReceived)) if (IsValidPnpIdString(Buffer, TotalBytesReceived))
{ {
Status = ReportDetectedPnpDevice(Buffer, TotalBytesReceived); Status = ReportDetectedPnpDevice(Buffer, TotalBytesReceived);
goto ByeBye; goto ByeBye;
} }
goto SerenumConnectIdle; goto ConnectIdle;
} }
if (!BufferContainsBeginId) goto SerenumConnectIdle; if (!BufferContainsBeginId) goto ConnectIdle;
if (!BufferContainsEndId) goto SerenumConnectIdle; if (!BufferContainsEndId) goto ConnectIdle;
Size = sizeof(Msr); Size = sizeof(Msr);
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
NULL, 0, &Msr, &Size); NULL, 0, &Msr, &Size);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
if ((Msr & SERIAL_DSR_STATE) == 0) goto SerenumVerifyDisconnect; if ((Msr & SERIAL_DSR_STATE) == 0) goto VerifyDisconnect;
/* 7. Verify disconnect */ /* 7. Verify disconnect */
SerenumVerifyDisconnect: VerifyDisconnect:
CHECKPOINT; CHECKPOINT;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
SerenumWait(5000); Wait(5000);
goto SerenumDisconnectIdle; goto DisconnectIdle;
/* 8. Connect idle */ /* 8. Connect idle */
SerenumConnectIdle: ConnectIdle:
CHECKPOINT; CHECKPOINT;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
BaudRate = 300; BaudRate = 300;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
&BaudRate, sizeof(BaudRate), NULL, NULL); &BaudRate, sizeof(BaudRate), NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Lcr.WordLength = 7; Lcr.WordLength = 7;
Lcr.Parity = NO_PARITY; Lcr.Parity = NO_PARITY;
Lcr.StopBits = STOP_BIT_1; Lcr.StopBits = STOP_BIT_1;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
&Lcr, sizeof(Lcr), NULL, NULL); &Lcr, sizeof(Lcr), NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
if (TotalBytesReceived == 0) if (TotalBytesReceived == 0)
@ -435,31 +436,31 @@ SerenumConnectIdle:
goto ByeBye; goto ByeBye;
/* 9. Disconnect idle */ /* 9. Disconnect idle */
SerenumDisconnectIdle: DisconnectIdle:
CHECKPOINT; CHECKPOINT;
/* FIXME: report to OS device removal, if it was present */ /* FIXME: report to OS device removal, if it was present */
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
BaudRate = 300; BaudRate = 300;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
&BaudRate, sizeof(BaudRate), NULL, NULL); &BaudRate, sizeof(BaudRate), NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Lcr.WordLength = 7; Lcr.WordLength = 7;
Lcr.Parity = NO_PARITY; Lcr.Parity = NO_PARITY;
Lcr.StopBits = STOP_BIT_1; Lcr.StopBits = STOP_BIT_1;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
&Lcr, sizeof(Lcr), NULL, NULL); &Lcr, sizeof(Lcr), NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Status = STATUS_DEVICE_NOT_CONNECTED; Status = STATUS_DEVICE_NOT_CONNECTED;
ByeBye: ByeBye:
/* Close port */ /* Close port */
SerenumSendIrp(LowerDevice, IRP_MJ_CLOSE); SendIrp(LowerDevice, IRP_MJ_CLOSE);
SerenumSendIrp(LowerDevice, IRP_MJ_CLEANUP); SendIrp(LowerDevice, IRP_MJ_CLEANUP);
return Status; return Status;
} }
@ -482,20 +483,20 @@ SerenumDetectLegacyDevice(
UNICODE_STRING CompatibleIds; UNICODE_STRING CompatibleIds;
NTSTATUS Status; NTSTATUS Status;
DPRINT("Serenum: SerenumDetectLegacyDevice(DeviceObject %p, LowerDevice %p)\n", DPRINT("SerenumDetectLegacyDevice(DeviceObject %p, LowerDevice %p)\n",
DeviceObject, DeviceObject,
LowerDevice); LowerDevice);
RtlZeroMemory(Buffer, sizeof(Buffer)); RtlZeroMemory(Buffer, sizeof(Buffer));
/* Open port */ /* Open port */
Status = SerenumSendIrp(LowerDevice, IRP_MJ_CREATE); Status = SendIrp(LowerDevice, IRP_MJ_CREATE);
if (!NT_SUCCESS(Status)) return Status; if (!NT_SUCCESS(Status)) return Status;
/* Reset UART */ /* Reset UART */
CHECKPOINT; CHECKPOINT;
Mcr = 0; /* MCR: DTR/RTS/OUT2 off */ Mcr = 0; /* MCR: DTR/RTS/OUT2 off */
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
&Mcr, sizeof(Mcr), NULL, NULL); &Mcr, sizeof(Mcr), NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
@ -503,37 +504,37 @@ SerenumDetectLegacyDevice(
CHECKPOINT; CHECKPOINT;
/* DLAB off */ /* DLAB off */
Fcr = 0; Fcr = 0;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL,
&Fcr, sizeof(Fcr), NULL, NULL); &Fcr, sizeof(Fcr), NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
/* Set serial port speed */ /* Set serial port speed */
BaudRate = 1200; BaudRate = 1200;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
&BaudRate, sizeof(BaudRate), NULL, NULL); &BaudRate, sizeof(BaudRate), NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
/* Set LCR */ /* Set LCR */
LCR.WordLength = 7; LCR.WordLength = 7;
LCR.Parity = NO_PARITY; LCR.Parity = NO_PARITY;
LCR.StopBits = STOP_BITS_2; LCR.StopBits = STOP_BITS_2;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
&LCR, sizeof(LCR), NULL, NULL); &LCR, sizeof(LCR), NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
/* Flush receive buffer */ /* Flush receive buffer */
CHECKPOINT; CHECKPOINT;
Command = SERIAL_PURGE_RXCLEAR; Command = SERIAL_PURGE_RXCLEAR;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
&Command, sizeof(Command), NULL, NULL); &Command, sizeof(Command), NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
/* Wait 100 ms */ /* Wait 100 ms */
SerenumWait(100); Wait(100);
/* Enable DTR/RTS */ /* Enable DTR/RTS */
CHECKPOINT; CHECKPOINT;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
@ -543,7 +544,7 @@ SerenumDetectLegacyDevice(
Timeouts.ReadTotalTimeoutMultiplier = 0; Timeouts.ReadTotalTimeoutMultiplier = 0;
Timeouts.ReadTotalTimeoutConstant = 500; Timeouts.ReadTotalTimeoutConstant = 500;
Timeouts.WriteTotalTimeoutMultiplier = Timeouts.WriteTotalTimeoutConstant = 0; Timeouts.WriteTotalTimeoutMultiplier = Timeouts.WriteTotalTimeoutConstant = 0;
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS, Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
&Timeouts, sizeof(Timeouts), NULL, NULL); &Timeouts, sizeof(Timeouts), NULL, NULL);
if (!NT_SUCCESS(Status)) goto ByeBye; if (!NT_SUCCESS(Status)) goto ByeBye;
@ -606,10 +607,10 @@ SerenumDetectLegacyDevice(
} }
Status = STATUS_DEVICE_NOT_CONNECTED; Status = STATUS_DEVICE_NOT_CONNECTED;
ByeBye: ByeBye:
/* Close port */ /* Close port */
SerenumSendIrp(LowerDevice, IRP_MJ_CLOSE); SendIrp(LowerDevice, IRP_MJ_CLOSE);
SerenumSendIrp(LowerDevice, IRP_MJ_CLEANUP); SendIrp(LowerDevice, IRP_MJ_CLEANUP);
return Status; return Status;
} }

View file

@ -19,7 +19,7 @@ SerenumAddDevice(
PFDO_DEVICE_EXTENSION DeviceExtension; PFDO_DEVICE_EXTENSION DeviceExtension;
NTSTATUS Status; NTSTATUS Status;
DPRINT("Serenum: SerenumAddDevice called. Pdo = %p\n", Pdo); DPRINT("SerenumAddDevice called. Pdo = %p\n", Pdo);
/* Create new device object */ /* Create new device object */
Status = IoCreateDevice(DriverObject, Status = IoCreateDevice(DriverObject,
@ -31,7 +31,7 @@ SerenumAddDevice(
&Fdo); &Fdo);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("Serenum: IoCreateDevice() failed with status 0x%08lx\n", Status); DPRINT("IoCreateDevice() failed with status 0x%08lx\n", Status);
return Status; return Status;
} }
DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension; DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
@ -45,7 +45,7 @@ SerenumAddDevice(
&DeviceExtension->SerenumInterfaceName); &DeviceExtension->SerenumInterfaceName);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("Serenum: IoRegisterDeviceInterface() failed with status 0x%08lx\n", Status); DPRINT("IoRegisterDeviceInterface() failed with status 0x%08lx\n", Status);
IoDeleteDevice(Fdo); IoDeleteDevice(Fdo);
return Status; return Status;
} }
@ -58,7 +58,7 @@ SerenumAddDevice(
Status = IoAttachDeviceToDeviceStackSafe(Fdo, Pdo, &DeviceExtension->LowerDevice); Status = IoAttachDeviceToDeviceStackSafe(Fdo, Pdo, &DeviceExtension->LowerDevice);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("Serenum: IoAttachDeviceToDeviceStackSafe() failed with status 0x%08lx\n", Status); DPRINT("IoAttachDeviceToDeviceStackSafe() failed with status 0x%08lx\n", Status);
IoDeleteDevice(Fdo); IoDeleteDevice(Fdo);
return Status; return Status;
} }
@ -76,7 +76,7 @@ SerenumFdoStartDevice(
PFDO_DEVICE_EXTENSION DeviceExtension; PFDO_DEVICE_EXTENSION DeviceExtension;
NTSTATUS Status; NTSTATUS Status;
DPRINT("Serenum: SerenumFdoStartDevice() called\n"); DPRINT("SerenumFdoStartDevice() called\n");
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(DeviceExtension->Common.PnpState == dsStopped); ASSERT(DeviceExtension->Common.PnpState == dsStopped);
@ -84,7 +84,7 @@ SerenumFdoStartDevice(
Status = IoSetDeviceInterfaceState(&DeviceExtension->SerenumInterfaceName, TRUE); Status = IoSetDeviceInterfaceState(&DeviceExtension->SerenumInterfaceName, TRUE);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("Serenum: IoSetDeviceInterfaceState() failed with status 0x%08lx\n", Status); DPRINT("IoSetDeviceInterfaceState() failed with status 0x%08lx\n", Status);
return Status; return Status;
} }
@ -175,7 +175,7 @@ SerenumFdoPnp(
*/ */
case IRP_MN_START_DEVICE: /* 0x0 */ case IRP_MN_START_DEVICE: /* 0x0 */
{ {
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_START_DEVICE\n"); DPRINT("IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
/* Call lower driver */ /* Call lower driver */
Status = ForwardIrpAndWait(DeviceObject, Irp); Status = ForwardIrpAndWait(DeviceObject, Irp);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
@ -189,13 +189,13 @@ SerenumFdoPnp(
case BusRelations: case BusRelations:
{ {
PDEVICE_RELATIONS DeviceRelations = NULL; PDEVICE_RELATIONS DeviceRelations = NULL;
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n"); DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
Status = SerenumFdoQueryBusRelations(DeviceObject, &DeviceRelations); Status = SerenumFdoQueryBusRelations(DeviceObject, &DeviceRelations);
Information = (ULONG_PTR)DeviceRelations; Information = (ULONG_PTR)DeviceRelations;
break; break;
} }
default: default:
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n", DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
Stack->Parameters.QueryDeviceRelations.Type); Stack->Parameters.QueryDeviceRelations.Type);
return ForwardIrpAndForget(DeviceObject, Irp); return ForwardIrpAndForget(DeviceObject, Irp);
} }
@ -203,7 +203,7 @@ SerenumFdoPnp(
} }
default: default:
{ {
DPRINT1("Serenum: IRP_MJ_PNP / unknown minor function 0x%lx\n", MinorFunction); DPRINT1("IRP_MJ_PNP / unknown minor function 0x%lx\n", MinorFunction);
return ForwardIrpAndForget(DeviceObject, Irp); return ForwardIrpAndForget(DeviceObject, Irp);
} }
} }

View file

@ -114,7 +114,7 @@ ForwardIrpAndWait(
KeInitializeEvent(&Event, NotificationEvent, FALSE); KeInitializeEvent(&Event, NotificationEvent, FALSE);
IoCopyCurrentIrpStackLocationToNext(Irp); IoCopyCurrentIrpStackLocationToNext(Irp);
DPRINT("Serenum: Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName); DPRINT("Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE); IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
Status = IoCallDriver(LowerDevice, Irp); Status = IoCallDriver(LowerDevice, Irp);
@ -141,7 +141,7 @@ ForwardIrpToLowerDeviceAndForget(
LowerDevice = DeviceExtension->LowerDevice; LowerDevice = DeviceExtension->LowerDevice;
ASSERT(LowerDevice); ASSERT(LowerDevice);
DPRINT("Serenum: calling lower device 0x%p [%wZ]\n", DPRINT("Calling lower device 0x%p [%wZ]\n",
LowerDevice, &LowerDevice->DriverObject->DriverName); LowerDevice, &LowerDevice->DriverObject->DriverName);
IoSkipCurrentIrpStackLocation(Irp); IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(LowerDevice, Irp); return IoCallDriver(LowerDevice, Irp);
@ -160,7 +160,7 @@ ForwardIrpToAttachedFdoAndForget(
Fdo = DeviceExtension->AttachedFdo; Fdo = DeviceExtension->AttachedFdo;
ASSERT(Fdo); ASSERT(Fdo);
DPRINT("Serenum: calling attached Fdo 0x%p [%wZ]\n", DPRINT("Calling attached Fdo 0x%p [%wZ]\n",
Fdo, &Fdo->DriverObject->DriverName); Fdo, &Fdo->DriverObject->DriverName);
IoSkipCurrentIrpStackLocation(Irp); IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(Fdo, Irp); return IoCallDriver(Fdo, Irp);

View file

@ -44,28 +44,29 @@ SerenumPdoQueryId(
{ {
case BusQueryDeviceID: case BusQueryDeviceID:
{ {
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryDeviceID\n"); DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryDeviceID\n");
SourceString = &DeviceExtension->DeviceId; SourceString = &DeviceExtension->DeviceId;
break; break;
} }
case BusQueryHardwareIDs: case BusQueryHardwareIDs:
{ {
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs\n"); DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs\n");
SourceString = &DeviceExtension->HardwareIds; SourceString = &DeviceExtension->HardwareIds;
break; break;
} }
case BusQueryCompatibleIDs: case BusQueryCompatibleIDs:
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryCompatibleIDs\n"); DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryCompatibleIDs\n");
SourceString = &DeviceExtension->CompatibleIds; SourceString = &DeviceExtension->CompatibleIds;
break; break;
case BusQueryInstanceID: case BusQueryInstanceID:
{ {
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryInstanceID\n"); DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryInstanceID\n");
SourceString = &DeviceExtension->InstanceId; SourceString = &DeviceExtension->InstanceId;
break; break;
} }
default: default:
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_ID / unknown query id type 0x%lx\n", IdType); DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_ID / unknown query id type 0x%lx\n", IdType);
ASSERT(FALSE);
return STATUS_NOT_SUPPORTED; return STATUS_NOT_SUPPORTED;
} }
@ -140,7 +141,7 @@ SerenumPdoPnp(
*/ */
case IRP_MN_START_DEVICE: /* 0x0 */ case IRP_MN_START_DEVICE: /* 0x0 */
{ {
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_START_DEVICE\n"); DPRINT("IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
Status = SerenumPdoStartDevice(DeviceObject); Status = SerenumPdoStartDevice(DeviceObject);
break; break;
} }
@ -148,22 +149,23 @@ SerenumPdoPnp(
{ {
switch (Stack->Parameters.QueryDeviceRelations.Type) switch (Stack->Parameters.QueryDeviceRelations.Type)
{ {
case RemovalRelations: case RemovalRelations:
{ {
return ForwardIrpToAttachedFdoAndForget(DeviceObject, Irp); return ForwardIrpToAttachedFdoAndForget(DeviceObject, Irp);
} }
case TargetDeviceRelation: case TargetDeviceRelation:
{ {
PDEVICE_RELATIONS DeviceRelations = NULL; PDEVICE_RELATIONS DeviceRelations = NULL;
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / TargetDeviceRelation\n"); DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / TargetDeviceRelation\n");
Status = SerenumPdoQueryDeviceRelations(DeviceObject, &DeviceRelations); Status = SerenumPdoQueryDeviceRelations(DeviceObject, &DeviceRelations);
Information = (ULONG_PTR)DeviceRelations; Information = (ULONG_PTR)DeviceRelations;
break; break;
} }
default: default:
{ {
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n", DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
Stack->Parameters.QueryDeviceRelations.Type); Stack->Parameters.QueryDeviceRelations.Type);
ASSERT(FALSE);
Status = STATUS_NOT_IMPLEMENTED; Status = STATUS_NOT_IMPLEMENTED;
break; break;
} }
@ -174,7 +176,7 @@ SerenumPdoPnp(
{ {
PDEVICE_CAPABILITIES DeviceCapabilities; PDEVICE_CAPABILITIES DeviceCapabilities;
ULONG i; ULONG i;
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n"); DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n");
DeviceCapabilities = (PDEVICE_CAPABILITIES)Stack->Parameters.DeviceCapabilities.Capabilities; DeviceCapabilities = (PDEVICE_CAPABILITIES)Stack->Parameters.DeviceCapabilities.Capabilities;
/* FIXME: capabilities can change with connected device */ /* FIXME: capabilities can change with connected device */
@ -200,7 +202,7 @@ SerenumPdoPnp(
} }
case IRP_MN_QUERY_RESOURCES: /* 0xa */ case IRP_MN_QUERY_RESOURCES: /* 0xa */
{ {
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCES\n"); DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_RESOURCES\n");
/* Serial devices don't need resources, except the ones of /* Serial devices don't need resources, except the ones of
* the serial port. This PDO is the serial device PDO, so * the serial port. This PDO is the serial device PDO, so
* report no resource by not changing Information and * report no resource by not changing Information and
@ -212,7 +214,7 @@ SerenumPdoPnp(
} }
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS: /* 0xb */ case IRP_MN_QUERY_RESOURCE_REQUIREMENTS: /* 0xb */
{ {
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n"); DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
/* Serial devices don't need resources, except the ones of /* Serial devices don't need resources, except the ones of
* the serial port. This PDO is the serial device PDO, so * the serial port. This PDO is the serial device PDO, so
* report no resource by not changing Information and * report no resource by not changing Information and
@ -230,7 +232,7 @@ SerenumPdoPnp(
{ {
PUNICODE_STRING Source; PUNICODE_STRING Source;
PWSTR Description; PWSTR Description;
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription\n"); DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription\n");
Source = &((PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->DeviceDescription; Source = &((PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->DeviceDescription;
Description = ExAllocatePoolWithTag(PagedPool, Source->Length + sizeof(WCHAR), SERENUM_TAG); Description = ExAllocatePoolWithTag(PagedPool, Source->Length + sizeof(WCHAR), SERENUM_TAG);
@ -256,8 +258,9 @@ SerenumPdoPnp(
} }
default: default:
{ {
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / unknown type 0x%lx\n", DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / unknown type 0x%lx\n",
Stack->Parameters.QueryDeviceText.DeviceTextType); Stack->Parameters.QueryDeviceText.DeviceTextType);
ASSERT(FALSE);
Status = STATUS_NOT_SUPPORTED; Status = STATUS_NOT_SUPPORTED;
} }
} }
@ -275,7 +278,7 @@ SerenumPdoPnp(
case IRP_MN_QUERY_BUS_INFORMATION: /* 0x15 */ case IRP_MN_QUERY_BUS_INFORMATION: /* 0x15 */
{ {
PPNP_BUS_INFORMATION BusInfo; PPNP_BUS_INFORMATION BusInfo;
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_BUS_INFORMATION\n"); DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_BUS_INFORMATION\n");
BusInfo = (PPNP_BUS_INFORMATION)ExAllocatePoolWithTag(PagedPool, sizeof(PNP_BUS_INFORMATION), SERENUM_TAG); BusInfo = (PPNP_BUS_INFORMATION)ExAllocatePoolWithTag(PagedPool, sizeof(PNP_BUS_INFORMATION), SERENUM_TAG);
if (!BusInfo) if (!BusInfo)
@ -298,7 +301,8 @@ SerenumPdoPnp(
{ {
/* We can't forward request to the lower driver, because /* We can't forward request to the lower driver, because
* we are a Pdo, so we don't have lower driver... */ * we are a Pdo, so we don't have lower driver... */
DPRINT1("Serenum: IRP_MJ_PNP / unknown minor function 0x%lx\n", MinorFunction); DPRINT1("IRP_MJ_PNP / unknown minor function 0x%lx\n", MinorFunction);
ASSERT(FALSE);
Information = Irp->IoStatus.Information; Information = Irp->IoStatus.Information;
Status = Irp->IoStatus.Status; Status = Irp->IoStatus.Status;
} }