ReactOS 0.4.15-dev-7659-ga55345b
sermouse.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Serial mouse driver
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/input/sermouse/fdo.c
5 * PURPOSE: Serial mouse driver entry point
6 * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
7 */
8
9#include "sermouse.h"
10
11#include <debug.h>
12
13static DRIVER_UNLOAD DriverUnload;
15DRIVER_INITIALIZE DriverEntry;
16
17static VOID NTAPI
19{
20 // nothing to do here yet
21}
22
23static NTSTATUS NTAPI
26 IN PIRP Irp)
27{
28 ERR_(SERMOUSE, "Irp stub for major function 0x%lx\n",
32}
33
34static NTSTATUS
38{
39 UNICODE_STRING ParametersRegistryKey;
42
43 ULONG DefaultNumberOfButtons = 2;
44
45 ParametersRegistryKey.Length = 0;
46 ParametersRegistryKey.MaximumLength = RegistryPath->Length + sizeof(L"\\Parameters") + sizeof(UNICODE_NULL);
47 ParametersRegistryKey.Buffer = ExAllocatePoolWithTag(PagedPool, ParametersRegistryKey.MaximumLength, SERMOUSE_TAG);
48 if (!ParametersRegistryKey.Buffer)
49 {
50 WARN_(SERMOUSE, "ExAllocatePoolWithTag() failed\n");
51 return STATUS_NO_MEMORY;
52 }
53 RtlCopyUnicodeString(&ParametersRegistryKey, RegistryPath);
54 RtlAppendUnicodeToString(&ParametersRegistryKey, L"\\Parameters");
55 ParametersRegistryKey.Buffer[ParametersRegistryKey.Length / sizeof(WCHAR)] = UNICODE_NULL;
56
58
60 Parameters[0].Name = L"NumberOfButtons";
61 Parameters[0].EntryContext = &DriverExtension->NumberOfButtons;
62 Parameters[0].DefaultType = REG_DWORD;
63 Parameters[0].DefaultData = &DefaultNumberOfButtons;
64 Parameters[0].DefaultLength = sizeof(ULONG);
65
68 ParametersRegistryKey.Buffer,
70 NULL,
71 NULL);
72
73 if (NT_SUCCESS(Status))
74 {
75 /* Check values */
76 }
78 {
79 /* Registry path doesn't exist. Set defaults */
80 DriverExtension->NumberOfButtons = (USHORT)DefaultNumberOfButtons;
82 }
83
84 ExFreePoolWithTag(ParametersRegistryKey.Buffer, SERMOUSE_TAG);
85 return Status;
86}
87
88/*
89 * Standard DriverEntry method.
90 */
95{
97 ULONG i;
99
105 if (!NT_SUCCESS(Status))
106 {
107 WARN_(SERMOUSE, "IoAllocateDriverObjectExtension() failed with status 0x%08lx\n", Status);
108 return Status;
109 }
111
113 if (!NT_SUCCESS(Status))
114 {
115 WARN_(SERMOUSE, "ReadRegistryEntries() failed with status 0x%08lx\n", Status);
116 return Status;
117 }
118
119 DriverObject->DriverUnload = DriverUnload;
120 DriverObject->DriverExtension->AddDevice = SermouseAddDevice;
121
122 for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
123 DriverObject->MajorFunction[i] = IrpStub;
124
125 DriverObject->MajorFunction[IRP_MJ_CREATE] = SermouseCreate;
126 DriverObject->MajorFunction[IRP_MJ_CLOSE] = SermouseClose;
128 //DriverObject->MajorFunction[IRP_MJ_READ] = SermouseRead;
129 //DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = SermouseDeviceControl;
131 //DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = SermouseQueryInformation;
132 DriverObject->MajorFunction[IRP_MJ_PNP] = SermousePnp;
133 //DriverObject->MajorFunction[IRP_MJ_POWER] = SermousePower;
134
135 return STATUS_SUCCESS;
136}
LONG NTSTATUS
Definition: precomp.h:26
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
#define PagedPool
Definition: env_spec_w32.h:308
Status
Definition: gdiplustypes.h:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
DRIVER_DISPATCH(nfs41_FsdDispatch)
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define RTL_REGISTRY_ABSOLUTE
Definition: nt_native.h:161
#define RTL_QUERY_REGISTRY_DIRECT
Definition: nt_native.h:144
#define RTL_REGISTRY_OPTIONAL
Definition: nt_native.h:169
#define UNICODE_NULL
NTSTATUS NTAPI IoAllocateDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress, IN ULONG DriverObjectExtensionSize, OUT PVOID *DriverObjectExtension)
Definition: driver.c:1826
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
#define L(x)
Definition: ntvdm.h:50
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:31
unsigned short USHORT
Definition: pedump.c:61
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define REG_DWORD
Definition: sdbapi.c:596
#define ERR_(ch,...)
Definition: debug.h:156
#define WARN_(ch,...)
Definition: debug.h:157
static DRIVER_DISPATCH IrpStub
Definition: sermouse.c:14
DRIVER_INITIALIZE DriverEntry
Definition: sermouse.c:15
static NTSTATUS ReadRegistryEntries(IN PUNICODE_STRING RegistryPath, IN PSERMOUSE_DRIVER_EXTENSION DriverExtension)
Definition: sermouse.c:35
static DRIVER_UNLOAD DriverUnload
Definition: sermouse.c:13
DRIVER_DISPATCH SermouseClose
Definition: sermouse.h:79
DRIVER_DISPATCH SermouseCreate
Definition: sermouse.h:77
DRIVER_DISPATCH SermouseInternalDeviceControl
Definition: sermouse.h:97
DRIVER_DISPATCH SermouseCleanup
Definition: sermouse.h:81
#define SERMOUSE_TAG
Definition: sermouse.h:8
DRIVER_DISPATCH SermousePnp
Definition: sermouse.h:93
DRIVER_ADD_DEVICE SermouseAddDevice
Definition: sermouse.h:91
#define STATUS_SUCCESS
Definition: shellext.h:65
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define NTAPI
Definition: typedefs.h:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ UCHAR MajorFunction
Definition: wdfdevice.h:1697
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:869
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
#define IRP_MJ_CLEANUP
#define IRP_MJ_MAXIMUM_FUNCTION
__wchar_t WCHAR
Definition: xmlstorage.h:180