USBDeviceShare allows USB devices physically attached to one Windows machine (the Server) to be accessed remotely from another Windows machine (the Client) over a local network or the internet. The remote machine sees the device as if it were directly plugged in — the original USB device driver loads and operates normally on the client side.
[Server Machine] [Client Machine]
Physical USB Device App uses device normally
│ │
udsstub.sys udsbus.sys
(stub/func driver) ◄── TCP port 4540 ──► (virtual bus driver)
│ │
Server App (GUI) Client App (GUI)
- Server side: When a device is shared,
udsstub.sysis loaded over the physical USB device (replacing its original driver). It intercepts all USB requests (URBs) and forwards them to the server application, which ships them over TCP to the client. - Client side:
udsbus.sysis a virtual bus driver that presents a virtual USB device to Windows. The original USB device driver installs and runs on top of this virtual device exactly as it would on real hardware. The client application receives URB packets from the server and writes them to the bus driver to complete the IRPs. - 32/64-bit interoperability: The server and client can be different architectures (x86/x64). The
PacketTranslatorcomponent on the server translates URB structures between 32-bit and 64-bit pointer sizes transparently.
- Share any USB device class over TCP/IP (HID, mass storage, audio, serial, webcam, composite devices, etc.)
- Works over LAN or internet
- Server can initiate connection to client (callback mode), useful when client is behind NAT
- IP filtering — allow or block connections by IP address / hostname
- Password authentication for incoming connections
- Auto-share devices on plug-in
- Auto-start at Windows startup (tray mode)
- Per-device sharing properties (nick name, auto-share, inactivity timeout, deny-share)
- Device caching — remembers sharing preferences across restarts
- Visual Studio 2012 (v110 toolset) — for the Server and Client GUI applications
- Windows Driver Kit (WDK) — legacy build environment (
build.exe) for the kernel drivers (udsbus.sys,udsstub.sys) - MFC (static linking, included with Visual Studio)
- Windows Vista or later (x86 or x64)
- Administrative privileges required on both machines
- Driver signing: drivers must be signed (or test-signing must be enabled on the target machine for development)
Open a WDK build environment command prompt and run from the repo root:
build.batThis builds in order:
lib/→UsbLib.lib— shared URB serialization librarybus/→udsbus.sys— virtual bus driver (client side)func/→udsstub.sys— USB stub/function driver (server side)
Or build each individually:
cd lib && build -cz
cd bus && build -cz
cd func && build -czOpen USBDeviceShare.sln in Visual Studio 2012 and build, or use MSBuild:
msbuild USBDeviceShare.sln /p:Configuration=Release /p:Platform=Win32
msbuild USBDeviceShare.sln /p:Configuration=Release /p:Platform=x64Individual projects:
msbuild USBDeviceShare-Server\USBDeviceShare-Server.vcxproj /p:Configuration=Release /p:Platform=x64
msbuild USBDeviceShare-Client\USBDeviceShare-Client.vcxproj /p:Configuration=Release /p:Platform=x64Available configurations: Debug|Win32, Release|Win32, Debug|x64, Release|x64
- Install the virtual bus driver on the client machine (see below) first.
- Copy
udsstub.sysandushare-stub.infto adrivers\folder alongside the server application. - Run
USBDeviceShare-Server.exeas Administrator. - To share a device: select it in the list and click Share. The application will install
udsstub.sysover the device's existing driver automatically.
- Install the virtual bus driver using Device Manager or
pnputil:Then add the root-enumerated device (requires a small enumerator tool or devcon):pnputil -i -a ushare-bus.infdevcon install ushare-bus.inf root\udsbus - Run
USBDeviceShare-Client.exeas Administrator. - Add the server's IP address or hostname, then connect to the shared device.
USBDeviceShare.sln Master solution (all projects)
│
├── USBDeviceShare-Server/ Server GUI application (MFC)
│ ├── ServerFramework Core: manages shared devices, connections, protocol dispatch
│ ├── LocalDevice Per-device: loads stub driver, reads/writes URBs via IOCTL
│ ├── LocalDeviceManager Enumerates physical USB devices via SetupAPI
│ ├── PacketTranslator 32↔64-bit URB structure conversion
│ ├── Protocol Packet encoder/decoder (TCP, port 4540)
│ ├── NetworkManager TCP socket wrapper
│ └── DeviceCache Persists device sharing preferences
│
├── USBDeviceShare-Client/ Client GUI application (MFC)
│ ├── ClientFramework Manages server connections and remote device list
│ └── LocalDevice Per-device: plug-in/out virtual devices via bus IOCTL
│
├── bus/ udsbus.sys — virtual bus driver (client side, WDM)
│ └── repeater.c Core: shuttles URB packets between user-mode and PDO IRP queue
│
├── func/ udsstub.sys — USB stub/function driver (server side, WDM)
│ └── ioctl.c Exposes \\.\snusb device node; queues USB IRPs for user-mode pickup
│
├── lib/ UsbLib.lib — shared kernel library
│ └── urbmanager.c URB serialization/deserialization
│
├── inc/ Shared headers
│ ├── public.h IOCTL codes, bus plugin/unplug structures, GUIDs
│ └── ususb.h Platform-neutral US32_URB / US64_URB structure definitions
│
└── inf/ Copies of driver INF files for distribution
- Communication protocol: All packets follow
[ULONG packetSize][PACKET_TYPE][data]over a plain TCP stream. SeeUSBDeviceShare-Server/Protocol.hfor the full packet type enumeration and structures. Default port:4540. - URB packet format: Defined in
inc/ususb.h. EachIO_PACKETcontains the URB header plus serialized URB contents. Transfer buffers are appended inline after the URB structure. - Driver IOCTLs:
- Bus FDO (
inc/public.h):IOCTL_BUSENUM_PLUGIN_HARDWARE,IOCTL_BUSENUM_UNPLUG_HARDWARE - Bus PDO (
bus/repeater.h):IOCTL_BUSPDO_READ_PACKET,IOCTL_BUSPDO_WRITE_PACKET,IOCTL_BUSPDO_REGISTER_EVENTS - Stub driver (
inc/public.h):IOCTL_USBFUNC_READ_PACKET,IOCTL_USBFUNC_WRITE_PACKET,IOCTL_USBFUNC_REGISTER_EVENTS
- Bus FDO (
- Driver names:
udsbus.sys(bus, client side),udsstub.sys(stub, server side). Pool tag for both:UdsD('dsdU'). - The stub driver INF (
ushare-stub.inf) covers all USB device classes (USB\Class_00throughUSB\Class_ffandUSB\COMPOSITE), so it can be installed over any USB device.
This project is licensed under the GNU General Public License v3.0 (GPL-3.0).