We developed a virtual storport driver that needs NIC essentially.
The problem is that NIC is shutdown while restarting or power off system so that storport cannot read or write some disk blocks at last.
I realized that KDNET is alive always.
So I thought that let’s make normal NICs to live until the end like to KDNET.
At first I tried to complete IRP (IRP_MJ_POWER, IRP_MN_SET_POWER) with STATUS_UNSUCCESSFUL in PCI bus driver(PDO) but it doesn’t work.
I think NDIS sends a shutdown to miniport driver first even though IRP_MJ_POWER is filtered in bus driver later.
Now I’m trying to add or remove some capabilities in NDIS filter driver but I’m not much familiar with NDIS.
Normal NIC and KDNET states are below.
[Realtek PCIe GbE Family Controller #2]
STATE
Miniport Running
Device PnP Started !miniport ffff8b00057531a0 -log
Datapath Normal
Interface Up
Media Connected
Power D0
References 0n11 !miniport ffff8b00057531a0 -ref
Total resets 0
Pending OID None
Flags BUS_MASTER, 64BIT_DMA, SG_DMA, CHECK_FOR_LOOPBACK,
DEFAULT_PORT_ACTIVATED, SUPPORTS_MEDIA_SENSE,
DOES_NOT_DO_LOOPBACK, MEDIA_CONNECTED
PnP flags RECEIVED_START, HARDWARE_DEVICE
[Microsoft Kernel Debug Network Adapter]
STATE
Miniport Running
Device PnP Started !miniport ffff8b00063f61a0 -log
Datapath Normal
Interface Up
Media Connected
Power D0
References 2 !miniport ffff8b00063f61a0 -ref
Total resets 0
Pending OID None
Flags NOT_BUS_MASTER, ALLOW_BUGCHECK_CALLBACK,
BUGCHECK_CALLBACK_REGISTERED, DEFAULT_PORT_ACTIVATED,
SUPPORTS_MEDIA_SENSE, DOES_NOT_DO_LOOPBACK,
MEDIA_CONNECTED
PnP flags VIRTUAL_DEVICE, HIDDEN, NO_HALT_ON_SUSPEND,
RECEIVED_START
The difference is NO_HALT_ON_SUSPEND? How can I add that flag? Is that flag all I need to add?
If NDIS filter driver cannot prevent NIC from shutdown how to do it?
Thank you for any suggestions.