Currently we stop redirection when filter device file handle
closed. This might be incorrect if some application just opens
and closes the file. Log entry with process id will help
diagnosing such problems.
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
This class will be used by following patches to
implement hiding via patching device IDs.
See commit messages of corresponfing patches
for rationale.
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
STALL condition on control pipe cleared automatically
by underlying infrastructure. Do not report it to client
otherwise it may decide to clear it via ResetPipe and
reset of control pipe is not supported by WDF.
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
This reverts commit 32aadcb4fe.
Reverting commit because a regression was discovered on some devices.
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
This is a cosmetic change that unifies naming convention
in UsbDk public API.
WARNING: This change breaks compilation of client code.
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
This commit fixes issues with accessing USB devices on
some USB host controllers.
Before this fix UsbDk assumed IO type NEITHER for
ReadFile/WriteFile operations performed on captured
USB device. This assumption is not true in some cases
because UsbDk creates filter devices which use the
same IO type as device being filtered, i.e. IO type
is effectively defined by USB host controller driver.
While some host controllers work in NEITHER IO mode,
others use DIRECT IO instead. When capturing device
plugged into such a controller UsbDk failed to retrieve
ReadFile/WriteFile buffers because there are different API
used different IO types and UsbDk used the wrond one.
This patch changes UsbDk DLL/Driver interface to use IOCTL
for ReadPipe/WritePipe operations. Since IO type for IOCTL
requests is determined by IOCTL code and not by target device
settings UsbDk need not consider IO type used by the host
controller being filtered.
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
Return number of bytes transferred without transfer header.
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
This patch fixes 2 issues from Bugzilla:
1. BZ#1136908 - Windows XP launches "Found New Hardware" dialog
when the device gets redirected after plugging
2. BZ#1101593 - Windows reports unsuccessful driver installation
after USB redirection
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
WDF request completion information must always be
sizeof(USBDK_TRANSFER_REQUEST) because this is what
user mode passes to Read/Write syscalls.
The length of transfered data must be always returned via
USB_DK_TRANSFER_RESULT structure.
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
This is a refactoring commit to make code more simple.
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
According to spec control transfer may have no data buffer.
Make driver process cases like this properly.
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
Symlinks not needed anymore since we create redirector handles
in kernel.
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
This commit makes redirection creation atomic operation
from user mode client point of view.
This ensures redirection will be stopped automatically
in case of unexpected user mode client termination.
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
This makes include policy more strict and ensures
all system includes properly wrapped with extern "C"
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
OnClose is called when device symlink is fully closed by used mode.
For redirector strategy OnClose stops redirection.
For other strategies OnClose is currently no-op.
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
Introduce separate queues for different types of requests:
1. Read/Write queue
2. Configuration (IOCTL) queue
This is needed to stop transfers during reconfiguration.
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>