Author: hpoussin
Date: Sun Oct 1 03:37:44 2006
New Revision: 24326
URL: http://svn.reactos.org/svn/reactos?rev=24326&view=rev
Log:
Give enough space to retrieve full device class description
Modified:
trunk/reactos/base/applications/devmgmt/enumdevices.c
Modified: trunk/reactos/base/applications/devmgmt/enumdevices.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/devmgmt/…
==============================================================================
--- trunk/reactos/base/applications/devmgmt/enumdevices.c (original)
+++ trunk/reactos/base/applications/devmgmt/enumdevices.c Sun Oct 1 03:37:44 2006
@@ -105,7 +105,7 @@
if (KeyClass != INVALID_HANDLE_VALUE)
{
- LONG dwSize = MAX_CLASS_NAME_LEN;
+ LONG dwSize = MAX_DEV_LEN;
if (RegQueryValue(KeyClass,
NULL,
Author: hpoussin
Date: Sun Oct 1 02:41:23 2006
New Revision: 24323
URL: http://svn.reactos.org/svn/reactos?rev=24323&view=rev
Log:
Do not expect a call to AddDevice with a NULL Pdo. Those are not guaranteed
Modified:
trunk/reactos/drivers/input/kbdclass/kbdclass.c
trunk/reactos/drivers/input/mouclass/mouclass.c
Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/kbdclass/kbd…
==============================================================================
--- trunk/reactos/drivers/input/kbdclass/kbdclass.c (original)
+++ trunk/reactos/drivers/input/kbdclass/kbdclass.c Sun Oct 1 02:41:23 2006
@@ -12,11 +12,6 @@
#define INITGUID
#include "kbdclass.h"
-
-static NTSTATUS
-SearchForLegacyDrivers(
- IN PDRIVER_OBJECT DriverObject,
- IN PCLASS_DRIVER_EXTENSION DriverExtension);
static VOID NTAPI
DriverUnload(IN PDRIVER_OBJECT DriverObject)
@@ -675,9 +670,8 @@
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);
+ /* We may get a NULL Pdo at the first call as we're a legacy driver. Ignore it */
+ return STATUS_SUCCESS;
/* Create new device object */
Status = IoCreateDevice(
@@ -808,12 +802,14 @@
}
}
-static NTSTATUS
+static VOID NTAPI
SearchForLegacyDrivers(
IN PDRIVER_OBJECT DriverObject,
- IN PCLASS_DRIVER_EXTENSION DriverExtension)
+ IN PVOID Context, /* PCLASS_DRIVER_EXTENSION */
+ IN ULONG Count)
{
UNICODE_STRING DeviceMapKeyU = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\HARDWARE\\DEVICEMAP");
+ PCLASS_DRIVER_EXTENSION DriverExtension;
UNICODE_STRING PortBaseName = {0, };
PKEY_VALUE_BASIC_INFORMATION KeyValueInformation = NULL;
OBJECT_ATTRIBUTES ObjectAttributes;
@@ -823,6 +819,13 @@
ULONG Size, ResultLength;
NTSTATUS Status;
+ DPRINT("SearchForLegacyDrivers(%p %p %lu)\n",
+ DriverObject, Context, Count);
+
+ if (Count != 1)
+ return;
+ DriverExtension = (PCLASS_DRIVER_EXTENSION)Context;
+
/* Create port base name, by replacing Class by Port at the end of the class base name */
Status = RtlDuplicateUnicodeString(
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
@@ -902,8 +905,6 @@
DPRINT("ClassAddDevice() failed with status 0x%08lx\n", Status);
}
}
- if (Status == STATUS_NO_MORE_ENTRIES)
- Status = STATUS_SUCCESS;
cleanup:
if (KeyValueInformation != NULL)
@@ -912,7 +913,6 @@
ZwClose(hDeviceMapKey);
if (hPortKey != (HANDLE)-1)
ZwClose(hPortKey);
- return Status;
}
/*
@@ -982,5 +982,11 @@
DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = ForwardIrpAndForget;
DriverObject->DriverStartIo = ClassStartIo;
+ /* We will detect the legacy devices later */
+ IoRegisterDriverReinitialization(
+ DriverObject,
+ SearchForLegacyDrivers,
+ DriverExtension);
+
return STATUS_SUCCESS;
}
Modified: trunk/reactos/drivers/input/mouclass/mouclass.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/mouclass/mou…
==============================================================================
--- trunk/reactos/drivers/input/mouclass/mouclass.c (original)
+++ trunk/reactos/drivers/input/mouclass/mouclass.c Sun Oct 1 02:41:23 2006
@@ -12,11 +12,6 @@
#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)
@@ -651,9 +646,8 @@
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);
+ /* We may get a NULL Pdo at the first call as we're a legacy driver. Ignore it */
+ return STATUS_SUCCESS;
/* Create new device object */
Status = IoCreateDevice(
@@ -712,7 +706,7 @@
/* Register interface ; ignore the error (if any) as having
* a registred interface is not so important... */
- IoRegisterDeviceInterface(
+ Status = IoRegisterDeviceInterface(
Pdo,
&GUID_DEVINTERFACE_MOUSE,
NULL,
@@ -784,12 +778,14 @@
}
}
-static NTSTATUS
+static VOID NTAPI
SearchForLegacyDrivers(
IN PDRIVER_OBJECT DriverObject,
- IN PCLASS_DRIVER_EXTENSION DriverExtension)
+ IN PVOID Context, /* PCLASS_DRIVER_EXTENSION */
+ IN ULONG Count)
{
UNICODE_STRING DeviceMapKeyU = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\HARDWARE\\DEVICEMAP");
+ PCLASS_DRIVER_EXTENSION DriverExtension;
UNICODE_STRING PortBaseName = {0, };
PKEY_VALUE_BASIC_INFORMATION KeyValueInformation = NULL;
OBJECT_ATTRIBUTES ObjectAttributes;
@@ -799,6 +795,13 @@
ULONG Size, ResultLength;
NTSTATUS Status;
+ DPRINT("SearchForLegacyDrivers(%p %p %lu)\n",
+ DriverObject, Context, Count);
+
+ if (Count != 1)
+ return;
+ DriverExtension = (PCLASS_DRIVER_EXTENSION)Context;
+
/* Create port base name, by replacing Class by Port at the end of the class base name */
Status = RtlDuplicateUnicodeString(
RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
@@ -878,8 +881,6 @@
DPRINT("ClassAddDevice() failed with status 0x%08lx\n", Status);
}
}
- if (Status == STATUS_NO_MORE_ENTRIES)
- Status = STATUS_SUCCESS;
cleanup:
if (KeyValueInformation != NULL)
@@ -888,7 +889,6 @@
ZwClose(hDeviceMapKey);
if (hPortKey != (HANDLE)-1)
ZwClose(hPortKey);
- return Status;
}
/*
@@ -958,5 +958,11 @@
DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = ForwardIrpAndForget;
DriverObject->DriverStartIo = ClassStartIo;
+ /* We will detect the legacy devices later */
+ IoRegisterDriverReinitialization(
+ DriverObject,
+ SearchForLegacyDrivers,
+ DriverExtension);
+
return STATUS_SUCCESS;
}