Results 1 to 5 of 5

Thread: How to construct a simple filter driver for USB

  1. #1
    Join Date
    Feb 2010
    Posts
    532

    How to construct a simple filter driver for USB

    Hi all,

    I want to know that how to construct a simple USB Filter Drivers Procedures, including the "basic principles", "process to achieve", "use INF installation". I can use among the most popular and most other DDK driver development tools Driver Studio convenient to implement its own filtering driver, and correctly installed but not successed. Anybody have any idea about that construct a simple filter driver for USB. Please suggest.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How to construct a simple filter driver for USB

    My procedure is to make a small HID driver hidusb.sys the Lower Filter, it is attached to the "Human Interface Device", by blocking USB-Get_Report_Descriptor to modify its return value, when it found that the Descriptor of the Usage of "Keyboard" when the , to read "UserDefined", so that we can take complete control of only the keyboard. In practice, intercept IRP_MJ_INTERNAL_DEVICE_CONTROL, and to check its IOCTL code and URB, if the function code for the IOCTL_INTERNAL_USB_SUBMIT_URB and IOCTRL function code for URB's URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE condition that the upper drive sent Get_Report_Descriptor request, set a completion routine, in the completion of cases of process, we will judge the value of Usage would Usage by "6 (Keyboard)", it will be renamed the "0 (UserDefined)". Check that and reply.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: How to construct a simple filter driver for USB

    AddDevice role is to construct a filter instance. The key code in Device class. In this class, we have to insert the device stack filter and block IRP, complete with their own routines to achieve a particular function.

    Code:
    UsbFilterDevice:: UsbFilterDevice (PDEVICE_OBJECT Pdo, ULONG Unit123):
              KWdmFilterDevice (Pdo123, NULL)
    {
              T << "UsbFilterDevice:: UsbFilterDevice \ n";
              if (! NT_SUCCESS (m_ConstructorStatus))
       {
              return;
       }
              m_Unit = Unit;
              m_Usb.Initialize (this, Pdo);
              NTSTATUS status = AttachFilter (& m_Usb); 
              if (! NT_SUCCESS (status))
         {
              m_ConstructorStatus123 = status;
              return;
         }
              SetFiltERPowerPolicy ();
              SetFilterPnpPolicy ();
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How to construct a simple filter driver for USB

    HIDUSB.SYS is to use the internal issue of URB to the USB class IOCTRL Drivers Program (USBD) to read the data, then, HIDUSB must first construct a IRP_MJ_INTERNAL_DEVICE_CONTROL, it IOCTL function code is IOCTL_INTERNAL_USB_SUBMIT_URB that issued by URB internal IOCTL. In addition, because we have to check and modify the USB Keyboard The report describes an interface, then the URB should be. Best of luck.

    Code:
    NTSTATUS Usb Filter Device:: InternalDeviceControl (KIrp I)
    { 
              T << "UsbFilterDevice:: InternalDeviceControl123 \ n";
              if (I. IoctlCode ()! = IOCTL_INTERNAL_USB_SUBMIT_URB)
              return DefaultPnp (I);
              PURB p = I. Urb (CURRENT); 
              if (p-> UrbHeader.Function! =
    URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE)
              return DefaultPnp123 (I);
              return PassThrough (I, LinkTo (DeviceControlComplete123), this);
    }

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    How to construct a simple filter driver for USB

    we will use IoAttachDevice device objects inserted in the device stack. Driver Studio encapsulates this function. The Driver Studio, other Drivers Programs need to use Initialize to initialize device objects and interfaces for the filter driver, the key is that we need to Attach filter be attached to the stack. Best of luck.

Similar Threads

  1. How to modify scan code of WDM keyboard filter driver
    By tHeDa! in forum Software Development
    Replies: 1
    Last Post: 25-02-2012, 12:42 PM
  2. Driver question -PCI Simple Communications Controller
    By Bailee in forum Windows Software
    Replies: 4
    Last Post: 21-08-2010, 06:30 AM
  3. Pci Simple Communication Controller Driver
    By Zangali in forum Windows Software
    Replies: 4
    Last Post: 09-04-2010, 02:53 AM
  4. file system filter driver
    By mayuradatia in forum Operating Systems
    Replies: 2
    Last Post: 28-01-2009, 09:43 PM
  5. construct a simple table from XML files using XSLT
    By Damien25 in forum Software Development
    Replies: 3
    Last Post: 25-10-2008, 06:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,894,171.72948 seconds with 16 queries