mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
[NTOS:IO] iorsrce.c: Add DBG traces for bus/device enumeration functions.
This commit is contained in:
parent
2674e26cbb
commit
0b695a6f70
1 changed files with 74 additions and 0 deletions
|
@ -12,8 +12,19 @@
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
#include <ntoskrnl.h>
|
#include <ntoskrnl.h>
|
||||||
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
#define IORSRCTRACE(...) DbgPrint(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#define IORSRCTRACE __noop
|
||||||
|
#else
|
||||||
|
#define IORSRCTRACE(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
static CONFIGURATION_INFORMATION
|
static CONFIGURATION_INFORMATION
|
||||||
|
@ -150,6 +161,14 @@ IopQueryDeviceDescription(
|
||||||
UNICODE_STRING TempString;
|
UNICODE_STRING TempString;
|
||||||
WCHAR TempBuffer[14];
|
WCHAR TempBuffer[14];
|
||||||
|
|
||||||
|
IORSRCTRACE("\nIopQueryDeviceDescription(Query: 0x%p)\n"
|
||||||
|
" RootKey: '%wZ'\n"
|
||||||
|
" RootKeyHandle: 0x%p\n"
|
||||||
|
" Bus: %lu\n",
|
||||||
|
Query,
|
||||||
|
&RootKey, RootKeyHandle,
|
||||||
|
Bus);
|
||||||
|
|
||||||
/* Temporary string */
|
/* Temporary string */
|
||||||
TempString.MaximumLength = sizeof(TempBuffer);
|
TempString.MaximumLength = sizeof(TempBuffer);
|
||||||
TempString.Length = 0;
|
TempString.Length = 0;
|
||||||
|
@ -164,9 +183,12 @@ IopQueryDeviceDescription(
|
||||||
{
|
{
|
||||||
ControllerNumber = *Query->ControllerNumber;
|
ControllerNumber = *Query->ControllerNumber;
|
||||||
MaximumControllerNumber = ControllerNumber + 1;
|
MaximumControllerNumber = ControllerNumber + 1;
|
||||||
|
IORSRCTRACE(" Getting controller #%lu\n", ControllerNumber);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
IORSRCTRACE(" Enumerating controllers in '%wZ'...\n", &ControllerRootRegName);
|
||||||
|
|
||||||
/* Find out how many controllers there are */
|
/* Find out how many controllers there are */
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&ControllerRootRegName,
|
&ControllerRootRegName,
|
||||||
|
@ -234,6 +256,8 @@ IopQueryDeviceDescription(
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
IORSRCTRACE(" Retrieving controller '%wZ'\n", &ControllerRootRegName);
|
||||||
|
|
||||||
/* Open the registry key */
|
/* Open the registry key */
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&ControllerRootRegName,
|
&ControllerRootRegName,
|
||||||
|
@ -289,6 +313,9 @@ IopQueryDeviceDescription(
|
||||||
/* We now have bus *AND* controller information, is it enough? */
|
/* We now have bus *AND* controller information, is it enough? */
|
||||||
if (!Query->PeripheralType || !(*Query->PeripheralType))
|
if (!Query->PeripheralType || !(*Query->PeripheralType))
|
||||||
{
|
{
|
||||||
|
IORSRCTRACE(" --> Bus #%lu Controller #%lu Callout: '%wZ'\n",
|
||||||
|
Bus, ControllerNumber, &ControllerRootRegName);
|
||||||
|
|
||||||
Status = Query->CalloutRoutine(Query->Context,
|
Status = Query->CalloutRoutine(Query->Context,
|
||||||
&ControllerRootRegName,
|
&ControllerRootRegName,
|
||||||
*Query->BusType,
|
*Query->BusType,
|
||||||
|
@ -316,9 +343,12 @@ IopQueryDeviceDescription(
|
||||||
{
|
{
|
||||||
PeripheralNumber = *Query->PeripheralNumber;
|
PeripheralNumber = *Query->PeripheralNumber;
|
||||||
MaximumPeripheralNumber = PeripheralNumber + 1;
|
MaximumPeripheralNumber = PeripheralNumber + 1;
|
||||||
|
IORSRCTRACE(" Getting peripheral #%lu\n", PeripheralNumber);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
IORSRCTRACE(" Enumerating peripherals in '%wZ'...\n", &ControllerRootRegName);
|
||||||
|
|
||||||
/* Find out how many peripherals there are */
|
/* Find out how many peripherals there are */
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&ControllerRootRegName,
|
&ControllerRootRegName,
|
||||||
|
@ -385,6 +415,8 @@ IopQueryDeviceDescription(
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
IORSRCTRACE(" Retrieving peripheral '%wZ'\n", &ControllerRootRegName);
|
||||||
|
|
||||||
/* Open the registry key */
|
/* Open the registry key */
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&ControllerRootRegName,
|
&ControllerRootRegName,
|
||||||
|
@ -435,6 +467,9 @@ IopQueryDeviceDescription(
|
||||||
/* We now have everything the caller could possibly want */
|
/* We now have everything the caller could possibly want */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
IORSRCTRACE(" --> Bus #%lu Controller #%lu Peripheral #%lu Callout: '%wZ'\n",
|
||||||
|
Bus, ControllerNumber, PeripheralNumber, &ControllerRootRegName);
|
||||||
|
|
||||||
Status = Query->CalloutRoutine(Query->Context,
|
Status = Query->CalloutRoutine(Query->Context,
|
||||||
&ControllerRootRegName,
|
&ControllerRootRegName,
|
||||||
*Query->BusType,
|
*Query->BusType,
|
||||||
|
@ -531,6 +566,16 @@ IopQueryBusDescription(
|
||||||
PKEY_VALUE_FULL_INFORMATION BusInformation[IoQueryDeviceMaxData] =
|
PKEY_VALUE_FULL_INFORMATION BusInformation[IoQueryDeviceMaxData] =
|
||||||
{NULL, NULL, NULL};
|
{NULL, NULL, NULL};
|
||||||
|
|
||||||
|
IORSRCTRACE("\nIopQueryBusDescription(Query: 0x%p)\n"
|
||||||
|
" RootKey: '%wZ'\n"
|
||||||
|
" RootKeyHandle: 0x%p\n"
|
||||||
|
" KeyIsRoot: %s\n"
|
||||||
|
" Bus: 0x%p (%lu)\n",
|
||||||
|
Query,
|
||||||
|
&RootKey, RootKeyHandle,
|
||||||
|
KeyIsRoot ? "TRUE" : "FALSE",
|
||||||
|
Bus, Bus ? *Bus : -1);
|
||||||
|
|
||||||
/* Retrieve the necessary buffer space */
|
/* Retrieve the necessary buffer space */
|
||||||
Status = ZwQueryKey(RootKeyHandle,
|
Status = ZwQueryKey(RootKeyHandle,
|
||||||
KeyFullInformation,
|
KeyFullInformation,
|
||||||
|
@ -587,6 +632,8 @@ IopQueryBusDescription(
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
IORSRCTRACE(" Seen: '%.*ws'\n", BasicInformation->NameLength/sizeof(WCHAR), BasicInformation->Name);
|
||||||
|
|
||||||
/* What bus are we going to go down? (only check if this is a root key) */
|
/* What bus are we going to go down? (only check if this is a root key) */
|
||||||
if (KeyIsRoot)
|
if (KeyIsRoot)
|
||||||
{
|
{
|
||||||
|
@ -622,6 +669,8 @@ IopQueryBusDescription(
|
||||||
RtlAppendUnicodeToString(&SubRootRegName, L"\\");
|
RtlAppendUnicodeToString(&SubRootRegName, L"\\");
|
||||||
RtlAppendUnicodeStringToString(&SubRootRegName, &BusString);
|
RtlAppendUnicodeStringToString(&SubRootRegName, &BusString);
|
||||||
|
|
||||||
|
IORSRCTRACE(" SubRootRegName: '%wZ'\n", &SubRootRegName);
|
||||||
|
|
||||||
if (!KeyIsRoot)
|
if (!KeyIsRoot)
|
||||||
{
|
{
|
||||||
/* Parsing a sub-bus key */
|
/* Parsing a sub-bus key */
|
||||||
|
@ -631,6 +680,8 @@ IopQueryBusDescription(
|
||||||
/* Identifier string first */
|
/* Identifier string first */
|
||||||
RtlInitUnicodeString(&SubBusString, IoDeviceInfoNames[SubBusLoop]);
|
RtlInitUnicodeString(&SubBusString, IoDeviceInfoNames[SubBusLoop]);
|
||||||
|
|
||||||
|
IORSRCTRACE(" Getting bus value: '%wZ'\n", &SubBusString);
|
||||||
|
|
||||||
/* Retrieve the necessary buffer space */
|
/* Retrieve the necessary buffer space */
|
||||||
ZwQueryValueKey(SubRootKeyHandle,
|
ZwQueryValueKey(SubRootKeyHandle,
|
||||||
&SubBusString,
|
&SubBusString,
|
||||||
|
@ -670,6 +721,8 @@ IopQueryBusDescription(
|
||||||
{
|
{
|
||||||
if (Query->ControllerType == NULL)
|
if (Query->ControllerType == NULL)
|
||||||
{
|
{
|
||||||
|
IORSRCTRACE(" --> Bus #%lu Callout: '%wZ'\n", *Bus, &SubRootRegName);
|
||||||
|
|
||||||
/* We don't want controller information: call the callback */
|
/* We don't want controller information: call the callback */
|
||||||
Status = Query->CalloutRoutine(Query->Context,
|
Status = Query->CalloutRoutine(Query->Context,
|
||||||
&SubRootRegName,
|
&SubRootRegName,
|
||||||
|
@ -685,6 +738,8 @@ IopQueryBusDescription(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
IORSRCTRACE(" --> Getting device on Bus #%lu : '%wZ'\n", *Bus, &SubRootRegName);
|
||||||
|
|
||||||
/* We want controller information: get it */
|
/* We want controller information: get it */
|
||||||
Status = IopQueryDeviceDescription(Query,
|
Status = IopQueryDeviceDescription(Query,
|
||||||
SubRootRegName,
|
SubRootRegName,
|
||||||
|
@ -1143,6 +1198,25 @@ IoQueryDeviceDescription(
|
||||||
HANDLE RootRegHandle;
|
HANDLE RootRegHandle;
|
||||||
IO_QUERY Query;
|
IO_QUERY Query;
|
||||||
|
|
||||||
|
IORSRCTRACE("\nIoQueryDeviceDescription()\n"
|
||||||
|
" BusType: 0x%p (%lu)\n"
|
||||||
|
" BusNumber: 0x%p (%lu)\n"
|
||||||
|
" ControllerType: 0x%p (%lu)\n"
|
||||||
|
" ControllerNumber: 0x%p (%lu)\n"
|
||||||
|
" PeripheralType: 0x%p (%lu)\n"
|
||||||
|
" PeripheralNumber: 0x%p (%lu)\n"
|
||||||
|
" CalloutRoutine: 0x%p\n"
|
||||||
|
" Context: 0x%p\n"
|
||||||
|
"--> Query: 0x%p\n",
|
||||||
|
BusType, BusType ? *BusType : -1,
|
||||||
|
BusNumber, BusNumber ? *BusNumber : -1,
|
||||||
|
ControllerType, ControllerType ? *ControllerType : -1,
|
||||||
|
ControllerNumber, ControllerNumber ? *ControllerNumber : -1,
|
||||||
|
PeripheralType, PeripheralType ? *PeripheralType : -1,
|
||||||
|
PeripheralNumber, PeripheralNumber ? *PeripheralNumber : -1,
|
||||||
|
CalloutRoutine, Context,
|
||||||
|
&Query);
|
||||||
|
|
||||||
/* Set up the string */
|
/* Set up the string */
|
||||||
RootRegKey.Length = 0;
|
RootRegKey.Length = 0;
|
||||||
RootRegKey.MaximumLength = 2048;
|
RootRegKey.MaximumLength = 2048;
|
||||||
|
|
Loading…
Reference in a new issue