Commit graph

120 commits

Author SHA1 Message Date
Yuri Benditovich
b7acf791dc Hider API: add ability to delete all persistent rules
The application that uses Hider API does not have an ability
to query which persistent rules exist. So in order to use
UsbDk_DeletePersistentHideRule the application shall guess
which rule it needs to delete. Current commit adds ability to
delete all existing the persistent rules. This API requires
administrative privileges as all APIs related to persistent
hide rules.

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
2019-04-15 11:19:13 +03:00
Yuri Benditovich
12f71a300b implement read/write/compare operations for extended rules
This commit adds implementation of registry operation for
extended rules in user-mode. Kernel driver still recognizes
all the entries as default ones (it ignores the Type value).

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
2019-04-15 11:19:13 +03:00
Yuri Benditovich
fe0a2ca005 extend Hider API by adding extended hide rules
Added:
UsbDk_AddExtendedHideRule
UsbDk_AddExtendedPersistentHideRule
UsbDk_DeleteExtendedPersistentHideRule
All existing APIs continue working as before.

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
2019-04-15 11:19:13 +03:00
Yuri Benditovich
3652e2a34d Preparation for extended rules for device hide
Extend structure USB_DK_HIDE_RULE by adding 'Type'
member derived from backward-compatible structure
USB_DK_HIDE_RULE_PUBLIC. Public API procedures of UsbDkHelper
receive USB_DK_HIDE_RULE_PUBLIC describing hiding rules.
Internally UsbDk works with extended structure.

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
2019-04-15 11:19:13 +03:00
Yuri Benditovich
4473e41ab3 Update project files for build with higher WDK installed
When higher WDK than 14393 is installed on the machine, the modified
files related to build of drivers and driver-related applications may
produce errors on build using VS2015. Fixed project files solve this.

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
2019-01-27 11:57:49 +02:00
Yuri Benditovich
19667102ee Revert commit f2dae22029
This reverts previous commit that actually has removed the check
that the driver is accessible. Prior to removal this at least should
be investigated in corner cases which are also to be defined
(like UsbDk uninstall when it has active redirected device).

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
2018-10-10 11:31:56 +03:00
golden
f2dae22029 Delete unused local variable
Closes #56
2018-04-11 13:46:36 +03:00
Sameeh Jubran
5dda7555c5 Installer: Abort installation if the driver fails to start
Currently, in some cases, attempting to start the driver can fail
and cause Usb devices to become non functional. An example of such
case is attemteting to install an unsigned version of UsbDk on Windows
where the driver signature enforcement is enabled. The reason why this
happens is not making sure the driver can start on the system prior to
attaching it to all of the devices.

This patch solves this issue by checking that the driver can start on the
system prior to step 2 in the list below.

UsbDk's installation process:
1) Create and register UsbDk's service
2) Add UsbDk to the registry
3) Reset all Usb host conrollers on the system
4) PNP manager attaches and starts the driver for each Usb device's stack

Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2017-05-29 16:45:38 +03:00
Sameeh Jubran
e7b4fd2391 ServiceManager: Add Start and Stop methods
Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2017-05-29 16:45:32 +03:00
Dmitry Fleytman
446daeca3e Build: Introduce debug configurations without test signing
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
2017-04-06 13:24:06 +03:00
Sameeh Jubran
2cd4aa5262 Build: Migrate to VS 2015 and add Win10 configurations
This commit migrates from VS 2013 to VS 2015. Beside the auto conversion
which was performed by VS this commit includes the following fixes
which enabled the builld to work:

Win (7, 8, 8.1, 10):
* Set the KMDF Version Major to 1.
* Set the KMDF Version Minor to 11.

Win XP:
* Add _When_ define.
* Add empty implementation to guard functions which else would cause an
  unresolved symbols.
* Add path to WinDDK's wdfinstaller.h in UsbDkHelper project.
* Add "GetDriverProjectAttributes" and "GetPackageFiles" targets to
  UsbDkController, UsbDkHelper and UsbDkInstHelper project files.

Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2017-04-03 15:06:47 +03:00
Dmitry Fleytman
d47bd4d237 UsbDkHelper: Do not print API errors to console
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2017-02-07 15:59:58 +02:00
Sameeh Jubran
1340ea01e2 UsbDkHelper: Add static modifier to printExceptionString function
Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
2017-01-26 18:03:27 +02:00
Sameeh Jubran
b0660af0d1 UsbDKHelper: Add unpackHandle function
unpackHandle checks if the provided HANDLE is null or has an
INVALID_HANDLE_VALUE and casts it to the suitable data type.
This check can prevent the UsbDkHelper from crashing becuase of api misuse.

Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
2017-01-26 18:03:20 +02:00
Dmitry Fleytman
1a97440166 UsbDk: Propagate USBD errors to user mode clients
WARNING: This patch breaks compilation of client code
due to changes in interface structures.

Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-11-24 13:04:17 +02:00
Dmitry Fleytman
d5f12a4699 UsbDk: Eliminate camelCase notation from interface definitions
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>
2015-11-24 13:04:17 +02:00
Dmitry Fleytman
4a0354fdcd UsbDk: Perform ReadPipe/WritePipe via IOCTLs
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>
2015-10-28 09:11:41 +02:00
Dmitry Fleytman
29814251f4 UsbDk: Introduce UsbDk_ResetPipe() user mode API
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-05-03 10:36:23 +03:00
Dmitry Fleytman
a80fa35e1d UsbDkHelper: Fix debug traces for WoW64 operation
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-03-31 11:13:18 +03:00
Dmitry Fleytman
bc4d72510f UsbDkHelper: Fix path to UsbDkHelperHider.h in vcxproj
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-03-25 17:38:02 +02:00
Dmitry Fleytman
ec04c9a874 trivial: cleanup comments
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-03-25 17:38:00 +02:00
Dmitry Fleytman
456334a73f UsbDkHelper/Controller: Update persistent hide rules after modification
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-03-25 17:37:57 +02:00
Dmitry Fleytman
eb8c876fc9 UsbDkHelper: Add persistent hide rules interface
Signed-off-by: Kirill Moizik <kirill@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-03-25 17:37:52 +02:00
Dmitry Fleytman
408a78785a UsbDkHelper: Introduce class for hide rules management
Signed-off-by: Kirill Moizik <kirill@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-03-23 13:24:09 +02:00
Kirill Moizik
ae3258facb UsbDkHelper: Introduce key iterator for RegAccess
Signed-off-by: Kirill Moizik <kirill@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-03-23 13:24:03 +02:00
Kirill Moizik
0f2b5bdd48 UsbDkHelper: Make RegAccess class more const correct
Signed-off-by: Kirill Moizik <kirill@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-03-23 13:24:02 +02:00
Dmitry Fleytman
b69ef92acd UsbDkHelper: Fix return value of RegAccess::AddKey()
Signed-off-by: Kirill Moizik <kirill@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-03-23 13:24:02 +02:00
Dmitry Fleytman
44d116f79d UsbDkHelper: RegAccess class beautifications
Signed-off-by: Kirill Moizik <kirill@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-03-23 13:24:01 +02:00
Kirill Moizik
82dc647a24 UsbDkHelper: Introduce UUID generator (CGuid class)
Signed-off-by: Kirill Moizik <kirill@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-03-23 13:24:00 +02:00
Dmitry Fleytman
142d173313 UsbDkHelper: Beautify hider API documentation
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-03-22 15:32:08 +02:00
Dmitry Fleytman
5c68865e9c UsbDkHelper: Eliminate a line ending space
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-02-26 09:13:36 +02:00
Dmitry Fleytman
3f4d0c1729 UsbDkHelper: API documentation beautifications
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-02-24 16:05:05 +02:00
Dmitry Fleytman
b44b6cb815 UsbDkHelper: Add API documentation
Signed-off-by: Kirill Moizik <kirill@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-02-17 09:13:09 +02:00
Dmitry Fleytman
e389fb7924 UsbDkHelper: Introduce hider API
Signed-off-by: Kirill Moizik <kirill@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-02-17 09:13:05 +02:00
Dmitry Fleytman
4f85a11570 Install: Introduce helper application for MSI installer
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-11-13 17:34:45 +02:00
Pavel Gurvich
55181c11b9 UsbDkHelper: Drop unnessesary forward declaration
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-10-02 15:12:14 +03:00
Dmitry Fleytman
5a94f3e505 UsbDkHelper/Controller: Beautify error messages
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-09-11 09:35:49 +03:00
Pavel Gurvich
2757bfc506 UsbDkHelper: Remove unused RemoveRedirect method
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-20 17:28:52 +03:00
Dmitry Fleytman
d9aa8f4621 Build: Add version information into binaries
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-12 11:29:47 +03:00
Pavel Gurvich
6c1f136844 UsbDkHelper: Fix processing of reboot needed case on install
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-08-11 13:23:51 +03:00
Dmitry Fleytman
816de3e6a2 Build: Make build tree structure more formalized
1. Put all build output under Install/Install_Debug folders
2. Make x86/x64 paths symmetrical

Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-07-31 15:53:18 +03:00
Pavel Gurvich
99f3c0dbef UsbDkHelper: Open redirector handle in driver
This commit contains user mode adaptations for
driver interface changes introduced by previous commit.

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-12 01:00:08 +03:00
Dmitry Fleytman
f1208b981f UsbDK-XP: Change WDF version from 1.11 to 1.09
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-09 11:50:28 +03:00
Dmitry Fleytman
447de6ad71 build: add XP/2003 configurations
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-06-01 23:01:13 +03:00
Pavel Gurvich
310ef26669 UsbDkHelper: remove unnecessary call to RemoveRedirection
With new kernel mode code redirection stops automatically
when redirector handle is closed.

Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-05-31 19:21:04 +03:00
Pavel Gurvich
6239ffba38 UsbDkHelper: Introduce ResetDevice API
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-05-26 18:42:52 +03:00
Pavel Gurvich
02076801c4 UsbDkHelper: Add UsbDk_SetAltsetting API
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-05-26 18:41:17 +03:00
Pavel Gurvich
225d12c9d8 UsbDk: Drop Control Transfer IOCTL
Signed-off-by: Pavel Gurvich <pavel@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-05-26 18:41:13 +03:00
Dmitry Fleytman
f62fec1f34 UsbDkHelper: Fix handle leak in IoctlSync()
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-05-20 12:03:24 +03:00
Dmitry Fleytman
56590de5de UsbDkHelper: Make service manager class use generic handle holder
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2014-05-20 12:03:23 +03:00