I would like to reserve some SCSI disk(s) for the exclusive use of a certain KM component.
The very first idea that gets into my head is developing a lower filter for Partmgs.sys, with its filter device sitting in between PDO that is created by Disk.sys, and FDO that is created by Partmgr.sys.
It is understandable that Admin users have to specify that they want to reserve the target disk for our particular purpose, in the registry settings. It is also understandable that above mentioned registry settings have to ensure that, apart from the other things, the target disk is hidden from the volume manager, which means that no FS can be mounted on it. The way I understand it, setting the value at HKLM\System\CurrentControlSet\Enum\SCSI\\\Device Parameters\Partmgr to VDS_SP_OFFLINE is sufficient for this purpose (https://support.microsoft.com/en-us/help/2849097/how-to-set-the-partmgr-attributes-registry-value-using-powershell)
Our filter driver's AddDevice() routine is going to check the target disk's registry settings. If it sees that the disk in question is, indeed, reserved for our specific purpose, it is going to create, apart from the nameless device object that it attaches to the stack, its corresponding named standalone DO that is not a part of any stack. Once this DO is named, it is accessible to the "outside world", but no one, apart from our above mentioned "owner" component, knows about it.
As a result, our above mentioned "owner" component is going to be be, for all practical purposes, the exclusive "owner" of the target disk, which, due to its VDS_SP_OFFLINE registry setting, is going to be hidden from the rest of the world by Partmgr.sys. However, once our "owner" component happens to be aware of the named DO, it is in a position to directly send its requests to our filter,effectively bypassing Partmgr.sys. In order to do so, all that it has to do is to send a request to the named DO, which, in turn, is going to send its requests to Disk.sys down its corresponding filter DO's stack. Simple, ugh....
Otherwise, if AddDevice() routine finds out that the disk is question is not reserved for us, our filter driver is going to act just as a do-nothing pass-through filter that is devoid of any functionality and, by virtue of being a filter, is inaccessible to anyone, apart from its immediate neighbour above on the stack (because we are not going to create its corresponding standalone DO in this case ).
I just wonder if there may be any potential issues with this approach. To be honest, up to this point I don't see any - once the target disk is hidden from the rest of the world by Partmgr.sys we are not going to get into any conflict with anyone, so that we are in a position to safely do what we want with it. What do you think, guys?
It looks like you're new here. If you want to get involved, click one of these buttons!
|Upcoming OSR Seminars|
|Writing WDF Drivers||25 Feb 2019||OSR Seminar Space|
|Developing Minifilters||8 April 2019||OSR Seminar Space|