From 0b7487ba56675427843642b90551c0afc9a6d077 Mon Sep 17 00:00:00 2001 From: Dmitry Fleytman Date: Wed, 29 Jun 2016 14:12:41 +0300 Subject: [PATCH] UsbDk: Retire old hiding logic This commit retires old device hider logic based on wiping PDOs from BusRelations array. Previous commits introduce new logic based on IDs patching. Signed-off-by: Dmitry Fleytman --- UsbDk/FilterDevice.cpp | 35 ----------------------------------- UsbDk/FilterDevice.h | 16 ---------------- 2 files changed, 51 deletions(-) diff --git a/UsbDk/FilterDevice.cpp b/UsbDk/FilterDevice.cpp index db30dae..0c082e6 100644 --- a/UsbDk/FilterDevice.cpp +++ b/UsbDk/FilterDevice.cpp @@ -260,7 +260,6 @@ NTSTATUS CUsbDkHubFilterStrategy::PNPPreProcess(PIRP Irp) DropRemovedDevices(Relations); AddNewDevices(Relations); - WipeHiddenDevices(Relations); TraceEvents(TRACE_LEVEL_ERROR, TRACE_FILTERDEVICE, "%!FUNC! Finished relations array processing"); }); } @@ -304,40 +303,6 @@ void CUsbDkHubFilterStrategy::AddNewDevices(const CDeviceRelations &Relations) [this](PDEVICE_OBJECT PDO){ RegisterNewChild(PDO); return true; }); } -void CUsbDkHubFilterStrategy::WipeHiddenDevices(CDeviceRelations &Relations) -{ - Relations.WipeIf([this](PDEVICE_OBJECT PDO) - { - bool Hide = false; - - Children().ForEachIf([PDO](CUsbDkChildDevice *Child){ return Child->Match(PDO); }, - [this, &Hide](CUsbDkChildDevice *Child) - { - Hide = false; - - if (!Child->IsRedirected() && - !Child->IsIndicated()) - { - Hide = m_ControlDevice->ShouldHide(Child->DeviceDescriptor()); - } - - if (!Hide) - { - Child->MarkAsIndicated(); - } - else - { - TraceEvents(TRACE_LEVEL_ERROR, TRACE_FILTERDEVICE, "%!FUNC! Hiding child object:"); - Child->Dump(); - } - - return false; - }); - - return Hide; - }); -} - void CUsbDkHubFilterStrategy::RegisterNewChild(PDEVICE_OBJECT PDO) { CWdmUsbDeviceAccess pdoAccess(PDO); diff --git a/UsbDk/FilterDevice.h b/UsbDk/FilterDevice.h index 286b589..644f1b2 100644 --- a/UsbDk/FilterDevice.h +++ b/UsbDk/FilterDevice.h @@ -67,14 +67,6 @@ class CUsbDkChildDevice : public CAllocatable , m_PDO(PDO) {} - ~CUsbDkChildDevice() - { - if (!m_Indicated) - { - ObDereferenceObject(m_PDO); - } - } - ULONG ParentID() const; PCWCHAR DeviceID() const { return *m_DeviceID->begin(); } PCWCHAR InstanceID() const { return *m_InstanceID->begin(); } @@ -108,12 +100,6 @@ class CUsbDkChildDevice : public CAllocatable void Dump(); - void MarkAsIndicated() - { m_Indicated = true; } - - bool IsIndicated() const - { return m_Indicated; } - private: CObjHolder m_DeviceID; CObjHolder m_InstanceID; @@ -124,7 +110,6 @@ class CUsbDkChildDevice : public CAllocatable PDEVICE_OBJECT m_PDO; const CUsbDkFilterDevice &m_ParentDevice; bool m_Redirected = false; - bool m_Indicated = false; bool CreateRedirectorDevice(); @@ -149,7 +134,6 @@ class CUsbDkHubFilterStrategy : public CUsbDkFilterStrategy private: void DropRemovedDevices(const CDeviceRelations &Relations); void AddNewDevices(const CDeviceRelations &Relations); - void WipeHiddenDevices(CDeviceRelations &Relations); void RegisterNewChild(PDEVICE_OBJECT PDO); void ApplyRedirectionPolicy(CUsbDkChildDevice &Device); bool FetchConfigurationDescriptors(CWdmUsbDeviceAccess &devAccess,