My question is regarding driver development for Windows 7.
I need to intercept system calls to a driver. Theoretically in such cases it's recommended to create a filter driver, however in my case the driver doesn't expose a filter-compatible interface. It's a Vista/7 display miniport driver to be exact.
Display driver is loaded as a standard WDM driver. In its DriverEntry
it's expected to call a DxgkInitialize
system routine (exported by win32k.sys I guess). My goal is to intercept this call.
Can anyone suggest me any useful source I can find information about how to achieve this?
The key to the victory is probably replacing the DxgkInitialize
within the driver executable import section with the address of my function. The problem is that this should be done after the executable is loaded (mapped + relocated if necessary + all the import table entries are prepared), but before the driver's entry point is invoked.
I thought about the following options:
- Map the executable into the system memory and "prepare" it manually (i.e. do the work of the loader). Then patch the needed function(s) and run the entry point.
- With some effort
ZwSetSystemInformation
can be used for module loading (?) - Maybe patch the export section of the module that exports
DxgkInitialize
. So that the loader automatically will redirect every loaded module into my hands.
Thanks in advance.