From 0423e310b29f24ea30351468301338eb3340743d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sun, 18 Mar 2007 00:27:02 +0000 Subject: [PATCH] Fix warnings svn path=/trunk/; revision=26128 --- reactos/drivers/input/kbdclass/kbdclass.c | 25 +++++----- reactos/drivers/input/kbdclass/kbdclass.h | 25 +++++++++- .../drivers/input/kbdclass/kbdclass.rbuild | 1 + reactos/drivers/input/kbdclass/misc.c | 48 +++++++++++++++++-- reactos/drivers/input/mouclass/misc.c | 48 +++++++++++++++++-- reactos/drivers/input/mouclass/mouclass.c | 25 +++++----- reactos/drivers/input/mouclass/mouclass.h | 27 +++++++++-- .../drivers/input/mouclass/mouclass.rbuild | 1 + reactos/drivers/input/sermouse/createclose.c | 3 -- reactos/drivers/input/sermouse/detect.c | 13 ++--- reactos/drivers/input/sermouse/fdo.c | 3 -- .../drivers/input/sermouse/internaldevctl.c | 3 -- reactos/drivers/input/sermouse/misc.c | 7 ++- reactos/drivers/input/sermouse/readmouse.c | 6 +-- reactos/drivers/input/sermouse/sermouse.c | 14 +++--- reactos/drivers/input/sermouse/sermouse.h | 46 ++++++------------ 16 files changed, 194 insertions(+), 101 deletions(-) diff --git a/reactos/drivers/input/kbdclass/kbdclass.c b/reactos/drivers/input/kbdclass/kbdclass.c index d2a32b832f0..6c8462d33e4 100644 --- a/reactos/drivers/input/kbdclass/kbdclass.c +++ b/reactos/drivers/input/kbdclass/kbdclass.c @@ -7,9 +7,6 @@ * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org) */ -#define NDEBUG -#include - #define INITGUID #include "kbdclass.h" @@ -328,7 +325,7 @@ CreateClassDeviceObject( 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 @@ FillEntries( return Status; } -static BOOLEAN CALLBACK +static BOOLEAN NTAPI ClassCallback( IN PDEVICE_OBJECT ClassDeviceObject, IN OUT PKEYBOARD_INPUT_DATA DataStart, @@ -448,8 +445,8 @@ ClassCallback( 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 @@ ClassCallback( /* Skip the packet we just sent away */ DataStart += NumberOfEntries; - (*ConsumedCount) += NumberOfEntries; + (*ConsumedCount) += (ULONG)NumberOfEntries; InputCount -= NumberOfEntries; } } @@ -520,7 +517,7 @@ ClassCallback( /* Move the counter up */ ClassDeviceExtension->InputCount += ReadSize; - (*ConsumedCount) += ReadSize; + (*ConsumedCount) += (ULONG)ReadSize; } else { @@ -827,13 +824,13 @@ SearchForLegacyDrivers( 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 @@ SearchForLegacyDrivers( 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 @@ DriverEntry( } 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; } diff --git a/reactos/drivers/input/kbdclass/kbdclass.h b/reactos/drivers/input/kbdclass/kbdclass.h index 55b025bfc69..0453d96b7f2 100644 --- a/reactos/drivers/input/kbdclass/kbdclass.h +++ b/reactos/drivers/input/kbdclass/kbdclass.h @@ -1,9 +1,24 @@ #include #include #include -#include #include +#if defined(__GNUC__) + #include + #include +#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 #define MIN(a, b) ((a) < (b) ? (a) : (b)) @@ -56,7 +71,7 @@ typedef struct _CLASS_DEVICE_EXTENSION 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 @@ NTSTATUS NTAPI ForwardIrpAndForget( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp); + +NTSTATUS +DuplicateUnicodeString( + IN ULONG Flags, + IN PCUNICODE_STRING SourceString, + OUT PUNICODE_STRING DestinationString); diff --git a/reactos/drivers/input/kbdclass/kbdclass.rbuild b/reactos/drivers/input/kbdclass/kbdclass.rbuild index 672f152621d..df0f774016d 100644 --- a/reactos/drivers/input/kbdclass/kbdclass.rbuild +++ b/reactos/drivers/input/kbdclass/kbdclass.rbuild @@ -1,6 +1,7 @@ + pseh ntoskrnl hal diff --git a/reactos/drivers/input/kbdclass/misc.c b/reactos/drivers/input/kbdclass/misc.c index cd2b57a8e1c..07b120afd17 100644 --- a/reactos/drivers/input/kbdclass/misc.c +++ b/reactos/drivers/input/kbdclass/misc.c @@ -7,9 +7,6 @@ * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org) */ -#define NDEBUG -#include - #include "kbdclass.h" static NTSTATUS NTAPI @@ -65,3 +62,48 @@ ForwardIrpAndForget( 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; +} diff --git a/reactos/drivers/input/mouclass/misc.c b/reactos/drivers/input/mouclass/misc.c index 0c8909681a4..a191e24a6e9 100644 --- a/reactos/drivers/input/mouclass/misc.c +++ b/reactos/drivers/input/mouclass/misc.c @@ -7,9 +7,6 @@ * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org) */ -#define NDEBUG -#include - #include "mouclass.h" static NTSTATUS NTAPI @@ -65,3 +62,48 @@ ForwardIrpAndForget( 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; +} diff --git a/reactos/drivers/input/mouclass/mouclass.c b/reactos/drivers/input/mouclass/mouclass.c index 7679300aba0..911499927bf 100644 --- a/reactos/drivers/input/mouclass/mouclass.c +++ b/reactos/drivers/input/mouclass/mouclass.c @@ -7,9 +7,6 @@ * PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org) */ -#define NDEBUG -#include - #define INITGUID #include "mouclass.h" @@ -305,7 +302,7 @@ CreateClassDeviceObject( 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 @@ FillEntries( return Status; } -static BOOLEAN CALLBACK +static BOOLEAN NTAPI ClassCallback( IN PDEVICE_OBJECT ClassDeviceObject, IN OUT PMOUSE_INPUT_DATA DataStart, @@ -424,8 +421,8 @@ ClassCallback( 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 @@ ClassCallback( /* Skip the packet we just sent away */ DataStart += NumberOfEntries; - (*ConsumedCount) += NumberOfEntries; + (*ConsumedCount) += (ULONG)NumberOfEntries; InputCount -= NumberOfEntries; } } @@ -496,7 +493,7 @@ ClassCallback( /* Move the counter up */ ClassDeviceExtension->InputCount += ReadSize; - (*ConsumedCount) += ReadSize; + (*ConsumedCount) += (ULONG)ReadSize; } else { @@ -803,13 +800,13 @@ SearchForLegacyDrivers( 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 @@ SearchForLegacyDrivers( 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 @@ DriverEntry( } 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; } diff --git a/reactos/drivers/input/mouclass/mouclass.h b/reactos/drivers/input/mouclass/mouclass.h index 3a95c7b1937..fd0efdcc8ed 100644 --- a/reactos/drivers/input/mouclass/mouclass.h +++ b/reactos/drivers/input/mouclass/mouclass.h @@ -1,9 +1,24 @@ #include #include -#include -#include +#include #include +#if defined(__GNUC__) + #include + #include +#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 #define MIN(a, b) ((a) < (b) ? (a) : (b)) @@ -56,7 +71,7 @@ typedef struct _CLASS_DEVICE_EXTENSION 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 @@ NTSTATUS NTAPI ForwardIrpAndForget( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp); + +NTSTATUS +DuplicateUnicodeString( + IN ULONG Flags, + IN PCUNICODE_STRING SourceString, + OUT PUNICODE_STRING DestinationString); diff --git a/reactos/drivers/input/mouclass/mouclass.rbuild b/reactos/drivers/input/mouclass/mouclass.rbuild index f72316b75c2..cea19f6cccc 100644 --- a/reactos/drivers/input/mouclass/mouclass.rbuild +++ b/reactos/drivers/input/mouclass/mouclass.rbuild @@ -1,6 +1,7 @@ . + pseh ntoskrnl hal diff --git a/reactos/drivers/input/sermouse/createclose.c b/reactos/drivers/input/sermouse/createclose.c index f1e918fa321..66e405c23e5 100644 --- a/reactos/drivers/input/sermouse/createclose.c +++ b/reactos/drivers/input/sermouse/createclose.c @@ -6,9 +6,6 @@ * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org) */ -#define NDEBUG -#include - #include "sermouse.h" NTSTATUS NTAPI diff --git a/reactos/drivers/input/sermouse/detect.c b/reactos/drivers/input/sermouse/detect.c index f8cc24c5d15..3dde32c1418 100644 --- a/reactos/drivers/input/sermouse/detect.c +++ b/reactos/drivers/input/sermouse/detect.c @@ -8,9 +8,6 @@ Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org) */ -#define NDEBUG -#include - #include "sermouse.h" /* Most of this file is ripped from reactos/drivers/bus/serenum/detect.c */ @@ -20,9 +17,9 @@ DeviceIoControl( 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 @@ DeviceIoControl( Irp = IoBuildDeviceIoControlRequest(CtlCode, DeviceObject, InputBuffer, - InputBufferSize, + (ULONG)InputBufferSize, OutputBuffer, - (OutputBufferSize) ? *OutputBufferSize : 0, + (OutputBufferSize) ? (ULONG)*OutputBufferSize : 0, FALSE, &Event, &IoStatus); @@ -57,7 +54,7 @@ DeviceIoControl( if (OutputBufferSize) { - *OutputBufferSize = IoStatus.Information; + *OutputBufferSize = (SIZE_T)IoStatus.Information; } return Status; diff --git a/reactos/drivers/input/sermouse/fdo.c b/reactos/drivers/input/sermouse/fdo.c index 90babd9a0fc..9f803368855 100644 --- a/reactos/drivers/input/sermouse/fdo.c +++ b/reactos/drivers/input/sermouse/fdo.c @@ -6,9 +6,6 @@ * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org) */ -#define NDEBUG -#include - #include "sermouse.h" NTSTATUS NTAPI diff --git a/reactos/drivers/input/sermouse/internaldevctl.c b/reactos/drivers/input/sermouse/internaldevctl.c index d5c1c269c42..5e8119306e0 100644 --- a/reactos/drivers/input/sermouse/internaldevctl.c +++ b/reactos/drivers/input/sermouse/internaldevctl.c @@ -6,9 +6,6 @@ * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org) */ -#define NDEBUG -#include - #include "sermouse.h" NTSTATUS NTAPI diff --git a/reactos/drivers/input/sermouse/misc.c b/reactos/drivers/input/sermouse/misc.c index 8afa131dc4a..bcff38b6ff6 100644 --- a/reactos/drivers/input/sermouse/misc.c +++ b/reactos/drivers/input/sermouse/misc.c @@ -6,11 +6,10 @@ * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org) */ -#define NDEBUG -#include - #include "sermouse.h" +static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion; + static NTSTATUS NTAPI ForwardIrpAndWaitCompletion( IN PDEVICE_OBJECT DeviceObject, @@ -34,7 +33,7 @@ ForwardIrpAndWait( 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); diff --git a/reactos/drivers/input/sermouse/readmouse.c b/reactos/drivers/input/sermouse/readmouse.c index f80ba1b5807..2381500531a 100644 --- a/reactos/drivers/input/sermouse/readmouse.c +++ b/reactos/drivers/input/sermouse/readmouse.c @@ -8,9 +8,6 @@ Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org) */ -#define NDEBUG -#include - #include "sermouse.h" static NTSTATUS @@ -55,7 +52,7 @@ SermouseDeviceIoControl( if (OutputBufferSize) { - *OutputBufferSize = IoStatus.Information; + *OutputBufferSize = (ULONG)IoStatus.Information; } return Status; @@ -126,6 +123,7 @@ SermouseDeviceWorker( if (!NT_SUCCESS(Status)) PsTerminateSystemThread(Status); /* main read loop */ + RtlZeroMemory(Buffer, PACKET_BUFFER_SIZE); while (TRUE) { Status = KeWaitForSingleObject( diff --git a/reactos/drivers/input/sermouse/sermouse.c b/reactos/drivers/input/sermouse/sermouse.c index 26fd2030999..c1b6596d7c4 100644 --- a/reactos/drivers/input/sermouse/sermouse.c +++ b/reactos/drivers/input/sermouse/sermouse.c @@ -6,19 +6,20 @@ * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org) */ -#define NDEBUG -#include - #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 @@ ReadRegistryEntries( 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; } diff --git a/reactos/drivers/input/sermouse/sermouse.h b/reactos/drivers/input/sermouse/sermouse.h index fa2b3163456..921cff69778 100644 --- a/reactos/drivers/input/sermouse/sermouse.h +++ b/reactos/drivers/input/sermouse/sermouse.h @@ -3,13 +3,15 @@ #include #include -#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 +#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 @@ typedef struct _SERMOUSE_DEVICE_EXTENSION /************************************ 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 @@ SermouseDetectLegacyDevice( /************************************ 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 */