Hi all,
I am trying to develop a pci bus filter driver that reads the configuration space of its devices and it has been really challenging just to start off. I have done lots of research here and on MSDN forums, and I understand that to develop such a driver, I need to know deeply the ins and outs of WDM. In fact, I have been studying the book “Programming The Microsoft Windows Driver Model” written by Walter Oney, which I think is the only reference out there. Unfortunately, there is not much guidance out there for this endeavor.
Based on this book, we start developing just a small sample of the driver, just to see the AddDevice function being called. First, we defined the class filter on the INF file by specifying the class key [1] and appending it to the UpperFilters list. I understand that this is the easy part based on the book “just make yourself a device UpperFilter in the hardware key for the bus driver”. In the DriverEntry routine, I defined a callback to all major PNP IRPs and also for the AddDevice function.
As I understood, in the AddDevice function I need to attach only to the device that has DEVPKEY_Device_EnumeratorName related to pci (because there are other types of buses). Besides that, when I tried to debug, I thought that the AddDevice function would be called by the PnP, but this did not happen (the DriverEntry worked, I could debug it). So, I had the brilliant idea of restarting the VM, which crashed the system. Am I missing something here in the installation process?
Let’s say that the AddDevice function is working and I insert my filter on each child device stack right about the PDOs that the bus driver creates, what would be the next steps? I know that there are PnP and also the Power Management transitions to support, but this is still too abstract for me. I probably know the answer for that, but are there any samples of this kind of driver out there? Some documentation, or maybe something about this state machine that needs to be implemented for the PnP and Power Management.
[1] - CLASSKEY=System\CurrentControlSet\Control\Class{4d36e97d-e325-11ce-bfc1-08002be10318}