In a Windows device driver:
DEVICE_OBJECT.DeviceExtension
As far as I understand, a CreateFile
constructs a FILE_OBJECT
in the kernel space, so each open instance of a device has its own FILE_OBJECT
. If so, can I keep my per-instance information in the IO_STACK_LOCATION.FileObject.FsContext
field?
Reading the FsContext discription of the MSDN page says yes for FDOs and no for other types of drivers.
NB: Do you implement your own IRP_MJ_CREATE function? If yes, you may use the member, due to you being the creator of the file object.