UsbDk: prepare FilterDevice for device enumeration

FilterDevice: fix functions of CUsbDkChildDevice;
add GetChildrenCount() to CUsbDkFilterDevice;
Make m_ChildDevices counting list

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
This commit is contained in:
Pavel Gurvich 2014-02-27 14:15:43 +02:00 • committed by Dmitry Fleytman
parent ce2c4e5ea7
commit 771555ed40
3 changed files with 11 additions and 7 deletions

View file

@ -83,9 +83,10 @@ void CUsbDkControlDeviceQueue::DeviceControl(WDFQUEUE Queue,
void CUsbDkControlDevice::DumpAllChildren()
{
m_FilterDevices.ForEach([](CUsbDkFilterDevice *Filter)
{
Filter->EnumerateChildren([](CUsbDkChildDevice *Child){ Child->Dump(); });
});
{
Filter->EnumerateChildren([](CUsbDkChildDevice *Child){ Child->Dump(); return true; });
return true;
});
}
NTSTATUS CUsbDkControlDevice::Create(WDFDRIVER Driver)

View file

@ -124,7 +124,7 @@ UsbDkClonePdo(WDFDEVICE ParentDevice)
void CUsbDkFilterDevice::ClearChildrenList()
{
m_ChildDevices.ForEachDetached([] (CUsbDkChildDevice* Child) { delete Child; });
m_ChildDevices.ForEachDetached([](CUsbDkChildDevice* Child) { delete Child; return true; });
}
void CUsbDkFilterDevice::QDRPostProcessWi()

View file

@ -29,8 +29,8 @@ public:
, m_InstanceID(InstanceID)
{}
PCWCHAR DeviceID() { m_DeviceID->begin(); }
PCWCHAR InstanceID() { m_InstanceID->begin(); }
PCWCHAR DeviceID() { return *m_DeviceID->begin(); }
PCWCHAR InstanceID() { return *m_InstanceID->begin(); }
void Dump();
@ -70,6 +70,9 @@ public:
static CUsbDkFilterDevice *GetByListEntry(PLIST_ENTRY entry)
{ return static_cast<CUsbDkFilterDevice*>(CONTAINING_RECORD(entry, CUsbDkFilterDevice, m_ListEntry)); }
ULONG GetChildrenCount()
{ return m_ChildDevices.GetCount(); }
private:
static void ContextCleanup(_In_ WDFOBJECT DeviceObject);
@ -94,7 +97,7 @@ private:
PDEVICE_OBJECT m_ClonedPdo = nullptr;
CUsbDkControlDevice *m_ControlDevice = nullptr;
CWdmList<CUsbDkChildDevice, CLockedAccess, CNonCountingObject> m_ChildDevices;
CWdmList<CUsbDkChildDevice, CLockedAccess, CCountingObject> m_ChildDevices;
LIST_ENTRY m_ListEntry;