none
Globals and driver extension RRS feed

  • Question

  • I've been reading this old article on OSR online and encountered the following statement regarding globals storing:

    "There is a wonderful thing called the driver extension which will happily store all "global objects" for you"..."you can store all your global objects in your driver extension and allocate them with your new operator in the driver entry".

    As far as I know the driver extension is an OS-defined structure that shouldn't be touched: http://msdn.microsoft.com/en-us/library/windows/hardware/ff544174(v=vs.85).aspx. Can anyone explain how these 2 statements can coexist?

    Wednesday, August 21, 2013 7:29 PM

Answers

All replies

  • As far as I know you cannot store anything with Driver Extension, all the documentation since it has been created indicates that the only field you can touch is AddDevice.  I believe this is a mistake by the author of the OSR article that probably got missed by OSR before publication.  I suspect the author confused DeviceExtension and DriverExtension.

    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Wednesday, August 21, 2013 7:43 PM
  • There is IoAllocateDriverObjectExtension and IoGetDriverObjectExtension, http://msdn.microsoft.com/en-us/library/windows/hardware/ff548233(v=vs.85).aspx and http://msdn.microsoft.com/en-us/library/windows/hardware/ff549229(v=vs.85).aspx .  In other words, no direct field access, but you can get at them. Typically these are used between a port and miniport driver. Declaring a global in code is much simpler and more easily accessbile than indirecting with these two APIs.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, August 21, 2013 8:18 PM