- add more debug traces

- see bug 6556

svn path=/trunk/; revision=54584
This commit is contained in:
Johannes Anderwald 2011-12-04 16:20:07 +00:00
parent a0fce830ee
commit b77ebc4fd0
2 changed files with 167 additions and 56 deletions

View file

@ -14,7 +14,11 @@
#include <ntddk.h> #include <ntddk.h>
#include <portcls.h> #include <portcls.h>
#ifndef YDEBUG
#define NDEBUG #define NDEBUG
#endif
#include <debug.h> #include <debug.h>
#include <dmusicks.h> #include <dmusicks.h>

View file

@ -6,7 +6,6 @@
* PROGRAMMER: Johannes Anderwald * PROGRAMMER: Johannes Anderwald
*/ */
#undef NDEBUG
#define YDEBUG #define YDEBUG
#include "private.hpp" #include "private.hpp"
@ -260,7 +259,7 @@ PropertyItemDispatch(
{ {
// found match // found match
PropertyRequest->PropertyItem = PropertyItem; PropertyRequest->PropertyItem = PropertyItem;
DPRINT1("Using property item %p\n", PropertyItem);
// done // done
break; break;
} }
@ -511,86 +510,195 @@ PcCaptureFormat(
return STATUS_NOT_IMPLEMENTED; return STATUS_NOT_IMPLEMENTED;
} }
VOID
DumpAutomationTable(
IN PPCAUTOMATION_TABLE AutomationTable,
IN LPCWSTR DebugPrefix,
IN LPCWSTR DebugIdentation)
{
PPCPROPERTY_ITEM PropertyItem;
PPCEVENT_ITEM EventItem;
PPCMETHOD_ITEM MethodItem;
ULONG Index;
UNICODE_STRING GuidString;
if (!AutomationTable)
{
// no table
return;
}
DPRINT("=====================================================================\n");
DPRINT("%S%S AutomationTable %p\n", DebugIdentation, DebugPrefix, AutomationTable);
DPRINT("%S%S PropertyCount %lu\n", DebugIdentation, DebugPrefix, AutomationTable->PropertyCount);
DPRINT("%S%S EventCount %lu\n", DebugIdentation, DebugPrefix, AutomationTable->EventCount);
DPRINT("%S%S MethodCount %lu\n", DebugIdentation, DebugPrefix, AutomationTable->MethodCount);
// print properties
if (AutomationTable->PropertyCount)
{
if (AutomationTable->PropertyItemSize >= sizeof(PCPROPERTY_ITEM))
{
// get property item
PropertyItem = (PPCPROPERTY_ITEM)AutomationTable->Properties;
// sanity check
ASSERT(PropertyItem);
// display all properties associated
for(Index = 0; Index < AutomationTable->PropertyCount; Index++)
{
// convert to printable string
RtlStringFromGUID(*PropertyItem->Set, &GuidString);
DPRINT("%SPropertyItemIndex %lu %p GUID %S Id %u Flags %x\n", DebugIdentation, Index, PropertyItem, GuidString.Buffer, PropertyItem->Id, PropertyItem->Flags);
RtlFreeUnicodeString(&GuidString);
// move to next item
PropertyItem = (PPCPROPERTY_ITEM)((ULONG_PTR)PropertyItem + AutomationTable->PropertyItemSize);
}
}
else
{
DPRINT1("DRIVER BUG: property item must be at least %lu but got %lu\n", sizeof(PCPROPERTY_ITEM), AutomationTable->PropertyItemSize);
}
}
// print events
if (AutomationTable->EventCount)
{
if (AutomationTable->EventItemSize >= sizeof(PCEVENT_ITEM))
{
// get first event item
EventItem = (PPCEVENT_ITEM)AutomationTable->Events;
// sanity check
ASSERT(EventItem);
for(Index = 0; Index < AutomationTable->EventCount; Index++)
{
// convert to printable string
RtlStringFromGUID(*EventItem->Set, &GuidString);
DPRINT("%SEventItemIndex %lu %p GUID %S Id %u Flags %x\n", DebugIdentation, Index, EventItem, GuidString.Buffer, EventItem->Id, EventItem->Flags);
RtlFreeUnicodeString(&GuidString);
// move to next item
EventItem = (PPCEVENT_ITEM)((ULONG_PTR)EventItem + AutomationTable->EventItemSize);
}
}
else
{
DPRINT1("DRIVER BUG: event item must be at least %lu but got %lu\n", sizeof(PCEVENT_ITEM), AutomationTable->EventItemSize);
}
}
// print methods
if (AutomationTable->MethodCount)
{
if (AutomationTable->MethodItemSize >= sizeof(PCMETHOD_ITEM))
{
// get first event item
MethodItem = (PPCMETHOD_ITEM)AutomationTable->Methods;
// sanity check
ASSERT(MethodItem);
for(Index = 0; Index < AutomationTable->MethodCount; Index++)
{
// convert to printable string
RtlStringFromGUID(*MethodItem->Set, &GuidString);
DPRINT("%SMethodItemIndex %lu %p GUID %S Id %u Flags %x\n", DebugIdentation, Index, MethodItem, GuidString.Buffer, MethodItem->Id, MethodItem->Flags);
RtlFreeUnicodeString(&GuidString);
// move to next item
MethodItem = (PPCMETHOD_ITEM)((ULONG_PTR)MethodItem + AutomationTable->MethodItemSize);
}
}
else
{
DPRINT1("DRIVER BUG: method item must be at least %lu but got %lu\n", sizeof(PCEVENT_ITEM), AutomationTable->MethodItemSize);
}
}
DPRINT("=====================================================================\n");
}
VOID VOID
DumpFilterDescriptor( DumpFilterDescriptor(
IN PPCFILTER_DESCRIPTOR FilterDescription) IN PPCFILTER_DESCRIPTOR FilterDescription)
{ {
ULONG Index, SubIndex; ULONG Index;
PPCPROPERTY_ITEM PropertyItem; WCHAR Buffer[30];
PPCEVENT_ITEM EventItem; PPCPIN_DESCRIPTOR PinDescriptor;
PPCNODE_DESCRIPTOR NodeDescriptor; PPCNODE_DESCRIPTOR NodeDescriptor;
UNICODE_STRING GuidString;
DPRINT("======================\n"); DPRINT("======================\n");
DPRINT("Descriptor Automation Table %p\n",FilterDescription->AutomationTable); DPRINT("Descriptor Automation Table %p\n",FilterDescription->AutomationTable);
DPRINT("PinCount %lu PinSize %lu StandardSize %lu\n", FilterDescription->PinCount, FilterDescription->PinSize, sizeof(PCPIN_DESCRIPTOR));
DPRINT("NodeCount %lu NodeSize %lu StandardSize %lu\n", FilterDescription->NodeCount, FilterDescription->NodeSize, sizeof(PCNODE_DESCRIPTOR));
if (FilterDescription->AutomationTable) // dump filter description table
DumpAutomationTable((PPCAUTOMATION_TABLE)FilterDescription->AutomationTable, L"Filter", L"");
if (FilterDescription->PinCount)
{ {
DPRINT("FilterPropertiesCount %u FilterPropertySize %u Expected %u Events %u EventItemSize %u expected %u\n", FilterDescription->AutomationTable->PropertyCount, FilterDescription->AutomationTable->PropertyItemSize, sizeof(PCPROPERTY_ITEM), if (FilterDescription->PinSize >= sizeof(PCPIN_DESCRIPTOR))
FilterDescription->AutomationTable->EventCount, FilterDescription->AutomationTable->EventItemSize, sizeof(PCEVENT_ITEM));
if (FilterDescription->AutomationTable->PropertyCount)
{ {
PropertyItem = (PPCPROPERTY_ITEM)FilterDescription->AutomationTable->Properties; // get first pin
PinDescriptor = (PPCPIN_DESCRIPTOR)FilterDescription->Pins;
for(Index = 0; Index < FilterDescription->AutomationTable->PropertyCount; Index++) // sanity check
ASSERT(PinDescriptor);
for(Index = 0; Index < FilterDescription->PinCount; Index++)
{ {
RtlStringFromGUID(*PropertyItem->Set, &GuidString); // print prefix
DPRINT("Property Index %u GUID %S Id %u Flags %x\n", Index, GuidString.Buffer, PropertyItem->Id, PropertyItem->Flags); swprintf(Buffer, L"PinIndex %lu", Index);
PropertyItem = (PPCPROPERTY_ITEM)((ULONG_PTR)PropertyItem + FilterDescription->AutomationTable->PropertyItemSize); // dump automation table
DumpAutomationTable((PPCAUTOMATION_TABLE)PinDescriptor->AutomationTable, Buffer, L" ");
// move to next pin descriptor
PinDescriptor = (PPCPIN_DESCRIPTOR)((ULONG_PTR)PinDescriptor + FilterDescription->PinSize);
} }
}
EventItem = (PPCEVENT_ITEM)FilterDescription->AutomationTable->Events; else
for(Index = 0; Index < FilterDescription->AutomationTable->EventCount; Index++) {
{ DPRINT1("DRIVER BUG: pin size smaller than minimum size\n");
RtlStringFromGUID(*EventItem->Set, &GuidString);
DPRINT("EventIndex %u GUID %S Id %u Flags %x\n", Index, GuidString.Buffer, EventItem->Id, EventItem->Flags);
EventItem = (PPCEVENT_ITEM)((ULONG_PTR)EventItem + FilterDescription->AutomationTable->EventItemSize);
}
} }
} }
if (FilterDescription->Nodes) if (FilterDescription->Nodes)
{ {
DPRINT("NodeCount %u NodeSize %u expected %u\n", FilterDescription->NodeCount, FilterDescription->NodeSize, sizeof(PCNODE_DESCRIPTOR)); if (FilterDescription->NodeSize >= sizeof(PCNODE_DESCRIPTOR))
NodeDescriptor = (PPCNODE_DESCRIPTOR)FilterDescription->Nodes;
for(Index = 0; Index < FilterDescription->NodeCount; Index++)
{ {
DPRINT("Index %u AutomationTable %p\n", Index, NodeDescriptor->AutomationTable); // get first descriptor
NodeDescriptor = (PPCNODE_DESCRIPTOR)FilterDescription->Nodes;
if (NodeDescriptor->AutomationTable) // sanity check
ASSERT(NodeDescriptor);
for(Index = 0; Index < FilterDescription->NodeCount; Index++)
{ {
DPRINT(" Index %u EventCount %u\n", Index, NodeDescriptor->AutomationTable->EventCount); // print prefix
EventItem = (PPCEVENT_ITEM)NodeDescriptor->AutomationTable->Events; swprintf(Buffer, L"NodeIndex %lu", Index);
for(SubIndex = 0; SubIndex < NodeDescriptor->AutomationTable->EventCount; SubIndex++)
{
RtlStringFromGUID(*EventItem->Set, &GuidString);
DPRINT(" EventIndex %u GUID %S Id %u Flags %x\n", SubIndex, GuidString.Buffer, EventItem->Id, EventItem->Flags);
EventItem = (PPCEVENT_ITEM)((ULONG_PTR)EventItem + NodeDescriptor->AutomationTable->EventItemSize); // dump automation table
} DumpAutomationTable((PPCAUTOMATION_TABLE)NodeDescriptor->AutomationTable, Buffer, L" ");
DPRINT1(" Index %u PropertyCount %u\n", Index, NodeDescriptor->AutomationTable->PropertyCount); // move to next node descriptor
PropertyItem = (PPCPROPERTY_ITEM)NodeDescriptor->AutomationTable->Properties; NodeDescriptor = (PPCNODE_DESCRIPTOR)((ULONG_PTR)NodeDescriptor + FilterDescription->NodeSize);
for(SubIndex = 0; SubIndex < NodeDescriptor->AutomationTable->PropertyCount; SubIndex++)
{
RtlStringFromGUID(*PropertyItem->Set, &GuidString);
DPRINT1(" PropertyIndex %u GUID %S Id %u Flags %x\n", SubIndex, GuidString.Buffer, PropertyItem->Id, PropertyItem->Flags);
PropertyItem = (PPCPROPERTY_ITEM)((ULONG_PTR)PropertyItem + NodeDescriptor->AutomationTable->PropertyItemSize);
}
} }
NodeDescriptor = (PPCNODE_DESCRIPTOR)((ULONG_PTR)NodeDescriptor + FilterDescription->NodeSize);
} }
else
{
DPRINT1("DRIVER BUG: node size smaller than standard descriptor size\n");
}
} }
DPRINT("ConnectionCount: %lu\n", FilterDescription->ConnectionCount); DPRINT("ConnectionCount: %lu\n", FilterDescription->ConnectionCount);
@ -608,7 +716,6 @@ DumpFilterDescriptor(
} }
DPRINT("------ End of Nodes Connections----------------\n"); DPRINT("------ End of Nodes Connections----------------\n");
} }
DPRINT1("======================\n"); DPRINT1("======================\n");
} }