mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 12:45:16 +00:00
Fix warnings
svn path=/trunk/; revision=26128
This commit is contained in:
parent
2d8e002457
commit
0423e310b2
|
@ -7,9 +7,6 @@
|
||||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
|
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#define INITGUID
|
#define INITGUID
|
||||||
#include "kbdclass.h"
|
#include "kbdclass.h"
|
||||||
|
|
||||||
|
@ -328,7 +325,7 @@ CreateClassDeviceObject(
|
||||||
DeviceIdW = &DeviceNameU.Buffer[PrefixLength / sizeof(WCHAR)];
|
DeviceIdW = &DeviceNameU.Buffer[PrefixLength / sizeof(WCHAR)];
|
||||||
while (DeviceId < 9999)
|
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(
|
Status = IoCreateDevice(
|
||||||
DriverObject,
|
DriverObject,
|
||||||
sizeof(CLASS_DEVICE_EXTENSION),
|
sizeof(CLASS_DEVICE_EXTENSION),
|
||||||
|
@ -438,7 +435,7 @@ FillEntries(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOLEAN CALLBACK
|
static BOOLEAN NTAPI
|
||||||
ClassCallback(
|
ClassCallback(
|
||||||
IN PDEVICE_OBJECT ClassDeviceObject,
|
IN PDEVICE_OBJECT ClassDeviceObject,
|
||||||
IN OUT PKEYBOARD_INPUT_DATA DataStart,
|
IN OUT PKEYBOARD_INPUT_DATA DataStart,
|
||||||
|
@ -448,8 +445,8 @@ ClassCallback(
|
||||||
PCLASS_DEVICE_EXTENSION ClassDeviceExtension = ClassDeviceObject->DeviceExtension;
|
PCLASS_DEVICE_EXTENSION ClassDeviceExtension = ClassDeviceObject->DeviceExtension;
|
||||||
PIRP Irp = NULL;
|
PIRP Irp = NULL;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
ULONG InputCount = DataEnd - DataStart;
|
SIZE_T InputCount = DataEnd - DataStart;
|
||||||
ULONG ReadSize;
|
SIZE_T ReadSize;
|
||||||
|
|
||||||
ASSERT(ClassDeviceExtension->Common.IsClassDO);
|
ASSERT(ClassDeviceExtension->Common.IsClassDO);
|
||||||
|
|
||||||
|
@ -489,7 +486,7 @@ ClassCallback(
|
||||||
|
|
||||||
/* Skip the packet we just sent away */
|
/* Skip the packet we just sent away */
|
||||||
DataStart += NumberOfEntries;
|
DataStart += NumberOfEntries;
|
||||||
(*ConsumedCount) += NumberOfEntries;
|
(*ConsumedCount) += (ULONG)NumberOfEntries;
|
||||||
InputCount -= NumberOfEntries;
|
InputCount -= NumberOfEntries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -520,7 +517,7 @@ ClassCallback(
|
||||||
/* Move the counter up */
|
/* Move the counter up */
|
||||||
ClassDeviceExtension->InputCount += ReadSize;
|
ClassDeviceExtension->InputCount += ReadSize;
|
||||||
|
|
||||||
(*ConsumedCount) += ReadSize;
|
(*ConsumedCount) += (ULONG)ReadSize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -827,13 +824,13 @@ SearchForLegacyDrivers(
|
||||||
DriverExtension = (PCLASS_DRIVER_EXTENSION)Context;
|
DriverExtension = (PCLASS_DRIVER_EXTENSION)Context;
|
||||||
|
|
||||||
/* Create port base name, by replacing Class by Port at the end of the class base name */
|
/* 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,
|
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||||
&DriverExtension->DeviceBaseName,
|
&DriverExtension->DeviceBaseName,
|
||||||
&PortBaseName);
|
&PortBaseName);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("RtlDuplicateUnicodeString() failed with status 0x%08lx\n", Status);
|
DPRINT("DuplicateUnicodeString() failed with status 0x%08lx\n", Status);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
PortBaseName.Length -= (sizeof(L"Class") - sizeof(UNICODE_NULL));
|
PortBaseName.Length -= (sizeof(L"Class") - sizeof(UNICODE_NULL));
|
||||||
|
@ -886,7 +883,7 @@ SearchForLegacyDrivers(
|
||||||
PDEVICE_OBJECT PortDeviceObject = NULL;
|
PDEVICE_OBJECT PortDeviceObject = NULL;
|
||||||
PFILE_OBJECT FileObject = NULL;
|
PFILE_OBJECT FileObject = NULL;
|
||||||
|
|
||||||
PortName.Length = PortName.MaximumLength = KeyValueInformation->NameLength;
|
PortName.Length = PortName.MaximumLength = (USHORT)KeyValueInformation->NameLength;
|
||||||
PortName.Buffer = KeyValueInformation->Name;
|
PortName.Buffer = KeyValueInformation->Name;
|
||||||
|
|
||||||
/* Open the device object pointer */
|
/* Open the device object pointer */
|
||||||
|
@ -939,13 +936,13 @@ DriverEntry(
|
||||||
}
|
}
|
||||||
RtlZeroMemory(DriverExtension, sizeof(CLASS_DRIVER_EXTENSION));
|
RtlZeroMemory(DriverExtension, sizeof(CLASS_DRIVER_EXTENSION));
|
||||||
|
|
||||||
Status = RtlDuplicateUnicodeString(
|
Status = DuplicateUnicodeString(
|
||||||
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||||
RegistryPath,
|
RegistryPath,
|
||||||
&DriverExtension->RegistryPath);
|
&DriverExtension->RegistryPath);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("RtlDuplicateUnicodeString() failed with status 0x%08lx\n", Status);
|
DPRINT("DuplicateUnicodeString() failed with status 0x%08lx\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,24 @@
|
||||||
#include <ntifs.h>
|
#include <ntifs.h>
|
||||||
#include <kbdmou.h>
|
#include <kbdmou.h>
|
||||||
#include <ntddkbd.h>
|
#include <ntddkbd.h>
|
||||||
#include <pseh/pseh.h>
|
|
||||||
#include <stdio.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
|
#define MAX_PATH 260
|
||||||
|
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||||
|
@ -56,7 +71,7 @@ typedef struct _CLASS_DEVICE_EXTENSION
|
||||||
KSPIN_LOCK ListSpinLock;
|
KSPIN_LOCK ListSpinLock;
|
||||||
KSPIN_LOCK SpinLock;
|
KSPIN_LOCK SpinLock;
|
||||||
BOOLEAN ReadIsPending;
|
BOOLEAN ReadIsPending;
|
||||||
ULONG InputCount;
|
SIZE_T InputCount;
|
||||||
PKEYBOARD_INPUT_DATA PortData;
|
PKEYBOARD_INPUT_DATA PortData;
|
||||||
LPCWSTR DeviceName;
|
LPCWSTR DeviceName;
|
||||||
} CLASS_DEVICE_EXTENSION, *PCLASS_DEVICE_EXTENSION;
|
} CLASS_DEVICE_EXTENSION, *PCLASS_DEVICE_EXTENSION;
|
||||||
|
@ -72,3 +87,9 @@ NTSTATUS NTAPI
|
||||||
ForwardIrpAndForget(
|
ForwardIrpAndForget(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp);
|
IN PIRP Irp);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
DuplicateUnicodeString(
|
||||||
|
IN ULONG Flags,
|
||||||
|
IN PCUNICODE_STRING SourceString,
|
||||||
|
OUT PUNICODE_STRING DestinationString);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<module name="kbdclass" type="kernelmodedriver" installbase="system32/drivers" installname="kbdclass.sys">
|
<module name="kbdclass" type="kernelmodedriver" installbase="system32/drivers" installname="kbdclass.sys">
|
||||||
<bootstrap base="reactos" />
|
<bootstrap base="reactos" />
|
||||||
<define name="__USE_W32API" />
|
<define name="__USE_W32API" />
|
||||||
|
<define name="NDEBUG" />
|
||||||
<library>pseh</library>
|
<library>pseh</library>
|
||||||
<library>ntoskrnl</library>
|
<library>ntoskrnl</library>
|
||||||
<library>hal</library>
|
<library>hal</library>
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
|
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include "kbdclass.h"
|
#include "kbdclass.h"
|
||||||
|
|
||||||
static NTSTATUS NTAPI
|
static NTSTATUS NTAPI
|
||||||
|
@ -65,3 +62,48 @@ ForwardIrpAndForget(
|
||||||
IoSkipCurrentIrpStackLocation(Irp);
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
return IoCallDriver(LowerDevice, 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;
|
||||||
|
}
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
|
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include "mouclass.h"
|
#include "mouclass.h"
|
||||||
|
|
||||||
static NTSTATUS NTAPI
|
static NTSTATUS NTAPI
|
||||||
|
@ -65,3 +62,48 @@ ForwardIrpAndForget(
|
||||||
IoSkipCurrentIrpStackLocation(Irp);
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
return IoCallDriver(LowerDevice, 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;
|
||||||
|
}
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
|
* PROGRAMMERS: Hervé Poussineau (hpoussin@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#define INITGUID
|
#define INITGUID
|
||||||
#include "mouclass.h"
|
#include "mouclass.h"
|
||||||
|
|
||||||
|
@ -305,7 +302,7 @@ CreateClassDeviceObject(
|
||||||
DeviceIdW = &DeviceNameU.Buffer[PrefixLength / sizeof(WCHAR)];
|
DeviceIdW = &DeviceNameU.Buffer[PrefixLength / sizeof(WCHAR)];
|
||||||
while (DeviceId < 9999)
|
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(
|
Status = IoCreateDevice(
|
||||||
DriverObject,
|
DriverObject,
|
||||||
sizeof(CLASS_DEVICE_EXTENSION),
|
sizeof(CLASS_DEVICE_EXTENSION),
|
||||||
|
@ -414,7 +411,7 @@ FillEntries(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOLEAN CALLBACK
|
static BOOLEAN NTAPI
|
||||||
ClassCallback(
|
ClassCallback(
|
||||||
IN PDEVICE_OBJECT ClassDeviceObject,
|
IN PDEVICE_OBJECT ClassDeviceObject,
|
||||||
IN OUT PMOUSE_INPUT_DATA DataStart,
|
IN OUT PMOUSE_INPUT_DATA DataStart,
|
||||||
|
@ -424,8 +421,8 @@ ClassCallback(
|
||||||
PCLASS_DEVICE_EXTENSION ClassDeviceExtension = ClassDeviceObject->DeviceExtension;
|
PCLASS_DEVICE_EXTENSION ClassDeviceExtension = ClassDeviceObject->DeviceExtension;
|
||||||
PIRP Irp = NULL;
|
PIRP Irp = NULL;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
ULONG InputCount = DataEnd - DataStart;
|
SIZE_T InputCount = DataEnd - DataStart;
|
||||||
ULONG ReadSize;
|
SIZE_T ReadSize;
|
||||||
|
|
||||||
ASSERT(ClassDeviceExtension->Common.IsClassDO);
|
ASSERT(ClassDeviceExtension->Common.IsClassDO);
|
||||||
|
|
||||||
|
@ -465,7 +462,7 @@ ClassCallback(
|
||||||
|
|
||||||
/* Skip the packet we just sent away */
|
/* Skip the packet we just sent away */
|
||||||
DataStart += NumberOfEntries;
|
DataStart += NumberOfEntries;
|
||||||
(*ConsumedCount) += NumberOfEntries;
|
(*ConsumedCount) += (ULONG)NumberOfEntries;
|
||||||
InputCount -= NumberOfEntries;
|
InputCount -= NumberOfEntries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -496,7 +493,7 @@ ClassCallback(
|
||||||
/* Move the counter up */
|
/* Move the counter up */
|
||||||
ClassDeviceExtension->InputCount += ReadSize;
|
ClassDeviceExtension->InputCount += ReadSize;
|
||||||
|
|
||||||
(*ConsumedCount) += ReadSize;
|
(*ConsumedCount) += (ULONG)ReadSize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -803,13 +800,13 @@ SearchForLegacyDrivers(
|
||||||
DriverExtension = (PCLASS_DRIVER_EXTENSION)Context;
|
DriverExtension = (PCLASS_DRIVER_EXTENSION)Context;
|
||||||
|
|
||||||
/* Create port base name, by replacing Class by Port at the end of the class base name */
|
/* 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,
|
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||||
&DriverExtension->DeviceBaseName,
|
&DriverExtension->DeviceBaseName,
|
||||||
&PortBaseName);
|
&PortBaseName);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("RtlDuplicateUnicodeString() failed with status 0x%08lx\n", Status);
|
DPRINT("DuplicateUnicodeString() failed with status 0x%08lx\n", Status);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
PortBaseName.Length -= (sizeof(L"Class") - sizeof(UNICODE_NULL));
|
PortBaseName.Length -= (sizeof(L"Class") - sizeof(UNICODE_NULL));
|
||||||
|
@ -862,7 +859,7 @@ SearchForLegacyDrivers(
|
||||||
PDEVICE_OBJECT PortDeviceObject = NULL;
|
PDEVICE_OBJECT PortDeviceObject = NULL;
|
||||||
PFILE_OBJECT FileObject = NULL;
|
PFILE_OBJECT FileObject = NULL;
|
||||||
|
|
||||||
PortName.Length = PortName.MaximumLength = KeyValueInformation->NameLength;
|
PortName.Length = PortName.MaximumLength = (USHORT)KeyValueInformation->NameLength;
|
||||||
PortName.Buffer = KeyValueInformation->Name;
|
PortName.Buffer = KeyValueInformation->Name;
|
||||||
|
|
||||||
/* Open the device object pointer */
|
/* Open the device object pointer */
|
||||||
|
@ -915,13 +912,13 @@ DriverEntry(
|
||||||
}
|
}
|
||||||
RtlZeroMemory(DriverExtension, sizeof(CLASS_DRIVER_EXTENSION));
|
RtlZeroMemory(DriverExtension, sizeof(CLASS_DRIVER_EXTENSION));
|
||||||
|
|
||||||
Status = RtlDuplicateUnicodeString(
|
Status = DuplicateUnicodeString(
|
||||||
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||||
RegistryPath,
|
RegistryPath,
|
||||||
&DriverExtension->RegistryPath);
|
&DriverExtension->RegistryPath);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("RtlDuplicateUnicodeString() failed with status 0x%08lx\n", Status);
|
DPRINT("DuplicateUnicodeString() failed with status 0x%08lx\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,24 @@
|
||||||
#include <ntifs.h>
|
#include <ntifs.h>
|
||||||
#include <kbdmou.h>
|
#include <kbdmou.h>
|
||||||
#include <ntddmou.h>
|
#include <ntddkbd.h>
|
||||||
#include <pseh/pseh.h>
|
|
||||||
#include <stdio.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
|
#define MAX_PATH 260
|
||||||
|
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||||
|
@ -56,7 +71,7 @@ typedef struct _CLASS_DEVICE_EXTENSION
|
||||||
KSPIN_LOCK ListSpinLock;
|
KSPIN_LOCK ListSpinLock;
|
||||||
KSPIN_LOCK SpinLock;
|
KSPIN_LOCK SpinLock;
|
||||||
BOOLEAN ReadIsPending;
|
BOOLEAN ReadIsPending;
|
||||||
ULONG InputCount;
|
SIZE_T InputCount;
|
||||||
PMOUSE_INPUT_DATA PortData;
|
PMOUSE_INPUT_DATA PortData;
|
||||||
LPCWSTR DeviceName;
|
LPCWSTR DeviceName;
|
||||||
} CLASS_DEVICE_EXTENSION, *PCLASS_DEVICE_EXTENSION;
|
} CLASS_DEVICE_EXTENSION, *PCLASS_DEVICE_EXTENSION;
|
||||||
|
@ -72,3 +87,9 @@ NTSTATUS NTAPI
|
||||||
ForwardIrpAndForget(
|
ForwardIrpAndForget(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp);
|
IN PIRP Irp);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
DuplicateUnicodeString(
|
||||||
|
IN ULONG Flags,
|
||||||
|
IN PCUNICODE_STRING SourceString,
|
||||||
|
OUT PUNICODE_STRING DestinationString);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<module name="mouclass" type="kernelmodedriver" installbase="system32/drivers" installname="mouclass.sys">
|
<module name="mouclass" type="kernelmodedriver" installbase="system32/drivers" installname="mouclass.sys">
|
||||||
<include base="mouclass">.</include>
|
<include base="mouclass">.</include>
|
||||||
<define name="__USE_W32API" />
|
<define name="__USE_W32API" />
|
||||||
|
<define name="NDEBUG" />
|
||||||
<library>pseh</library>
|
<library>pseh</library>
|
||||||
<library>ntoskrnl</library>
|
<library>ntoskrnl</library>
|
||||||
<library>hal</library>
|
<library>hal</library>
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
* PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
* PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include "sermouse.h"
|
#include "sermouse.h"
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
|
|
|
@ -8,9 +8,6 @@
|
||||||
Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include "sermouse.h"
|
#include "sermouse.h"
|
||||||
|
|
||||||
/* Most of this file is ripped from reactos/drivers/bus/serenum/detect.c */
|
/* Most of this file is ripped from reactos/drivers/bus/serenum/detect.c */
|
||||||
|
@ -20,9 +17,9 @@ DeviceIoControl(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN ULONG CtlCode,
|
IN ULONG CtlCode,
|
||||||
IN PVOID InputBuffer OPTIONAL,
|
IN PVOID InputBuffer OPTIONAL,
|
||||||
IN ULONG_PTR InputBufferSize,
|
IN SIZE_T InputBufferSize,
|
||||||
IN OUT PVOID OutputBuffer OPTIONAL,
|
IN OUT PVOID OutputBuffer OPTIONAL,
|
||||||
IN OUT PULONG_PTR OutputBufferSize)
|
IN OUT PSIZE_T OutputBufferSize)
|
||||||
{
|
{
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
|
@ -34,9 +31,9 @@ DeviceIoControl(
|
||||||
Irp = IoBuildDeviceIoControlRequest(CtlCode,
|
Irp = IoBuildDeviceIoControlRequest(CtlCode,
|
||||||
DeviceObject,
|
DeviceObject,
|
||||||
InputBuffer,
|
InputBuffer,
|
||||||
InputBufferSize,
|
(ULONG)InputBufferSize,
|
||||||
OutputBuffer,
|
OutputBuffer,
|
||||||
(OutputBufferSize) ? *OutputBufferSize : 0,
|
(OutputBufferSize) ? (ULONG)*OutputBufferSize : 0,
|
||||||
FALSE,
|
FALSE,
|
||||||
&Event,
|
&Event,
|
||||||
&IoStatus);
|
&IoStatus);
|
||||||
|
@ -57,7 +54,7 @@ DeviceIoControl(
|
||||||
|
|
||||||
if (OutputBufferSize)
|
if (OutputBufferSize)
|
||||||
{
|
{
|
||||||
*OutputBufferSize = IoStatus.Information;
|
*OutputBufferSize = (SIZE_T)IoStatus.Information;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
* PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
* PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include "sermouse.h"
|
#include "sermouse.h"
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
* PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
* PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include "sermouse.h"
|
#include "sermouse.h"
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
|
|
|
@ -6,11 +6,10 @@
|
||||||
* PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
* PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include "sermouse.h"
|
#include "sermouse.h"
|
||||||
|
|
||||||
|
static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion;
|
||||||
|
|
||||||
static NTSTATUS NTAPI
|
static NTSTATUS NTAPI
|
||||||
ForwardIrpAndWaitCompletion(
|
ForwardIrpAndWaitCompletion(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
@ -34,7 +33,7 @@ ForwardIrpAndWait(
|
||||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||||
IoCopyCurrentIrpStackLocationToNext(Irp);
|
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);
|
IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
|
||||||
|
|
||||||
Status = IoCallDriver(LowerDevice, Irp);
|
Status = IoCallDriver(LowerDevice, Irp);
|
||||||
|
|
|
@ -8,9 +8,6 @@
|
||||||
Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include "sermouse.h"
|
#include "sermouse.h"
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
|
@ -55,7 +52,7 @@ SermouseDeviceIoControl(
|
||||||
|
|
||||||
if (OutputBufferSize)
|
if (OutputBufferSize)
|
||||||
{
|
{
|
||||||
*OutputBufferSize = IoStatus.Information;
|
*OutputBufferSize = (ULONG)IoStatus.Information;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -126,6 +123,7 @@ SermouseDeviceWorker(
|
||||||
if (!NT_SUCCESS(Status)) PsTerminateSystemThread(Status);
|
if (!NT_SUCCESS(Status)) PsTerminateSystemThread(Status);
|
||||||
|
|
||||||
/* main read loop */
|
/* main read loop */
|
||||||
|
RtlZeroMemory(Buffer, PACKET_BUFFER_SIZE);
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
Status = KeWaitForSingleObject(
|
Status = KeWaitForSingleObject(
|
||||||
|
|
|
@ -6,19 +6,20 @@
|
||||||
* PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
* PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#define INITGUID
|
#define INITGUID
|
||||||
#include "sermouse.h"
|
#include "sermouse.h"
|
||||||
|
|
||||||
VOID NTAPI
|
static DRIVER_UNLOAD DriverUnload;
|
||||||
|
static DRIVER_DISPATCH IrpStub;
|
||||||
|
DRIVER_INITIALIZE DriverEntry;
|
||||||
|
|
||||||
|
static VOID NTAPI
|
||||||
DriverUnload(IN PDRIVER_OBJECT DriverObject)
|
DriverUnload(IN PDRIVER_OBJECT DriverObject)
|
||||||
{
|
{
|
||||||
// nothing to do here yet
|
// nothing to do here yet
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
static NTSTATUS NTAPI
|
||||||
IrpStub(
|
IrpStub(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
|
@ -75,10 +76,11 @@ ReadRegistryEntries(
|
||||||
else if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
|
else if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
|
||||||
{
|
{
|
||||||
/* Registry path doesn't exist. Set defaults */
|
/* Registry path doesn't exist. Set defaults */
|
||||||
DriverExtension->NumberOfButtons = DefaultNumberOfButtons;
|
DriverExtension->NumberOfButtons = (USHORT)DefaultNumberOfButtons;
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExFreePool(ParametersRegistryKey.Buffer);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,15 @@
|
||||||
#include <ntddser.h>
|
#include <ntddser.h>
|
||||||
#include <ntddmou.h>
|
#include <ntddmou.h>
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(__GNUC__)
|
||||||
/* Missing prototype */
|
#include <debug.h>
|
||||||
NTSTATUS NTAPI
|
#elif defined(_MSC_VER)
|
||||||
IoAttachDeviceToDeviceStackSafe(
|
#define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
|
||||||
IN PDEVICE_OBJECT SourceDevice,
|
#define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
|
||||||
IN PDEVICE_OBJECT TargetDevice,
|
#define DPRINT
|
||||||
OUT PDEVICE_OBJECT *AttachedToDeviceObject);
|
#define CHECKPOINT
|
||||||
|
#else
|
||||||
|
#error Unknown compiler!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -79,20 +81,11 @@ typedef struct _SERMOUSE_DEVICE_EXTENSION
|
||||||
|
|
||||||
/************************************ createclose.c */
|
/************************************ createclose.c */
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
DRIVER_DISPATCH SermouseCreate;
|
||||||
SermouseCreate(
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN PIRP Irp);
|
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
DRIVER_DISPATCH SermouseClose;
|
||||||
SermouseClose(
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN PIRP Irp);
|
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
DRIVER_DISPATCH SermouseCleanup;
|
||||||
SermouseCleanup(
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN PIRP Irp);
|
|
||||||
|
|
||||||
/************************************ detect.c */
|
/************************************ detect.c */
|
||||||
|
|
||||||
|
@ -102,22 +95,13 @@ SermouseDetectLegacyDevice(
|
||||||
|
|
||||||
/************************************ fdo.c */
|
/************************************ fdo.c */
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
DRIVER_ADD_DEVICE SermouseAddDevice;
|
||||||
SermouseAddDevice(
|
|
||||||
IN PDRIVER_OBJECT DriverObject,
|
|
||||||
IN PDEVICE_OBJECT Pdo);
|
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
DRIVER_DISPATCH SermousePnp;
|
||||||
SermousePnp(
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN PIRP Irp);
|
|
||||||
|
|
||||||
/************************************ internaldevctl.c */
|
/************************************ internaldevctl.c */
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
DRIVER_DISPATCH SermouseInternalDeviceControl;
|
||||||
SermouseInternalDeviceControl(
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN PIRP Irp);
|
|
||||||
|
|
||||||
/************************************ misc.c */
|
/************************************ misc.c */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue