WinUSBWrappers v1.04 A C++ class
to provide a complete C++ encapsulation of WinUSB
The class provided is WinUSB::CDevice which provides a simple RAII wrapper
for programming to the WinUSB API for USB devices on Windows.
- Provides a simple C++ Header only module to easily encapsulate WinUSB.
- Integrates with STL's collection and string classes for easier
- Should make it easier to use WinUSB from C++ going forward.
- Provides a RAII wrapper for the WINUSB_INTERFACE_HANDLE handle of WinUSB
as well as the HANDLE returned from the CreateFile call when opening a WinUSB
- The class also provides generic enumeration of USB devices given a device
interface GUID, a USB PID and / or VID. This enumeration also is customizable
from client code using a function pointer callback.
The enclosed zip file contains the
WinUSBWrappers source code and a VC 2017 console based application which exercises
all of the class API methods. If the sample app detects that you have an OSR FX2
Learning Kit device attached to your computer then it will exercise all of the functionality
of this board via the WinUSBWrappers API methods. Even if you do not have one of
these devices attached the sample app will demonstrate enumeration of USB devices
using the WinUSB::CDevice::EnumerateDevices methods before it exits prematurely.
For more information about this device, please see
to purchase one of these devices. Most of the Microsoft documentation related to
WinUSB assumes you have one of these devices when learning WinUSB programming. Another
resource worth reading is
which provides a MFC wrapper class for WinUSB upon which WinUSBWrappers takes some
inspiration. For examples of all the WinUSBWrappers API methods please see the source
code of the demo application in the WinUSBWrappersDemo.cpp module in the download.
To install the FX2 device using a specific device interface GUID you might want
to take a look at http://zadig.akeo.ie/ which
allows a specific driver such as WinUSB to be associated with a specific USB device
as well as automating creation of signed inf driver installation files.
- You are allowed to include the source code in any product (commercial, shareware,
freeware or otherwise) when your product is released in binary form.
- You are allowed to modify the source code in any way you want except you
cannot modify the copyright details at the top of each module.
- If you want to distribute source code with your application, then you are
only allowed to distribute versions released by the author. This is to maintain
a single distribution point for the source code.
V1.04 (21 April 2019)
- Updated copyright details
- Updated the code to clean compile on VC 2019
V1.03 (28 September 2018)
- Updated copyright details.
- Fixed a number of C++ core guidelines compiler warnings. These changes
mean that the code will now only compile on VC 2017 or later.
- Removed code path which supported WINUSBWRAPPERS_MFC_EXTENSIONS define
V1.02 (30 October 2017)
- Updated copyright details.
- Added support for WinUsb_StartTrackingForTimeSync,
WinUsb_GetCurrentFrameNumberAndQpc & WinUsb_StopTrackingForTimeSync APIs.
- Replaced CString::operator LPC*STR() calls with CString::GetString
V1.01 (18 December 2015)
- Removed unnecessary inclusion of <functional> from module.
V1.0 (27 November 2015)