- 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

svn path=/trunk/; revision=19095
This commit is contained in:
Hervé Poussineau 2005-11-09 11:16:43 +00:00
parent c8a200b0f6
commit e903b5542d
2 changed files with 32 additions and 8 deletions

View file

@ -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 @@ ReadRegistryEntries(
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 @@ cleanup:
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 @@ ClassAddDevice(
DPRINT("ClassAddDevice called. Pdo = 0x%p\n", Pdo);
if (Pdo == NULL)
return STATUS_SUCCESS;
DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject);
if (Pdo == NULL)
/* 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);
/* Create new device object */
Status = IoCreateDevice(
DriverObject,
@ -734,6 +748,16 @@ DriverEntry(
}
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 @@ DriverEntry(
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = ClassDeviceControl;
DriverObject->DriverStartIo = ClassStartIo;
Status = SearchForLegacyDrivers(DriverObject, DriverExtension);
return Status;
return STATUS_SUCCESS;
}

View file

@ -24,6 +24,8 @@ typedef enum
typedef struct _CLASS_DRIVER_EXTENSION
{
UNICODE_STRING RegistryPath;
/* Registry settings */
ULONG ConnectMultiplePorts;
ULONG DataQueueSize;