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.
Modified: trunk/reactos/drivers/input/i8042prt/i8042prt.c
Modified: trunk/reactos/drivers/input/i8042prt/i8042prt.h
Modified: trunk/reactos/drivers/input/i8042prt/registry.c
_____
Modified: trunk/reactos/drivers/input/i8042prt/i8042prt.c
--- trunk/reactos/drivers/input/i8042prt/i8042prt.c 2005-09-15
15:57:28 UTC (rev 17861)
+++ trunk/reactos/drivers/input/i8042prt/i8042prt.c 2005-09-15
16:46:17 UTC (rev 17862)
@@ -27,6 +27,8 @@
#define I8042_MAX_COMMAND_LENGTH 16
#define I8042_MAX_UPWARDS_STACK 5
+UNICODE_STRING I8042RegistryPath;
+
/* FUNCTIONS
*****************************************************************/
/*
@@ -794,6 +796,21 @@
{
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;
_____
Modified: trunk/reactos/drivers/input/i8042prt/i8042prt.h
--- trunk/reactos/drivers/input/i8042prt/i8042prt.h 2005-09-15
15:57:28 UTC (rev 17861)
+++ trunk/reactos/drivers/input/i8042prt/i8042prt.h 2005-09-15
16:46:17 UTC (rev 17862)
@@ -263,6 +263,8 @@
#define MOUSE_NACK 0xFE
/* i8042prt.c */
+extern UNICODE_STRING I8042RegistryPath;
+
NTSTATUS I8042ReadData(UCHAR *Data);
NTSTATUS I8042ReadStatus(UCHAR *Status);
_____
Modified: trunk/reactos/drivers/input/i8042prt/registry.c
--- trunk/reactos/drivers/input/i8042prt/registry.c 2005-09-15
15:57:28 UTC (rev 17861)
+++ trunk/reactos/drivers/input/i8042prt/registry.c 2005-09-15
16:46:17 UTC (rev 17862)
@@ -30,10 +30,7 @@
{
RTL_QUERY_REGISTRY_TABLE Parameters[19];
- UNICODE_STRING ParametersPath;
- PWSTR RegistryPath =
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\i8042Prt\\Pa
rameters";
-
NTSTATUS Status;
ULONG DefaultHeadless = 0;
@@ -55,23 +52,6 @@
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 @@
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 @@
DPRINT1 ("Manually set defaults\n");
}
- ExFreePoolWithTag(ParametersPath.Buffer, TAG_I8042);
if (DevExt->Settings.MouseResolution > 3)
DevExt->Settings.MouseResolution = 3;