- Add registry entry in HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP for each
mouse class DO
- Don't search for legacy port drivers in DriverEntry, but in first
AddDevice
Modified: trunk/reactos/drivers/input/mouclass/mouclass.c
Modified: trunk/reactos/drivers/input/mouclass/mouclass.h
_____
Modified: trunk/reactos/drivers/input/mouclass/mouclass.c
--- trunk/reactos/drivers/input/mouclass/mouclass.c 2005-11-09
11:15:42 UTC (rev 19094)
+++ trunk/reactos/drivers/input/mouclass/mouclass.c 2005-11-09
11:16:43 UTC (rev 19095)
@@ -13,6 +13,11 @@
#define INITGUID
#include "mouclass.h"
+static NTSTATUS
+SearchForLegacyDrivers(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PCLASS_DRIVER_EXTENSION DriverExtension);
+
static VOID NTAPI
DriverUnload(IN PDRIVER_OBJECT DriverObject)
{
@@ -201,7 +206,7 @@
Parameters[2].EntryContext = &DriverExtension->DeviceBaseName;
Parameters[2].DefaultType = REG_SZ;
Parameters[2].DefaultData = &DefaultDeviceBaseName;
- Parameters[2].DefaultLength = sizeof(ULONG);
+ Parameters[2].DefaultLength = 0;
Status = RtlQueryRegistryValues(
RTL_REGISTRY_ABSOLUTE,
@@ -321,7 +326,14 @@
Fdo->Flags |= DO_POWER_PAGABLE;
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
- /* FIXME: create registry entry in
HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP */
+ /* Add entry entry to
HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\[DeviceBaseName] */
+ RtlWriteRegistryValue(
+ RTL_REGISTRY_DEVICEMAP,
+ DriverExtension->DeviceBaseName.Buffer,
+ DeviceNameU.Buffer,
+ REG_SZ,
+ DriverExtension->RegistryPath.Buffer,
+ DriverExtension->RegistryPath.MaximumLength);
ExFreePool(DeviceNameU.Buffer);
@@ -472,11 +484,13 @@
DPRINT("ClassAddDevice called. Pdo = 0x%p\n", Pdo);
+ DriverExtension = IoGetDriverObjectExtension(DriverObject,
DriverObject);
+
if (Pdo == NULL)
- return STATUS_SUCCESS;
+ /* We're getting a NULL Pdo at the first call as we're a
legacy driver.
+ * Use it to search for legacy port drivers. */
+ return SearchForLegacyDrivers(DriverObject,
DriverExtension);
- DriverExtension = IoGetDriverObjectExtension(DriverObject,
DriverObject);
-
/* Create new device object */
Status = IoCreateDevice(
DriverObject,
@@ -734,6 +748,16 @@
}
RtlZeroMemory(DriverExtension, sizeof(CLASS_DRIVER_EXTENSION));
+ Status = RtlDuplicateUnicodeString(
+ RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
+ RegistryPath,
+ &DriverExtension->RegistryPath);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("RtlDuplicateUnicodeString() failed with status
0x%08lx\n", Status);
+ return Status;
+ }
+
Status = ReadRegistryEntries(RegistryPath, DriverExtension);
if (!NT_SUCCESS(Status))
{
@@ -766,7 +790,5 @@
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
ClassDeviceControl;
DriverObject->DriverStartIo =
ClassStartIo;
- Status = SearchForLegacyDrivers(DriverObject, DriverExtension);
-
- return Status;
+ return STATUS_SUCCESS;
}
_____
Modified: trunk/reactos/drivers/input/mouclass/mouclass.h
--- trunk/reactos/drivers/input/mouclass/mouclass.h 2005-11-09
11:15:42 UTC (rev 19094)
+++ trunk/reactos/drivers/input/mouclass/mouclass.h 2005-11-09
11:16:43 UTC (rev 19095)
@@ -24,6 +24,8 @@
typedef struct _CLASS_DRIVER_EXTENSION
{
+ UNICODE_STRING RegistryPath;
+
/* Registry settings */
ULONG ConnectMultiplePorts;
ULONG DataQueueSize;
Show replies by date