mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Used the given registry path from DriverEntry to query the registry.
This will also fix the bug in I8042ReadRegistry, which has append the string to an unicode string with an uninitialized length value. svn path=/trunk/; revision=17862
This commit is contained in:
parent
cff40b3061
commit
b3f6e62113
3 changed files with 21 additions and 24 deletions
|
@ -27,6 +27,8 @@
|
|||
#define I8042_MAX_COMMAND_LENGTH 16
|
||||
#define I8042_MAX_UPWARDS_STACK 5
|
||||
|
||||
UNICODE_STRING I8042RegistryPath;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -794,6 +796,21 @@ NTSTATUS STDCALL DriverEntry(PDRIVER_OBJECT DriverObject,
|
|||
{
|
||||
DPRINT("I8042 Driver 0.0.1\n");
|
||||
|
||||
I8042RegistryPath.MaximumLength = RegistryPath->Length + sizeof(L"\\Parameters");
|
||||
I8042RegistryPath.Buffer = ExAllocatePoolWithTag(PagedPool,
|
||||
I8042RegistryPath.MaximumLength,
|
||||
TAG_I8042);
|
||||
if (I8042RegistryPath.Buffer == NULL) {
|
||||
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
RtlCopyUnicodeString(&I8042RegistryPath, RegistryPath);
|
||||
RtlAppendUnicodeToString(&I8042RegistryPath, L"\\Parameters");
|
||||
I8042RegistryPath.Buffer[I8042RegistryPath.Length / sizeof(WCHAR)] = 0;
|
||||
|
||||
|
||||
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = I8042CreateDispatch;
|
||||
DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] =
|
||||
I8042InternalDeviceControl;
|
||||
|
|
|
@ -263,6 +263,8 @@ typedef struct _I8042_HOOK_WORKITEM
|
|||
#define MOUSE_NACK 0xFE
|
||||
|
||||
/* i8042prt.c */
|
||||
extern UNICODE_STRING I8042RegistryPath;
|
||||
|
||||
NTSTATUS I8042ReadData(UCHAR *Data);
|
||||
|
||||
NTSTATUS I8042ReadStatus(UCHAR *Status);
|
||||
|
|
|
@ -30,9 +30,6 @@ VOID STDCALL I8042ReadRegistry(PDRIVER_OBJECT DriverObject,
|
|||
|
||||
{
|
||||
RTL_QUERY_REGISTRY_TABLE Parameters[19];
|
||||
UNICODE_STRING ParametersPath;
|
||||
|
||||
PWSTR RegistryPath = L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\i8042Prt\\Parameters";
|
||||
|
||||
NTSTATUS Status;
|
||||
|
||||
|
@ -55,23 +52,6 @@ VOID STDCALL I8042ReadRegistry(PDRIVER_OBJECT DriverObject,
|
|||
ULONG DefaultNumberOfButtons = 2;
|
||||
ULONG DefaultEnableWheelDetection = 1;
|
||||
|
||||
RtlInitUnicodeString(&ParametersPath, NULL);
|
||||
ParametersPath.MaximumLength = (wcslen(RegistryPath) *
|
||||
sizeof(WCHAR)) +
|
||||
sizeof(UNICODE_NULL);
|
||||
|
||||
ParametersPath.Buffer = ExAllocatePoolWithTag(PagedPool,
|
||||
ParametersPath.MaximumLength,
|
||||
TAG_I8042);
|
||||
|
||||
if (!ParametersPath.Buffer) {
|
||||
DPRINT1("No buffer space for reading registry\n");
|
||||
return;
|
||||
}
|
||||
|
||||
RtlZeroMemory(ParametersPath.Buffer, ParametersPath.MaximumLength);
|
||||
RtlAppendUnicodeToString(&ParametersPath, RegistryPath);
|
||||
|
||||
RtlZeroMemory(Parameters, sizeof(Parameters));
|
||||
|
||||
Parameters[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
||||
|
@ -202,9 +182,8 @@ VOID STDCALL I8042ReadRegistry(PDRIVER_OBJECT DriverObject,
|
|||
Parameters[17].DefaultData = &DefaultEnableWheelDetection;
|
||||
Parameters[17].DefaultLength = sizeof(ULONG);
|
||||
|
||||
Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE |
|
||||
RTL_REGISTRY_OPTIONAL,
|
||||
ParametersPath.Buffer,
|
||||
Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE | RTL_REGISTRY_OPTIONAL,
|
||||
I8042RegistryPath.Buffer,
|
||||
Parameters,
|
||||
NULL,
|
||||
NULL);
|
||||
|
@ -224,7 +203,6 @@ VOID STDCALL I8042ReadRegistry(PDRIVER_OBJECT DriverObject,
|
|||
DPRINT1 ("Manually set defaults\n");
|
||||
|
||||
}
|
||||
ExFreePoolWithTag(ParametersPath.Buffer, TAG_I8042);
|
||||
|
||||
if (DevExt->Settings.MouseResolution > 3)
|
||||
DevExt->Settings.MouseResolution = 3;
|
||||
|
|
Loading…
Reference in a new issue