Author: hpoussin
Date: Sun Mar 18 03:27:02 2007
New Revision: 26128
URL: 
http://svn.reactos.org/svn/reactos?rev=26128&view=rev
Log:
Fix warnings
Modified:
    trunk/reactos/drivers/input/kbdclass/kbdclass.c
    trunk/reactos/drivers/input/kbdclass/kbdclass.h
    trunk/reactos/drivers/input/kbdclass/kbdclass.rbuild
    trunk/reactos/drivers/input/kbdclass/misc.c
    trunk/reactos/drivers/input/mouclass/misc.c
    trunk/reactos/drivers/input/mouclass/mouclass.c
    trunk/reactos/drivers/input/mouclass/mouclass.h
    trunk/reactos/drivers/input/mouclass/mouclass.rbuild
    trunk/reactos/drivers/input/sermouse/createclose.c
    trunk/reactos/drivers/input/sermouse/detect.c
    trunk/reactos/drivers/input/sermouse/fdo.c
    trunk/reactos/drivers/input/sermouse/internaldevctl.c
    trunk/reactos/drivers/input/sermouse/misc.c
    trunk/reactos/drivers/input/sermouse/readmouse.c
    trunk/reactos/drivers/input/sermouse/sermouse.c
    trunk/reactos/drivers/input/sermouse/sermouse.h
Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/kbdclass/kbd…
==============================================================================
--- trunk/reactos/drivers/input/kbdclass/kbdclass.c (original)
+++ trunk/reactos/drivers/input/kbdclass/kbdclass.c Sun Mar 18 03:27:02 2007
@@ -6,9 +6,6 @@
  *
  * PROGRAMMERS:     Hervé Poussineau (hpoussin(a)reactos.org)
  */
-
-#define NDEBUG
-#include <debug.h>
 #define INITGUID
 #include "kbdclass.h"
@@ -328,7 +325,7 @@
        DeviceIdW = &DeviceNameU.Buffer[PrefixLength / sizeof(WCHAR)];
        while (DeviceId < 9999)
        {
-               DeviceNameU.Length = PrefixLength + swprintf(DeviceIdW, L"%lu",
DeviceId) * sizeof(WCHAR);
+               DeviceNameU.Length = (USHORT)(PrefixLength + swprintf(DeviceIdW,
L"%lu", DeviceId) * sizeof(WCHAR));
                Status = IoCreateDevice(
                        DriverObject,
                        sizeof(CLASS_DEVICE_EXTENSION),
@@ -438,7 +435,7 @@
        return Status;
 }
-static BOOLEAN CALLBACK
+static BOOLEAN NTAPI
 ClassCallback(
        IN PDEVICE_OBJECT ClassDeviceObject,
        IN OUT PKEYBOARD_INPUT_DATA DataStart,
@@ -448,8 +445,8 @@
        PCLASS_DEVICE_EXTENSION ClassDeviceExtension =
ClassDeviceObject->DeviceExtension;
        PIRP Irp = NULL;
        KIRQL OldIrql;
-       ULONG InputCount = DataEnd - DataStart;
-       ULONG ReadSize;
+       SIZE_T InputCount = DataEnd - DataStart;
+       SIZE_T ReadSize;
        ASSERT(ClassDeviceExtension->Common.IsClassDO);
@@ -489,7 +486,7 @@
                        /* Skip the packet we just sent away */
                        DataStart += NumberOfEntries;
-                       (*ConsumedCount) += NumberOfEntries;
+                       (*ConsumedCount) += (ULONG)NumberOfEntries;
                        InputCount -= NumberOfEntries;
                }
        }
@@ -520,7 +517,7 @@
                /* Move the counter up */
                ClassDeviceExtension->InputCount += ReadSize;
-               (*ConsumedCount) += ReadSize;
+               (*ConsumedCount) += (ULONG)ReadSize;
        }
        else
        {
@@ -827,13 +824,13 @@
        DriverExtension = (PCLASS_DRIVER_EXTENSION)Context;
        /* Create port base name, by replacing Class by Port at the end of the class base
name */
-       Status = RtlDuplicateUnicodeString(
+       Status = DuplicateUnicodeString(
                RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
                &DriverExtension->DeviceBaseName,
                &PortBaseName);
        if (!NT_SUCCESS(Status))
        {
-               DPRINT("RtlDuplicateUnicodeString() failed with status
0x%08lx\n", Status);
+               DPRINT("DuplicateUnicodeString() failed with status 0x%08lx\n",
Status);
                goto cleanup;
        }
        PortBaseName.Length -= (sizeof(L"Class") - sizeof(UNICODE_NULL));
@@ -886,7 +883,7 @@
                PDEVICE_OBJECT PortDeviceObject = NULL;
                PFILE_OBJECT FileObject = NULL;
-               PortName.Length = PortName.MaximumLength =
KeyValueInformation->NameLength;
+               PortName.Length = PortName.MaximumLength =
(USHORT)KeyValueInformation->NameLength;
                PortName.Buffer = KeyValueInformation->Name;
                /* Open the device object pointer */
@@ -939,13 +936,13 @@
        }
        RtlZeroMemory(DriverExtension, sizeof(CLASS_DRIVER_EXTENSION));
-       Status = RtlDuplicateUnicodeString(
+       Status = DuplicateUnicodeString(
                RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
                RegistryPath,
                &DriverExtension->RegistryPath);
        if (!NT_SUCCESS(Status))
        {
-               DPRINT("RtlDuplicateUnicodeString() failed with status
0x%08lx\n", Status);
+               DPRINT("DuplicateUnicodeString() failed with status 0x%08lx\n",
Status);
                return Status;
        }
Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/kbdclass/kbd…
==============================================================================
--- trunk/reactos/drivers/input/kbdclass/kbdclass.h (original)
+++ trunk/reactos/drivers/input/kbdclass/kbdclass.h Sun Mar 18 03:27:02 2007
@@ -1,8 +1,23 @@
 #include <ntifs.h>
 #include <kbdmou.h>
 #include <ntddkbd.h>
-#include <pseh/pseh.h>
 #include <stdio.h>
+
+#if defined(__GNUC__)
+  #include <pseh/pseh.h>
+  #include <debug.h>
+#elif defined(_MSC_VER)
+  #define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
+  #define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
+  #define DPRINT
+  #define CHECKPOINT
+  #define _SEH_TRY __try
+  #define _SEH_HANDLE __except(1)
+  #define _SEH_END
+  #define _SEH_GetExceptionCode() GetExceptionCode()
+#else
+  #error Unknown compiler!
+#endif
 #define MAX_PATH 260
@@ -56,7 +71,7 @@
        KSPIN_LOCK ListSpinLock;
        KSPIN_LOCK SpinLock;
        BOOLEAN ReadIsPending;
-       ULONG InputCount;
+       SIZE_T InputCount;
        PKEYBOARD_INPUT_DATA PortData;
        LPCWSTR DeviceName;
 } CLASS_DEVICE_EXTENSION, *PCLASS_DEVICE_EXTENSION;
@@ -72,3 +87,9 @@
 ForwardIrpAndForget(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp);
+
+NTSTATUS
+DuplicateUnicodeString(
+       IN ULONG Flags,
+       IN PCUNICODE_STRING SourceString,
+       OUT PUNICODE_STRING DestinationString);
Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/kbdclass/kbd…
==============================================================================
--- trunk/reactos/drivers/input/kbdclass/kbdclass.rbuild (original)
+++ trunk/reactos/drivers/input/kbdclass/kbdclass.rbuild Sun Mar 18 03:27:02 2007
@@ -1,6 +1,7 @@
 <module name="kbdclass" type="kernelmodedriver"
installbase="system32/drivers" installname="kbdclass.sys">
        <bootstrap base="reactos" />
        <define name="__USE_W32API" />
+       <define name="NDEBUG" />
        <library>pseh</library>
        <library>ntoskrnl</library>
        <library>hal</library>
Modified: trunk/reactos/drivers/input/kbdclass/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/kbdclass/mis…
==============================================================================
--- trunk/reactos/drivers/input/kbdclass/misc.c (original)
+++ trunk/reactos/drivers/input/kbdclass/misc.c Sun Mar 18 03:27:02 2007
@@ -6,9 +6,6 @@
  *
  * PROGRAMMERS:     Hervé Poussineau (hpoussin(a)reactos.org)
  */
-
-#define NDEBUG
-#include <debug.h>
 #include "kbdclass.h"
@@ -65,3 +62,48 @@
        IoSkipCurrentIrpStackLocation(Irp);
        return IoCallDriver(LowerDevice, Irp);
 }
+
+NTSTATUS
+DuplicateUnicodeString(
+       IN ULONG Flags,
+       IN PCUNICODE_STRING SourceString,
+       OUT PUNICODE_STRING DestinationString)
+{
+       if (SourceString == NULL || DestinationString == NULL
+        || SourceString->Length > SourceString->MaximumLength
+        || (SourceString->Length == 0 && SourceString->MaximumLength > 0
&& SourceString->Buffer == NULL)
+        || Flags == RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING || Flags >= 4)
+       {
+               return STATUS_INVALID_PARAMETER;
+       }
+
+
+       if ((SourceString->Length == 0)
+        && (Flags != (RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE |
+                      RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING)))
+       {
+               DestinationString->Length = 0;
+               DestinationString->MaximumLength = 0;
+               DestinationString->Buffer = NULL;
+       }
+       else
+       {
+               USHORT DestMaxLength = SourceString->Length;
+
+               if (Flags & RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE)
+                       DestMaxLength += sizeof(UNICODE_NULL);
+
+               DestinationString->Buffer = ExAllocatePool(PagedPool, DestMaxLength);
+               if (DestinationString->Buffer == NULL)
+                       return STATUS_NO_MEMORY;
+
+               RtlCopyMemory(DestinationString->Buffer, SourceString->Buffer,
SourceString->Length);
+               DestinationString->Length = SourceString->Length;
+               DestinationString->MaximumLength = DestMaxLength;
+
+               if (Flags & RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE)
+                       DestinationString->Buffer[DestinationString->Length /
sizeof(WCHAR)] = 0;
+       }
+
+       return STATUS_SUCCESS;
+}
Modified: trunk/reactos/drivers/input/mouclass/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/mouclass/mis…
==============================================================================
--- trunk/reactos/drivers/input/mouclass/misc.c (original)
+++ trunk/reactos/drivers/input/mouclass/misc.c Sun Mar 18 03:27:02 2007
@@ -6,9 +6,6 @@
  *
  * PROGRAMMERS:     Hervé Poussineau (hpoussin(a)reactos.org)
  */
-
-#define NDEBUG
-#include <debug.h>
 #include "mouclass.h"
@@ -65,3 +62,48 @@
        IoSkipCurrentIrpStackLocation(Irp);
        return IoCallDriver(LowerDevice, Irp);
 }
+
+NTSTATUS
+DuplicateUnicodeString(
+       IN ULONG Flags,
+       IN PCUNICODE_STRING SourceString,
+       OUT PUNICODE_STRING DestinationString)
+{
+       if (SourceString == NULL || DestinationString == NULL
+        || SourceString->Length > SourceString->MaximumLength
+        || (SourceString->Length == 0 && SourceString->MaximumLength > 0
&& SourceString->Buffer == NULL)
+        || Flags == RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING || Flags >= 4)
+       {
+               return STATUS_INVALID_PARAMETER;
+       }
+
+
+       if ((SourceString->Length == 0)
+        && (Flags != (RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE |
+                      RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING)))
+       {
+               DestinationString->Length = 0;
+               DestinationString->MaximumLength = 0;
+               DestinationString->Buffer = NULL;
+       }
+       else
+       {
+               USHORT DestMaxLength = SourceString->Length;
+
+               if (Flags & RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE)
+                       DestMaxLength += sizeof(UNICODE_NULL);
+
+               DestinationString->Buffer = ExAllocatePool(PagedPool, DestMaxLength);
+               if (DestinationString->Buffer == NULL)
+                       return STATUS_NO_MEMORY;
+
+               RtlCopyMemory(DestinationString->Buffer, SourceString->Buffer,
SourceString->Length);
+               DestinationString->Length = SourceString->Length;
+               DestinationString->MaximumLength = DestMaxLength;
+
+               if (Flags & RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE)
+                       DestinationString->Buffer[DestinationString->Length /
sizeof(WCHAR)] = 0;
+       }
+
+       return STATUS_SUCCESS;
+}
Modified: trunk/reactos/drivers/input/mouclass/mouclass.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/mouclass/mou…
==============================================================================
--- trunk/reactos/drivers/input/mouclass/mouclass.c (original)
+++ trunk/reactos/drivers/input/mouclass/mouclass.c Sun Mar 18 03:27:02 2007
@@ -6,9 +6,6 @@
  *
  * PROGRAMMERS:     Hervé Poussineau (hpoussin(a)reactos.org)
  */
-
-#define NDEBUG
-#include <debug.h>
 #define INITGUID
 #include "mouclass.h"
@@ -305,7 +302,7 @@
        DeviceIdW = &DeviceNameU.Buffer[PrefixLength / sizeof(WCHAR)];
        while (DeviceId < 9999)
        {
-               DeviceNameU.Length = PrefixLength + swprintf(DeviceIdW, L"%lu",
DeviceId) * sizeof(WCHAR);
+               DeviceNameU.Length = (USHORT)(PrefixLength + swprintf(DeviceIdW,
L"%lu", DeviceId) * sizeof(WCHAR));
                Status = IoCreateDevice(
                        DriverObject,
                        sizeof(CLASS_DEVICE_EXTENSION),
@@ -414,7 +411,7 @@
        return Status;
 }
-static BOOLEAN CALLBACK
+static BOOLEAN NTAPI
 ClassCallback(
        IN PDEVICE_OBJECT ClassDeviceObject,
        IN OUT PMOUSE_INPUT_DATA DataStart,
@@ -424,8 +421,8 @@
        PCLASS_DEVICE_EXTENSION ClassDeviceExtension =
ClassDeviceObject->DeviceExtension;
        PIRP Irp = NULL;
        KIRQL OldIrql;
-       ULONG InputCount = DataEnd - DataStart;
-       ULONG ReadSize;
+       SIZE_T InputCount = DataEnd - DataStart;
+       SIZE_T ReadSize;
        ASSERT(ClassDeviceExtension->Common.IsClassDO);
@@ -465,7 +462,7 @@
                        /* Skip the packet we just sent away */
                        DataStart += NumberOfEntries;
-                       (*ConsumedCount) += NumberOfEntries;
+                       (*ConsumedCount) += (ULONG)NumberOfEntries;
                        InputCount -= NumberOfEntries;
                }
        }
@@ -496,7 +493,7 @@
                /* Move the counter up */
                ClassDeviceExtension->InputCount += ReadSize;
-               (*ConsumedCount) += ReadSize;
+               (*ConsumedCount) += (ULONG)ReadSize;
        }
        else
        {
@@ -803,13 +800,13 @@
        DriverExtension = (PCLASS_DRIVER_EXTENSION)Context;
        /* Create port base name, by replacing Class by Port at the end of the class base
name */
-       Status = RtlDuplicateUnicodeString(
+       Status = DuplicateUnicodeString(
                RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
                &DriverExtension->DeviceBaseName,
                &PortBaseName);
        if (!NT_SUCCESS(Status))
        {
-               DPRINT("RtlDuplicateUnicodeString() failed with status
0x%08lx\n", Status);
+               DPRINT("DuplicateUnicodeString() failed with status 0x%08lx\n",
Status);
                goto cleanup;
        }
        PortBaseName.Length -= (sizeof(L"Class") - sizeof(UNICODE_NULL));
@@ -862,7 +859,7 @@
                PDEVICE_OBJECT PortDeviceObject = NULL;
                PFILE_OBJECT FileObject = NULL;
-               PortName.Length = PortName.MaximumLength =
KeyValueInformation->NameLength;
+               PortName.Length = PortName.MaximumLength =
(USHORT)KeyValueInformation->NameLength;
                PortName.Buffer = KeyValueInformation->Name;
                /* Open the device object pointer */
@@ -915,13 +912,13 @@
        }
        RtlZeroMemory(DriverExtension, sizeof(CLASS_DRIVER_EXTENSION));
-       Status = RtlDuplicateUnicodeString(
+       Status = DuplicateUnicodeString(
                RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
                RegistryPath,
                &DriverExtension->RegistryPath);
        if (!NT_SUCCESS(Status))
        {
-               DPRINT("RtlDuplicateUnicodeString() failed with status
0x%08lx\n", Status);
+               DPRINT("DuplicateUnicodeString() failed with status 0x%08lx\n",
Status);
                return Status;
        }
Modified: trunk/reactos/drivers/input/mouclass/mouclass.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/mouclass/mou…
==============================================================================
--- trunk/reactos/drivers/input/mouclass/mouclass.h (original)
+++ trunk/reactos/drivers/input/mouclass/mouclass.h Sun Mar 18 03:27:02 2007
@@ -1,8 +1,23 @@
 #include <ntifs.h>
 #include <kbdmou.h>
-#include <ntddmou.h>
-#include <pseh/pseh.h>
+#include <ntddkbd.h>
 #include <stdio.h>
+
+#if defined(__GNUC__)
+  #include <pseh/pseh.h>
+  #include <debug.h>
+#elif defined(_MSC_VER)
+  #define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
+  #define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
+  #define DPRINT
+  #define CHECKPOINT
+  #define _SEH_TRY __try
+  #define _SEH_HANDLE __except(1)
+  #define _SEH_END
+  #define _SEH_GetExceptionCode() GetExceptionCode()
+#else
+  #error Unknown compiler!
+#endif
 #define MAX_PATH 260
@@ -56,7 +71,7 @@
        KSPIN_LOCK ListSpinLock;
        KSPIN_LOCK SpinLock;
        BOOLEAN ReadIsPending;
-       ULONG InputCount;
+       SIZE_T InputCount;
        PMOUSE_INPUT_DATA PortData;
        LPCWSTR DeviceName;
 } CLASS_DEVICE_EXTENSION, *PCLASS_DEVICE_EXTENSION;
@@ -72,3 +87,9 @@
 ForwardIrpAndForget(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp);
+
+NTSTATUS
+DuplicateUnicodeString(
+       IN ULONG Flags,
+       IN PCUNICODE_STRING SourceString,
+       OUT PUNICODE_STRING DestinationString);
Modified: trunk/reactos/drivers/input/mouclass/mouclass.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/mouclass/mou…
==============================================================================
--- trunk/reactos/drivers/input/mouclass/mouclass.rbuild (original)
+++ trunk/reactos/drivers/input/mouclass/mouclass.rbuild Sun Mar 18 03:27:02 2007
@@ -1,6 +1,7 @@
 <module name="mouclass" type="kernelmodedriver"
installbase="system32/drivers" installname="mouclass.sys">
        <include base="mouclass">.</include>
        <define name="__USE_W32API" />
+       <define name="NDEBUG" />
        <library>pseh</library>
        <library>ntoskrnl</library>
        <library>hal</library>
Modified: trunk/reactos/drivers/input/sermouse/createclose.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/sermouse/cre…
==============================================================================
--- trunk/reactos/drivers/input/sermouse/createclose.c (original)
+++ trunk/reactos/drivers/input/sermouse/createclose.c Sun Mar 18 03:27:02 2007
@@ -5,9 +5,6 @@
  * PURPOSE:     IRP_MJ_CREATE and IRP_MJ_CLOSE operations
  * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin(a)reactos.org)
  */
-
-#define NDEBUG
-#include <debug.h>
 #include "sermouse.h"
Modified: trunk/reactos/drivers/input/sermouse/detect.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/sermouse/det…
==============================================================================
--- trunk/reactos/drivers/input/sermouse/detect.c (original)
+++ trunk/reactos/drivers/input/sermouse/detect.c Sun Mar 18 03:27:02 2007
@@ -8,9 +8,6 @@
                 Copyright 2005-2006 Hervé Poussineau (hpoussin(a)reactos.org)
  */
-#define NDEBUG
-#include <debug.h>
-
 #include "sermouse.h"
 /* Most of this file is ripped from reactos/drivers/bus/serenum/detect.c */
@@ -20,9 +17,9 @@
        IN PDEVICE_OBJECT DeviceObject,
        IN ULONG CtlCode,
        IN PVOID InputBuffer OPTIONAL,
-       IN ULONG_PTR InputBufferSize,
+       IN SIZE_T InputBufferSize,
        IN OUT PVOID OutputBuffer OPTIONAL,
-       IN OUT PULONG_PTR OutputBufferSize)
+       IN OUT PSIZE_T OutputBufferSize)
 {
        KEVENT Event;
        PIRP Irp;
@@ -34,9 +31,9 @@
        Irp = IoBuildDeviceIoControlRequest(CtlCode,
                DeviceObject,
                InputBuffer,
-               InputBufferSize,
+               (ULONG)InputBufferSize,
                OutputBuffer,
-               (OutputBufferSize) ? *OutputBufferSize : 0,
+               (OutputBufferSize) ? (ULONG)*OutputBufferSize : 0,
                FALSE,
                &Event,
                &IoStatus);
@@ -57,7 +54,7 @@
        if (OutputBufferSize)
        {
-               *OutputBufferSize = IoStatus.Information;
+               *OutputBufferSize = (SIZE_T)IoStatus.Information;
        }
        return Status;
Modified: trunk/reactos/drivers/input/sermouse/fdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/sermouse/fdo…
==============================================================================
--- trunk/reactos/drivers/input/sermouse/fdo.c (original)
+++ trunk/reactos/drivers/input/sermouse/fdo.c Sun Mar 18 03:27:02 2007
@@ -5,9 +5,6 @@
  * PURPOSE:     IRP_MJ_PNP operations for FDOs
  * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin(a)reactos.org)
  */
-
-#define NDEBUG
-#include <debug.h>
 #include "sermouse.h"
Modified: trunk/reactos/drivers/input/sermouse/internaldevctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/sermouse/int…
==============================================================================
--- trunk/reactos/drivers/input/sermouse/internaldevctl.c (original)
+++ trunk/reactos/drivers/input/sermouse/internaldevctl.c Sun Mar 18 03:27:02 2007
@@ -5,9 +5,6 @@
  * PURPOSE:     IRP_MJ_INTERNAL_DEVICE_CONTROL operations
  * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin(a)reactos.org)
  */
-
-#define NDEBUG
-#include <debug.h>
 #include "sermouse.h"
Modified: trunk/reactos/drivers/input/sermouse/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/sermouse/mis…
==============================================================================
--- trunk/reactos/drivers/input/sermouse/misc.c (original)
+++ trunk/reactos/drivers/input/sermouse/misc.c Sun Mar 18 03:27:02 2007
@@ -6,10 +6,9 @@
  * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin(a)reactos.org)
  */
-#define NDEBUG
-#include <debug.h>
+#include "sermouse.h"
-#include "sermouse.h"
+static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion;
 static NTSTATUS NTAPI
 ForwardIrpAndWaitCompletion(
@@ -34,7 +33,7 @@
        KeInitializeEvent(&Event, NotificationEvent, FALSE);
        IoCopyCurrentIrpStackLocationToNext(Irp);
-       DPRINT("Calling lower device %p [%wZ]\n", LowerDevice,
&LowerDevice->DriverObject->DriverName);
+       DPRINT("Calling lower device %p\n", LowerDevice);
        IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE,
TRUE);
        Status = IoCallDriver(LowerDevice, Irp);
Modified: trunk/reactos/drivers/input/sermouse/readmouse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/sermouse/rea…
==============================================================================
--- trunk/reactos/drivers/input/sermouse/readmouse.c (original)
+++ trunk/reactos/drivers/input/sermouse/readmouse.c Sun Mar 18 03:27:02 2007
@@ -7,9 +7,6 @@
                 Copyright Filip Navara (xnavara(a)volny.cz)
                 Copyright 2005-2006 Hervé Poussineau (hpoussin(a)reactos.org)
  */
-
-#define NDEBUG
-#include <debug.h>
 #include "sermouse.h"
@@ -55,7 +52,7 @@
        if (OutputBufferSize)
        {
-               *OutputBufferSize = IoStatus.Information;
+               *OutputBufferSize = (ULONG)IoStatus.Information;
        }
        return Status;
@@ -126,6 +123,7 @@
        if (!NT_SUCCESS(Status)) PsTerminateSystemThread(Status);
        /* main read loop */
+       RtlZeroMemory(Buffer, PACKET_BUFFER_SIZE);
        while (TRUE)
        {
                Status = KeWaitForSingleObject(
Modified: trunk/reactos/drivers/input/sermouse/sermouse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/sermouse/ser…
==============================================================================
--- trunk/reactos/drivers/input/sermouse/sermouse.c (original)
+++ trunk/reactos/drivers/input/sermouse/sermouse.c Sun Mar 18 03:27:02 2007
@@ -6,19 +6,20 @@
  * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin(a)reactos.org)
  */
-#define NDEBUG
-#include <debug.h>
-
 #define INITGUID
 #include "sermouse.h"
-VOID NTAPI
+static DRIVER_UNLOAD DriverUnload;
+static DRIVER_DISPATCH IrpStub;
+DRIVER_INITIALIZE DriverEntry;
+
+static VOID NTAPI
 DriverUnload(IN PDRIVER_OBJECT DriverObject)
 {
        // nothing to do here yet
 }
-NTSTATUS NTAPI
+static NTSTATUS NTAPI
 IrpStub(
        IN PDEVICE_OBJECT DeviceObject,
        IN PIRP Irp)
@@ -75,10 +76,11 @@
        else if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
        {
                /* Registry path doesn't exist. Set defaults */
-               DriverExtension->NumberOfButtons = DefaultNumberOfButtons;
+               DriverExtension->NumberOfButtons = (USHORT)DefaultNumberOfButtons;
                Status = STATUS_SUCCESS;
        }
+       ExFreePool(ParametersRegistryKey.Buffer);
        return Status;
 }
Modified: trunk/reactos/drivers/input/sermouse/sermouse.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/sermouse/ser…
==============================================================================
--- trunk/reactos/drivers/input/sermouse/sermouse.h (original)
+++ trunk/reactos/drivers/input/sermouse/sermouse.h Sun Mar 18 03:27:02 2007
@@ -3,13 +3,15 @@
 #include <ntddser.h>
 #include <ntddmou.h>
-#if defined(_MSC_VER)
-  /* Missing prototype */
-  NTSTATUS NTAPI
-  IoAttachDeviceToDeviceStackSafe(
-    IN PDEVICE_OBJECT SourceDevice,
-    IN PDEVICE_OBJECT TargetDevice,
-    OUT PDEVICE_OBJECT *AttachedToDeviceObject);
+#if defined(__GNUC__)
+  #include <debug.h>
+#elif defined(_MSC_VER)
+  #define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
+  #define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
+  #define DPRINT
+  #define CHECKPOINT
+#else
+  #error Unknown compiler!
 #endif
 typedef enum
@@ -79,20 +81,11 @@
 /************************************ createclose.c */
-NTSTATUS NTAPI
-SermouseCreate(
-       IN PDEVICE_OBJECT DeviceObject,
-       IN PIRP Irp);
+DRIVER_DISPATCH SermouseCreate;
-NTSTATUS NTAPI
-SermouseClose(
-       IN PDEVICE_OBJECT DeviceObject,
-       IN PIRP Irp);
+DRIVER_DISPATCH SermouseClose;
-NTSTATUS NTAPI
-SermouseCleanup(
-       IN PDEVICE_OBJECT DeviceObject,
-       IN PIRP Irp);
+DRIVER_DISPATCH SermouseCleanup;
 /************************************ detect.c */
@@ -102,22 +95,13 @@
 /************************************ fdo.c */
-NTSTATUS NTAPI
-SermouseAddDevice(
-       IN PDRIVER_OBJECT DriverObject,
-       IN PDEVICE_OBJECT Pdo);
+DRIVER_ADD_DEVICE SermouseAddDevice;
-NTSTATUS NTAPI
-SermousePnp(
-       IN PDEVICE_OBJECT DeviceObject,
-       IN PIRP Irp);
+DRIVER_DISPATCH SermousePnp;
 /************************************ internaldevctl.c */
-NTSTATUS NTAPI
-SermouseInternalDeviceControl(
-       IN PDEVICE_OBJECT DeviceObject,
-       IN PIRP Irp);
+DRIVER_DISPATCH SermouseInternalDeviceControl;
 /************************************ misc.c */