NIDS PowerManagementCapabilitiesEx parameters

Hello. I’m an NDIS newbie so apologies if I’m not explaining this well. I’m trying to enable wake on lan functionality for a NDIS miniport (6.40) . As as starting point I’ve enabled set the PowerManagementCapabilitiesEx of the NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES
to variations of the following

NdisZeroMemory(npmc, sizeof(NDIS_PM_CAPABILITIES));

npmc->Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
npmc->Header.Revision = NDIS_PM_CAPABILITIES_REVISION_2; // NDIS 6.30
npmc->Header.Size = NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_2; // NDIS 6.30

npmc->MinMagicPacketWakeUp = NdisDeviceStateD3;
npmc->MinPatternWakeUp = NdisDeviceStateD3;
npmc->MinLinkChangeWakeUp = NdisDeviceStateUnspecified;
npmc->SupportedWoLPacketPatterns = NDIS_PM_WOL_MAGIC_PACKET_SUPPORTED | NDIS_PM_WOL_BITMAP_PATTERN_SUPPORTED;
npmc->SupportedProtocolOffloads = NDIS_PM_PROTOCOL_OFFLOAD_ARP_SUPPORTED;

And I’ve cleared the NDIS_MINIPORT_ATTRIBUTES_NO_HALT_ON_SUSPEND flag in the registration attributes per the guidance in https://community.osr.com/discussion/comment/193372#Comment_193372.

When I run !ndiskd.miniport ffffe502bef741a0 -pm it reports that none of these are set

Wake event Minimum power required
Magic packet Not supported
Bitmap pattern Not supported
Link change Not supported

Active Capabilities (OID_PM_PARAMETERS):
WoL patterns       [No flags set]
Protocol offloads  [No flags set]
Wake flags         [No flags set]

I don’t see the Power managemnt tab in device manager. Moreover if I look at the power data via device manager’s details tab I see

Power Capabiliies
PDCAP_D0_D3_SUPPORTED
PDCAP_D3_SUPPORTED

But not for exmaple the PDCAP_WAKE_FROM_D3_SUPPORTED

In addition I’m not seeing the query for power related OIDs: Specifically OID_PM_PARAMETERS.
It feels lke the parameters I set via PowerManagementCapabilitiesEx. Can anybody see anything obviously wrong with this? And should I expect to at least see the power management tab once I’ve enabled this?

You seem to be missing a lot of the pm settings used in the sample ndis6.3 on github here:
https://github.com/microsoft/Windows-driver-samples/blob/110e8c201d5a929fc01e333ceac0dc71b0267237/network/wlan/WDI/PLATFORM/NDIS6/SDIO/N6Sdio_main.c#L6376

For example, are you setting npmc->NumTotalWoLPatterns ?

Hi Mark. Thanks for the helpful response and the reference. I’ve been experimenting with various permutations of these but not really making any progress. I’m wondering now whether this is even possible in my scenario. This is basically a research task for a virtual adapter on a split-tunnel to see if we can wake the computer when a magic packet is sent to the virtual adapter. I was perhaps naively thinking to forward any WOL packets for the virtual adapter to the physical network interface which already supports WOL. Am I correct in understanding that the virtual adapter’s driver should still be active when the machine is sleeping (I thought this was the case but it’s difficult to debug over the network while the target is sleeping. The USB ports on my target don’t support Debugging though I assume I would have the same problem with USB debugging too?

If you are trying to wake the host by sending something to one of its vms, that seems not likely to work.
However, if the PM property page for your virtual adapter is not showing up then you are not setting the poorly documented fields for PM correctly. I would get that working first, or maybe not at all if in fact you really are attempting to wake up the host by sending a packet to it’s vm. I think you need to wake up the host first?