2

I'm attempting to port some C source (Linux) using libusb to C# (Windows). I successfully installed LibUsbDotNet on Windows 7. Then I proceeded to add using MonoLibUsb, since it looks like the easiest path for porting. However, when running there's an exception saying that libusb-1.0.dll is missing. And indeed, I can't seem to find it in C:\Windows\System32. So, two questions

  1. Where can I find it? Searching online hasn't revealed any handy installer packages.
  2. Why isn't it installed as part of LibUsbDotNet? AFAICS the lack of it makes half of LibUsbDotNet unusable.
Magnus
  • 4,644
  • 1
  • 33
  • 49
  • It is winusb.dll on Windows. Use [the right project](http://winusbnet.codeplex.com/) to get a decent start. – Hans Passant Aug 14 '14 at 08:48
  • Well, since it's C code using libusb that I'm porting to C# was hoping to not have to jump to a completely different API. But I guess it would be too easy if things just worked on Windows. – Magnus Aug 14 '14 at 12:16
  • No, WinUsbNet doesn't seem to be a good option. First, I can't get the INF-creator to actually create an INF-file. Second, after using `zadig` to connect the winusb driver to my device I realised that while the entire world, including the USB spec, is using VID:PID, it won't help me at all with WinUsbNet. Somehow I need to know some GUID (that is exposed in the defunct INF-creator, but not in zadig) in order to find the device I'm interested in! – Magnus Aug 14 '14 at 12:56

1 Answers1

3

Stumbled under the same issue one year after your post while compiling a C# program using the LibUsbDotNet library:

PS C:\src\FaultMonitor\FaultMonitor\bin\Debug> .\FaultMonitor.exe -u
An error occured while executing the proxy:
libusb-1.0.dll not found. If this is a 64bit operating system, ensure that the 6
4bit version of libusb-1.0.dll exists in the '\Windows\System32' directory.
at MonoLibUsb.MonoUsbSessionHandle..ctor()

For anyone in a similar predicament, download the libusb library and extract the contents (you will need 7zip). Within the extracted contents, copy the \MS32\dll\libusb-1.0.dll into your C:\windows\SysWOW64\ folder and copy the \MS64\dll\libusb-1.0.dll into your C:\windows\System32\. Afterwards, the program ran no problem:

PS C:\src\FaultMonitor\FaultMonitor\bin\Debug> .\FaultMonitor.exe -u
[15-10-23.02:09:05][+] Device: VendorID: 4203, ProductID: 63, Address: 1
[15-10-23.02:09:05][+] Device: VendorID: -32530, ProductID: 33, Address: 2
InfectedPacket
  • 264
  • 2
  • 8
  • 1
    did not fix the problem on my end.. still have the same issue – Dan Bradbury Dec 19 '18 at 17:50
  • Didn't work for me either. Tried cleaning and rebuilding the project, restarting VS (2019), etc. Same error. This is a bit of a joke; installing LibUsbDotNet via NuGet just doesn't seem to been tested properly. And the doco mentions none of this. – SteveCinq Jul 01 '22 at 17:31