none
inode Concept/Handle Private Data for Windows Drivers? RRS feed

  • Question

  • So I'm creating a driver that is supposed to allow a user process to register with it for special functionality and the driver is supposed to save a list of all processes that have such access.  I know in Linux, each user mode call to "open" gets it's own inode struct, and it has a special field for "private_data."

    I thought Windows would be the same, but I couldn't seem to find any sort of similar functionality.  It looks like calls to CreateFile merely just reference the driver object, but don't have their own handle fields for private data.  Or at least, not that I could find.

    Am I missing something, or am I going to have to create a different way to work the lookup table?

    Thanks!


    Friday, December 25, 2015 1:41 AM

Answers

  • Yes you are missing FILE_OBJECTS which are the equivalent of inodes.  In a KMDF driver you want to call WdfDeviceInitSetFileObjectConfig which will allow you to register Create, Cleanup and Close functions.  In the create function you can setup a file object context structure, and the use WdfRequestFileObject to get the file object and access the file object context.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Friday, December 25, 2015 2:14 AM

All replies

  • Yes you are missing FILE_OBJECTS which are the equivalent of inodes.  In a KMDF driver you want to call WdfDeviceInitSetFileObjectConfig which will allow you to register Create, Cleanup and Close functions.  In the create function you can setup a file object context structure, and the use WdfRequestFileObject to get the file object and access the file object context.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Friday, December 25, 2015 2:14 AM
  • To fix the above, the WdfRequestFileObject call can then be used with any call to the driver from the user application.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Friday, December 25, 2015 1:21 PM