locked
Installing a driver filter for a parallel port RRS feed

  • Question

  • Hi,

    I'm developing my first driver and want to get the design right before embarking on what (I think) will be an interesting journey. I want to develop a driver that is able to dump data written from an LPT or parallel port to a file. At first glance and upper filter driver looks like a good option but this post from Eliyas Yakup who seems to be an authority points out the parallel port needs to be attached to and FDO rather than a PDO in this point.

    http://www.winvistatips.com/parallel-port-filter-microsoftrawport-t185549.html

    The definitions he refers to are here:

    http://msdn.microsoft.com/en-us/library/ff544284(v=vs.85).aspx

    On our machine, we have the "\Device\Parallelm" PDO defined but I can't find the FDO which would be "\Device\ParallelPortm" the same problem defined in the first post. Reading on the web it looks as though a FDO is not installed by default because parport.sys (the windows provided driver) runs as a MicrosoftRawPort which sounds as thoug applications write directly to it. Is there anyway to force the machine to use an FDO so that the filter driver will work?

    Many thanks,

    Richard

    Tuesday, February 22, 2011 4:06 PM

Answers

  • As Eliyas said in his post, if you need it for everything then you need a bus filter.  Unfortunately these are more complex to write and require WDM while a normal filter can be done in WDF with a lot less work.

    Did you choose this driver for a learning experience or because you need the capability?  If you are looking for a learning experience, there are better choices, depending on what your goals are.  If you need this for a real situation, I suggest you follow Eliyas's suggestion and try to get the toaster bus filter from Microsoft if they will give it to you.  If you fail there Walter Oney in "Programming the Microsoft Windows Driver Model" gives about a page on what is needed for a bus filter.

     

     


    Don Burn (MVP, Windows DKD) Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr
    Tuesday, February 22, 2011 4:37 PM

All replies

  • As Eliyas said in his post, if you need it for everything then you need a bus filter.  Unfortunately these are more complex to write and require WDM while a normal filter can be done in WDF with a lot less work.

    Did you choose this driver for a learning experience or because you need the capability?  If you are looking for a learning experience, there are better choices, depending on what your goals are.  If you need this for a real situation, I suggest you follow Eliyas's suggestion and try to get the toaster bus filter from Microsoft if they will give it to you.  If you fail there Walter Oney in "Programming the Microsoft Windows Driver Model" gives about a page on what is needed for a bus filter.

     

     


    Don Burn (MVP, Windows DKD) Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr
    Tuesday, February 22, 2011 4:37 PM
  • Thanks very much Don for your quick response. Unfortunately I do need to write it for a parallel port rather than just as an academic excercise. I wasn't sure from Eliyas' post whether he meant it couldn't be done at all from a parallel port without writing a bus driver or couldn't be done because it was attached to PDO as opposed to the FDO and wasn't receiving the information. I thought possibly installing another parallel port driver with an FDO as well as a PDO might allow the filter to be attached at the right level to receive the data.

    We also wouldn't have to filter all IRP's just the writes to get the data going down the bus (or to the funtion driver). Shame I didn't know about Walter's book earlier, I've just purchased Developing Drivers with the Windows Driver Foundation.

    Tuesday, February 22, 2011 6:51 PM
  • Well you will need Walter's book for WDM.  Take a look at the src\general\toaster\wdm\filter for a sample of a simple filter.  You are going to need to handle IRP_MN_QUERY_DEVICE_RELATIONS which is the key to a bus filter driver, since it is your only notification of a new PDO appearing.

     


    Don Burn (MVP, Windows DKD) Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr
    Tuesday, February 22, 2011 7:01 PM