No need to write "Serenum:" at the start of each debug string
authorHervé Poussineau <hpoussin@reactos.org>
Tue, 18 Apr 2006 19:26:48 +0000 (19:26 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Tue, 18 Apr 2006 19:26:48 +0000 (19:26 +0000)
svn path=/trunk/; revision=21659

reactos/drivers/bus/serenum/detect.c
reactos/drivers/bus/serenum/fdo.c
reactos/drivers/bus/serenum/misc.c
reactos/drivers/bus/serenum/pdo.c

index 77d5814..c1c7680 100644 (file)
@@ -13,7 +13,7 @@
 #include "serenum.h"
 
 static NTSTATUS
-SerenumDeviceIoControl(
+DeviceIoControl(
        IN PDEVICE_OBJECT DeviceObject,
        IN ULONG CtlCode,
        IN PVOID InputBuffer OPTIONAL,
@@ -39,7 +39,7 @@ SerenumDeviceIoControl(
                &IoStatus);
        if (Irp == NULL)
        {
-               DPRINT("Serenum: IoBuildDeviceIoControlRequest() failed\n");
+               DPRINT("IoBuildDeviceIoControlRequest() failed\n");
                return STATUS_INSUFFICIENT_RESOURCES;
        }
 
@@ -47,7 +47,7 @@ SerenumDeviceIoControl(
 
        if (Status == STATUS_PENDING)
        {
-               DPRINT("Serenum: Operation pending\n");
+               DPRINT("Operation pending\n");
                KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
                Status = IoStatus.Status;
        }
@@ -61,7 +61,7 @@ SerenumDeviceIoControl(
 }
 
 static NTSTATUS
-SerenumSendIrp(
+SendIrp(
        IN PDEVICE_OBJECT DeviceObject,
        IN ULONG MajorFunction)
 {
@@ -71,7 +71,7 @@ SerenumSendIrp(
        NTSTATUS Status;
 
        KeInitializeEvent(&Event, NotificationEvent, FALSE);
-       
+
        Irp = IoBuildSynchronousFsdRequest(
                MajorFunction,
                DeviceObject,
@@ -82,15 +82,15 @@ SerenumSendIrp(
                &IoStatus);
        if (Irp == NULL)
        {
-               DPRINT("Serenum: IoBuildSynchronousFsdRequest() failed\n");
+               DPRINT("IoBuildSynchronousFsdRequest() failed\n");
                return STATUS_INSUFFICIENT_RESOURCES;
        }
-       
+
        Status = IoCallDriver(DeviceObject, Irp);
 
        if (Status == STATUS_PENDING)
        {
-               DPRINT("Serenum: Operation pending\n");
+               DPRINT("Operation pending\n");
                KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
                Status = IoStatus.Status;
        }
@@ -129,7 +129,7 @@ ReadBytes(
                KeWaitForSingleObject(&event, Suspended, KernelMode, FALSE, NULL);
                Status = ioStatus.Status;
        }
-       DPRINT("Serenum: bytes received: %lu/%lu\n",
+       DPRINT("Bytes received: %lu/%lu\n",
                ioStatus.Information, BufferSize);
        *FilledBytes = ioStatus.Information;
        return Status;
@@ -149,7 +149,7 @@ ReportDetectedDevice(
        PFDO_DEVICE_EXTENSION FdoDeviceExtension;
        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(
                DeviceObject->DriverObject,
@@ -210,12 +210,12 @@ ByeBye:
 }
 
 static BOOLEAN
-SerenumIsValidPnpIdString(
+IsValidPnpIdString(
        IN PUCHAR Buffer,
        IN ULONG BufferLength)
 {
-       /* FIXME: SerenumIsValidPnpIdString not implemented */
-       DPRINT1("Serenum: SerenumIsValidPnpIdString() unimplemented\n");
+       /* FIXME: IsValidPnpIdString not implemented */
+       DPRINT1("IsValidPnpIdString() unimplemented\n");
        return STATUS_SUCCESS;
 }
 
@@ -226,7 +226,7 @@ ReportDetectedPnpDevice(
 {
        ULONG i;
        /* FIXME: ReportDetectedPnpDevice not implemented */
-       DPRINT1("Serenum: ReportDetectedPnpDevice() unimplemented\n");
+       DPRINT1("ReportDetectedPnpDevice() unimplemented\n");
        DPRINT1("");
        for (i = 0; i < BufferLength; i++)
                DbgPrint("%c", Buffer[i]);
@@ -239,7 +239,8 @@ ReportDetectedPnpDevice(
 #define END_ID ')'
 
 static NTSTATUS
-SerenumWait(ULONG milliseconds)
+Wait(
+       IN ULONG milliseconds)
 {
        KTIMER Timer;
        LARGE_INTEGER DueTime;
@@ -267,114 +268,114 @@ SerenumDetectPnpDevice(
        SERIAL_TIMEOUTS Timeouts;
        SERIALPERF_STATS PerfStats;
        NTSTATUS Status;
-       
+
        /* Open port */
-       Status = SerenumSendIrp(LowerDevice, IRP_MJ_CREATE);
+       Status = SendIrp(LowerDevice, IRP_MJ_CREATE);
        if (!NT_SUCCESS(Status)) goto ByeBye;
 
        /* 1. COM port initialization, check for device enumerate */
        CHECKPOINT;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       SerenumWait(200);
+       Wait(200);
        Size = sizeof(Msr);
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
                NULL, 0, &Msr, &Size);
        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 */
        CHECKPOINT;
        BaudRate = 1200;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
                &BaudRate, sizeof(BaudRate), NULL, 0);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        Lcr.WordLength = 7;
        Lcr.Parity = NO_PARITY;
        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);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       SerenumWait(200);
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
+       Wait(200);
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       SerenumWait(200);
+       Wait(200);
 
        /* 3. Wait for response, 1st phase */
        CHECKPOINT;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        Timeouts.ReadIntervalTimeout = 0;
        Timeouts.ReadTotalTimeoutMultiplier = 0;
        Timeouts.ReadTotalTimeoutConstant = 200;
        Timeouts.WriteTotalTimeoutMultiplier = Timeouts.WriteTotalTimeoutConstant = 0;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
                &Timeouts, sizeof(Timeouts), NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer), &Size);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       if (Size != 0) goto SerenumCollectPnpComDeviceId;
+       if (Size != 0) goto CollectPnpComDeviceId;
 
        /* 4. COM port setup, 2nd phase */
        CHECKPOINT;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        Purge = SERIAL_PURGE_RXABORT | SERIAL_PURGE_RXCLEAR;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_PURGE,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_PURGE,
                &Purge, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       SerenumWait(200);
+       Wait(200);
 
        /* 5. Wait for response, 2nd phase */
        CHECKPOINT;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        Status = ReadBytes(LowerDevice, Buffer, 1, &TotalBytesReceived);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       if (TotalBytesReceived != 0) goto SerenumCollectPnpComDeviceId;
+       if (TotalBytesReceived != 0) goto CollectPnpComDeviceId;
        Size = sizeof(Msr);
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
                NULL, 0, &Msr, &Size);
        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 */
-SerenumCollectPnpComDeviceId:
+CollectPnpComDeviceId:
        CHECKPOINT;
        Timeouts.ReadIntervalTimeout = 200;
        Timeouts.ReadTotalTimeoutMultiplier = 0;
        Timeouts.ReadTotalTimeoutConstant = 2200;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
                &Timeouts, sizeof(Timeouts), NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        Status = ReadBytes(LowerDevice, &Buffer[TotalBytesReceived], sizeof(Buffer) - TotalBytesReceived, &Size);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        TotalBytesReceived += Size;
        Size = sizeof(PerfStats);
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_STATS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_STATS,
                NULL, 0, &PerfStats, &Size);
        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++)
        {
                if (Buffer[i] == BEGIN_ID) BufferContainsBeginId = TRUE;
@@ -382,50 +383,50 @@ SerenumCollectPnpComDeviceId:
        }
        if (TotalBytesReceived == 1 || BufferContainsEndId)
        {
-               if (SerenumIsValidPnpIdString(Buffer, TotalBytesReceived))
+               if (IsValidPnpIdString(Buffer, TotalBytesReceived))
                {
                        Status = ReportDetectedPnpDevice(Buffer, TotalBytesReceived);
                        goto ByeBye;
                }
-               goto SerenumConnectIdle;
+               goto ConnectIdle;
        }
-       if (!BufferContainsBeginId) goto SerenumConnectIdle;
-       if (!BufferContainsEndId) goto SerenumConnectIdle;
+       if (!BufferContainsBeginId) goto ConnectIdle;
+       if (!BufferContainsEndId) goto ConnectIdle;
        Size = sizeof(Msr);
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
                NULL, 0, &Msr, &Size);
        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 */
-SerenumVerifyDisconnect:
+VerifyDisconnect:
        CHECKPOINT;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       SerenumWait(5000);
-       goto SerenumDisconnectIdle;
+       Wait(5000);
+       goto DisconnectIdle;
 
        /* 8. Connect idle */
-SerenumConnectIdle:
+ConnectIdle:
        CHECKPOINT;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        BaudRate = 300;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
                &BaudRate, sizeof(BaudRate), NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        Lcr.WordLength = 7;
        Lcr.Parity = NO_PARITY;
        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);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        if (TotalBytesReceived == 0)
@@ -435,31 +436,31 @@ SerenumConnectIdle:
        goto ByeBye;
 
        /* 9. Disconnect idle */
-SerenumDisconnectIdle:
+DisconnectIdle:
        CHECKPOINT;
        /* 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);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        BaudRate = 300;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
                &BaudRate, sizeof(BaudRate), NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        Lcr.WordLength = 7;
        Lcr.Parity = NO_PARITY;
        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);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        Status = STATUS_DEVICE_NOT_CONNECTED;
 
 ByeBye:
        /* Close port */
-       SerenumSendIrp(LowerDevice, IRP_MJ_CLOSE);
-       SerenumSendIrp(LowerDevice, IRP_MJ_CLEANUP);
+       SendIrp(LowerDevice, IRP_MJ_CLOSE);
+       SendIrp(LowerDevice, IRP_MJ_CLEANUP);
        return Status;
 }
 
@@ -482,20 +483,20 @@ SerenumDetectLegacyDevice(
        UNICODE_STRING CompatibleIds;
        NTSTATUS Status;
 
-       DPRINT("Serenum: SerenumDetectLegacyDevice(DeviceObject %p, LowerDevice %p)\n",
+       DPRINT("SerenumDetectLegacyDevice(DeviceObject %p, LowerDevice %p)\n",
                DeviceObject,
                LowerDevice);
 
        RtlZeroMemory(Buffer, sizeof(Buffer));
-       
+
        /* Open port */
-       Status = SerenumSendIrp(LowerDevice, IRP_MJ_CREATE);
+       Status = SendIrp(LowerDevice, IRP_MJ_CREATE);
        if (!NT_SUCCESS(Status)) return Status;
 
        /* Reset UART */
        CHECKPOINT;
        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);
        if (!NT_SUCCESS(Status)) goto ByeBye;
 
@@ -503,37 +504,37 @@ SerenumDetectLegacyDevice(
        CHECKPOINT;
        /* DLAB off */
        Fcr = 0;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL,
                &Fcr, sizeof(Fcr), NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        /* Set serial port speed */
        BaudRate = 1200;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
                &BaudRate, sizeof(BaudRate), NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        /* Set LCR */
        LCR.WordLength = 7;
        LCR.Parity = NO_PARITY;
        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);
        if (!NT_SUCCESS(Status)) goto ByeBye;
 
        /* Flush receive buffer */
        CHECKPOINT;
        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);
        if (!NT_SUCCESS(Status)) goto ByeBye;
        /* Wait 100 ms */
-       SerenumWait(100);
+       Wait(100);
 
        /* Enable DTR/RTS */
        CHECKPOINT;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
                NULL, 0, NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
 
@@ -543,7 +544,7 @@ SerenumDetectLegacyDevice(
        Timeouts.ReadTotalTimeoutMultiplier = 0;
        Timeouts.ReadTotalTimeoutConstant = 500;
        Timeouts.WriteTotalTimeoutMultiplier = Timeouts.WriteTotalTimeoutConstant = 0;
-       Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
+       Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
                &Timeouts, sizeof(Timeouts), NULL, NULL);
        if (!NT_SUCCESS(Status)) goto ByeBye;
 
@@ -606,10 +607,10 @@ SerenumDetectLegacyDevice(
        }
 
        Status = STATUS_DEVICE_NOT_CONNECTED;
-       
+
 ByeBye:
        /* Close port */
-       SerenumSendIrp(LowerDevice, IRP_MJ_CLOSE);
-       SerenumSendIrp(LowerDevice, IRP_MJ_CLEANUP);
+       SendIrp(LowerDevice, IRP_MJ_CLOSE);
+       SendIrp(LowerDevice, IRP_MJ_CLEANUP);
        return Status;
 }
index 4f04c58..302a223 100644 (file)
@@ -19,7 +19,7 @@ SerenumAddDevice(
        PFDO_DEVICE_EXTENSION DeviceExtension;
        NTSTATUS Status;
 
-       DPRINT("Serenum: SerenumAddDevice called. Pdo = %p\n", Pdo);
+       DPRINT("SerenumAddDevice called. Pdo = %p\n", Pdo);
 
        /* Create new device object */
        Status = IoCreateDevice(DriverObject,
@@ -31,7 +31,7 @@ SerenumAddDevice(
                                &Fdo);
        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;
        }
        DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
@@ -45,7 +45,7 @@ SerenumAddDevice(
                &DeviceExtension->SerenumInterfaceName);
        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);
                return Status;
        }
@@ -58,7 +58,7 @@ SerenumAddDevice(
        Status = IoAttachDeviceToDeviceStackSafe(Fdo, Pdo, &DeviceExtension->LowerDevice);
        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);
                return Status;
        }
@@ -76,7 +76,7 @@ SerenumFdoStartDevice(
        PFDO_DEVICE_EXTENSION DeviceExtension;
        NTSTATUS Status;
 
-       DPRINT("Serenum: SerenumFdoStartDevice() called\n");
+       DPRINT("SerenumFdoStartDevice() called\n");
        DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
 
        ASSERT(DeviceExtension->Common.PnpState == dsStopped);
@@ -84,7 +84,7 @@ SerenumFdoStartDevice(
        Status = IoSetDeviceInterfaceState(&DeviceExtension->SerenumInterfaceName, TRUE);
        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;
        }
 
@@ -175,7 +175,7 @@ SerenumFdoPnp(
                */
                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 */
                        Status = ForwardIrpAndWait(DeviceObject, Irp);
                        if (NT_SUCCESS(Status))
@@ -189,13 +189,13 @@ SerenumFdoPnp(
                                case BusRelations:
                                {
                                        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);
                                        Information = (ULONG_PTR)DeviceRelations;
                                        break;
                                }
                                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);
                                        return ForwardIrpAndForget(DeviceObject, Irp);
                        }
@@ -203,7 +203,7 @@ SerenumFdoPnp(
                }
                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);
                }
        }
index 959986c..d16ab02 100644 (file)
@@ -114,7 +114,7 @@ ForwardIrpAndWait(
        KeInitializeEvent(&Event, NotificationEvent, FALSE);
        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);
 
        Status = IoCallDriver(LowerDevice, Irp);
@@ -141,7 +141,7 @@ ForwardIrpToLowerDeviceAndForget(
 
        LowerDevice = DeviceExtension->LowerDevice;
        ASSERT(LowerDevice);
-       DPRINT("Serenum: calling lower device 0x%p [%wZ]\n",
+       DPRINT("Calling lower device 0x%p [%wZ]\n",
                LowerDevice, &LowerDevice->DriverObject->DriverName);
        IoSkipCurrentIrpStackLocation(Irp);
        return IoCallDriver(LowerDevice, Irp);
@@ -160,7 +160,7 @@ ForwardIrpToAttachedFdoAndForget(
 
        Fdo = DeviceExtension->AttachedFdo;
        ASSERT(Fdo);
-       DPRINT("Serenum: calling attached Fdo 0x%p [%wZ]\n",
+       DPRINT("Calling attached Fdo 0x%p [%wZ]\n",
                Fdo, &Fdo->DriverObject->DriverName);
        IoSkipCurrentIrpStackLocation(Irp);
        return IoCallDriver(Fdo, Irp);
index 56bbc85..1660c13 100644 (file)
@@ -44,28 +44,29 @@ SerenumPdoQueryId(
        {
                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;
                        break;
                }
                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;
                        break;
                }
                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;
                        break;
                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;
                        break;
                }
                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;
        }
 
@@ -140,7 +141,7 @@ SerenumPdoPnp(
                */
                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);
                        break;
                }
@@ -148,22 +149,23 @@ SerenumPdoPnp(
                {
                        switch (Stack->Parameters.QueryDeviceRelations.Type)
                        {
-                               case  RemovalRelations:
+                               case RemovalRelations:
                                {
                                        return ForwardIrpToAttachedFdoAndForget(DeviceObject, Irp);
                                }
                                case TargetDeviceRelation:
                                {
                                        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);
                                        Information = (ULONG_PTR)DeviceRelations;
                                        break;
                                }
                                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);
+                                       ASSERT(FALSE);
                                        Status = STATUS_NOT_IMPLEMENTED;
                                        break;
                                }
@@ -174,7 +176,7 @@ SerenumPdoPnp(
                {
                        PDEVICE_CAPABILITIES DeviceCapabilities;
                        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;
                        /* FIXME: capabilities can change with connected device */
@@ -200,7 +202,7 @@ SerenumPdoPnp(
                }
                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
                         * the serial port. This PDO is the serial device PDO, so
                         * report no resource by not changing Information and
@@ -212,7 +214,7 @@ SerenumPdoPnp(
                }
                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
                         * the serial port. This PDO is the serial device PDO, so
                         * report no resource by not changing Information and
@@ -230,7 +232,7 @@ SerenumPdoPnp(
                                {
                                        PUNICODE_STRING Source;
                                        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;
                                        Description = ExAllocatePoolWithTag(PagedPool, Source->Length + sizeof(WCHAR), SERENUM_TAG);
@@ -256,8 +258,9 @@ SerenumPdoPnp(
                                }
                                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);
+                                       ASSERT(FALSE);
                                        Status = STATUS_NOT_SUPPORTED;
                                }
                        }
@@ -275,7 +278,7 @@ SerenumPdoPnp(
                case IRP_MN_QUERY_BUS_INFORMATION: /* 0x15 */
                {
                        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);
                        if (!BusInfo)
@@ -298,7 +301,8 @@ SerenumPdoPnp(
                {
                        /* We can't forward request to the lower driver, because
                         * 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;
                        Status = Irp->IoStatus.Status;
                }