Compare commits

...

2 commits

Author SHA1 Message Date
Yuri Benditovich
d902e99a2a Use lower device for queries during initialization
It is more correct to use lower device in stack for queries
during filter initialization. Lower device is in initialized
state and can process all kinds of requests, when current one is
not ready yet.

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
2017-07-12 16:49:32 +03:00
Dmitry Fleytman
dfd3a4a0ca ci: Integrate with AppVeyor
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
2017-06-07 14:27:19 +03:00
5 changed files with 35 additions and 1 deletions

19
.appveyor.yml Normal file
View file

@ -0,0 +1,19 @@
image: Visual Studio 2015
version: build-{build}-{branch}
before_build:
- ren "C:\Program Files (x86)\Windows Kits\10\include\00wdf" "wdf"
- ren "C:\Program Files (x86)\WiX Toolset v3.11" "WiX Toolset v3.8"
build_script: buildAll.bat
skip_commits:
message: /\[ci skip\]/
notifications:
- provider: Email
to: devel@daynix.com
on_build_success: false
on_build_failure: false
on_build_status_changed: true

View file

@ -1,3 +1,5 @@
[![Build Status](https://ci.appveyor.com/api/projects/status/github/daynix/usbdk?branch=master&svg=true)](https://ci.appveyor.com/project/daynix/usbdk)
# UsbDk
UsbDk (USB Development Kit) is a open-source library for Windows meant

View file

@ -486,7 +486,7 @@ NTSTATUS CUsbDkFilterDevice::DefineStrategy()
return status;
}
if (!m_Strategy.SelectStrategy(WdmObject()))
if (!m_Strategy.SelectStrategy(LowerDeviceObject()))
{
TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_FILTERDEVICE, "%!FUNC! Not attached");
return STATUS_NOT_SUPPORTED;
@ -525,6 +525,11 @@ NTSTATUS CUsbDkFilterDevice::Create(PWDFDEVICE_INIT DevInit)
TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_FILTERDEVICE, "%!FUNC! Failed to create device");
return status;
}
if (!LowerDeviceObject())
{
TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_FILTERDEVICE, "%!FUNC! No lower device, skip");
return STATUS_INVALID_DEVICE_STATE;
}
auto deviceContext = UsbDkFilterGetContext(m_Device);
deviceContext->UsbDkFilter = this;

View file

@ -125,6 +125,8 @@ NTSTATUS CWdfDevice::Create(CPreAllocatedDeviceInit &DeviceInit, WDF_OBJECT_ATTR
TraceEvents(TRACE_LEVEL_ERROR, TRACE_WDFDEVICE, "%!FUNC! Device name caching failed %!STATUS!", status);
}
m_LowerDeviceObj = IoGetLowerDeviceObject(WdmObject());
return status;
}
@ -170,6 +172,10 @@ void CWdfSpecificQueue::InitConfig(WDF_IO_QUEUE_CONFIG &QueueConfig)
CWdfDevice::~CWdfDevice()
{
TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_WDFDEVICE, "%!FUNC! Deleting device %wZ", m_CachedName);
if (m_LowerDeviceObj)
{
ObDereferenceObject(m_LowerDeviceObj);
}
}
NTSTATUS CWdfDevice::CacheDeviceName()

View file

@ -139,6 +139,7 @@ public:
WDFDEVICE WdfObject() const { return m_Device; }
PDEVICE_OBJECT WdmObject() const { return WdfDeviceWdmGetDeviceObject(m_Device); };
PDEVICE_OBJECT LowerDeviceObject() const { return m_LowerDeviceObj; }
WDFIOTARGET IOTarget() const
{ return WdfDeviceGetIoTarget(m_Device); }
@ -155,6 +156,7 @@ private:
NTSTATUS AddQueue(WDF_IO_QUEUE_CONFIG &Config, WDF_OBJECT_ATTRIBUTES &Attributes, WDFQUEUE &Queue);
NTSTATUS CacheDeviceName();
CString m_CachedName;
PDEVICE_OBJECT m_LowerDeviceObj = nullptr;
friend class CWdfQueue;
};