|
From: trobinson <tr...@pi...> - 2007-09-27 19:22:23
|
First, a thanks to Stephen Myers and the rest of the LibUsb-Win32 crew for an excellent universal USB driver. My next (All CSharp) version of LibUsbDotNet uses 3 (three) new IOCTL codes I'm hoping to get included in the LibUsb-Win32 project. LIBUSB_IOCTL_GET_REG_PROPERTY requests a device property by index using IoGetDeviceProperty. LIBUSB_IOCTL_GET_CUSTOM_REG_PROPERTY LIBUSB_IOCTL_SET_CUSTOM_REG_PROPERTY Get/Sets a custom property in the device objects registry key. I have allready modifed the libusb-win32 kernel driver source code to include these IOCTL codes. Attached is an HTML diff report. http://www.nabble.com/file/p12927507/LibUsbWin32Diff.html LibUsbWin32Diff.html I made no changes to the dll because LibUsbDotNet talks directly to the kernel driver. Why I Need this: 1) These IOCTL codes allow me to query basic device information of the attached USB devices without actually requesting descriptors. Some cheap USB devices don't deal well with control request if they are busy on other endpoints. 2) GET_CUSTOM_REG_PROPERTY gets the custom registry properties by name, mainly the "SymbolicName" of the device. The SymbolicName matches the name returned by WM_DEVICECHANGE notifications. This makes it easy to associate a LibUsb device with the WM_DEVICECHANGE notifications. 3) SET_CUSTOM_REG_PROPERTY is obviously a bit dangerous, LibUsbDotNet does not make any "Set" request to the device registry key. However, used with caution this could be very useful. It would enable someone to associate custom information with a USB device that is persistent acrossed boots. Regards, Travis Robinson tr...@pi... -- View this message in context: http://www.nabble.com/LibUsb-Win32-source-changes--tf4530174.html#a12927507 Sent from the LibUSB Dev - Win32 mailing list archive at Nabble.com. |
|
From: Spiro T. <an-...@sp...> - 2007-09-30 10:14:50
|
Hello, * On Thu, Sep 27, 2007 at 12:22:19PM -0700 trobinson wrote: > LIBUSB_IOCTL_GET_CUSTOM_REG_PROPERTY > LIBUSB_IOCTL_SET_CUSTOM_REG_PROPERTY > Get/Sets a custom property in the device objects registry key. I am asking myself if these do not open a security hole. I have not looked here into much detail, but which registry path do you open? Is it the one where the name of the driver is located? In this case, any user-mode program running on behalf of a user with almost arbitrary rights could replace the driver with another one. Even if this is not the case, one would have to *carefully* examine if there aren't other negative side-effects available. Travis, why do you need this patch? Perhaps, there are other, better solutions available than opening a (possibly negative) new API. Regards, Spiro. -- Spiro R. Trikaliotis http://opencbm.sf.net/ http://www.trikaliotis.net/ http://www.viceteam.org/ |
|
From: trobinson <tr...@pi...> - 2007-09-30 23:14:11
|
Spiro Trikaliotis-8 wrote: > I am asking myself if these do not open a security hole. I have not > looked here into much detail, but which registry path do you open? LIBUSB_IOCTL_GET_CUSTOM_REG_PROPERTY would open an retrieve values from the "Device Parameters" key. (Example HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\$VID_PID$\$SERIAL$\Device Parameters) Spiro Trikaliotis-8 wrote: > Travis, why do you need this patch? 1) To identify and distingush between different device/device instances (devices with equal PID and VIDs) attached to the PC without querying the USB device for its descriptor/config information. 2) Easily associate a "LibUsb" device with the WM_DEVICECHANGE notification via the "SymbolicName" key value. Spiro Trikaliotis-8 wrote: > Perhaps, there are other, better > solutions available than opening a (possibly negative) new API.? I wasn't aware of anthing negative? I'm trying to extend/increase/+ functionality. The best way to get this type of information is through the device driver, wouldn't you agree? Spiro Trikaliotis-8 wrote: > Even if this is not the case, one would have to *carefully* examine if > there aren't other negative side-effects available..? As I stated previously, LIBUSB_IOCTL_SET_CUSTOM_REG_PROPERTY is potentially dangerous. It can be omitted. Without the ability to "set" there wouldn't be any any danger of changing driver specific information. Only key "value" data would be returned. None of the internal objects can be changed, the new IOCTLs are completely independant from the others. Why I think this is no longer feasable: (The one MAJOR negative side-effect) ------------------------------------------------------------------------- After further research of the future libusb1 project, I've discovered that there is no libusb kernel driver on a vista machine, it is using winusb! Talking to libusb via the DLL is mandatory to stay compatibe with future versions. In order for this to work, it would have to be implemented in the dll as well. One of the first things the dll does is query device descriptor information in the "find_devices" function. All of this would have to work differently. Regards, Travis -- View this message in context: http://www.nabble.com/LibUsb-Win32-source-changes--tf4530174.html#a12971284 Sent from the LibUSB Dev - Win32 mailing list archive at Nabble.com. |
|
From: Xiaofan C. <xia...@gm...> - 2007-09-30 23:28:55
|
On 10/1/07, trobinson <tr...@pi...> wrote: > Why I think this is no longer feasable: (The one MAJOR negative side-effect) > ------------------------------------------------------------------------- > After further research of the future libusb1 project, I've discovered that > there is no libusb kernel driver on a vista machine, it is using winusb! > Talking to libusb via the DLL is mandatory to stay compatibe with future > versions. In order for this to work, it would have to be implemented in the > dll as well. One of the first things the dll does is query device > descriptor information in the "find_devices" function. All of this would > have to work differently. > However the libusb1 is not working yet (I tested the HID backend and it is not working with interrupt read/write. I have not tested the WinUSB backend under XP). And WinUSB is only for Vista/XP. Under Win98SE/Win2k/WinXp, it is still better to use libusb-win32 device driver. So I think your patch is still useful. Any examples of dealing with WM_DEVICECHANGE with your patched version of libusb-win32 and your C# wrapper? Xiaofan |