From 771555ed408cfefe878635d7bf749060dbcbc64c Mon Sep 17 00:00:00 2001 From: Pavel Gurvich Date: Thu, 27 Feb 2014 14:15:43 +0200 Subject: [PATCH] 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 Signed-off-by: Dmitry Fleytman --- UsbDk/ControlDevice.cpp | 7 ++++--- UsbDk/FilterDevice.cpp | 2 +- UsbDk/FilterDevice.h | 9 ++++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/UsbDk/ControlDevice.cpp b/UsbDk/ControlDevice.cpp index 424ca26..abf0d6a 100644 --- a/UsbDk/ControlDevice.cpp +++ b/UsbDk/ControlDevice.cpp @@ -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) diff --git a/UsbDk/FilterDevice.cpp b/UsbDk/FilterDevice.cpp index 15d8e18..2157277 100644 --- a/UsbDk/FilterDevice.cpp +++ b/UsbDk/FilterDevice.cpp @@ -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() diff --git a/UsbDk/FilterDevice.h b/UsbDk/FilterDevice.h index a207b74..e4c567e 100644 --- a/UsbDk/FilterDevice.h +++ b/UsbDk/FilterDevice.h @@ -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(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 m_ChildDevices; + CWdmList m_ChildDevices; LIST_ENTRY m_ListEntry;