diff --git a/reactos/drivers/input/i8042prt/i8042prt.c b/reactos/drivers/input/i8042prt/i8042prt.c index e6ce9fa7721..8ea3d823efc 100644 --- a/reactos/drivers/input/i8042prt/i8042prt.c +++ b/reactos/drivers/input/i8042prt/i8042prt.c @@ -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; diff --git a/reactos/drivers/input/i8042prt/i8042prt.h b/reactos/drivers/input/i8042prt/i8042prt.h index 6d7e56c5a7a..16cfe0ef6f2 100644 --- a/reactos/drivers/input/i8042prt/i8042prt.h +++ b/reactos/drivers/input/i8042prt/i8042prt.h @@ -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); diff --git a/reactos/drivers/input/i8042prt/registry.c b/reactos/drivers/input/i8042prt/registry.c index 09abbd6af8a..8c25872cd31 100644 --- a/reactos/drivers/input/i8042prt/registry.c +++ b/reactos/drivers/input/i8042prt/registry.c @@ -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;