Summary of Changes Required to Port a Protocol Driver to NDIS 6.0
This topic provides a summary of the changes that are required to port an NDIS 5.x protocol driver to NDIS 6.0. Porting earlier drivers is similar to porting NDIS 5.x drivers. To run in the NDIS 6.0 environment, NDIS 5.x protocol drivers must be modified as follows:
Build Environment
Replace the preprocessor definition NDIS51 with NDIS60.
Set the NDIS version to 6.0 in the MajorNdisVersion and MinorNdisVersion members of the NDIS_PROTOCOL_DRIVER_CHARACTERISTICS structure (formerly NDIS_PROTOCOL_CHARACTERISTICS) that is passed to the NdisRegisterProtocolDriver function.
Set the protocol driver version in the MajorDriverVersion and MinorDriverVersion members of the NDIS_PROTOCOL_DRIVER_CHARACTERISTICS structure to an appropriate driver-specific value.
Define new entry points and replace obsolete entry points in the NDIS_PROTOCOL_DRIVER_CHARACTERISTICS structure. For example, the ProtocolBindAdapterEx function replaces the ProtocolBindAdapter function.
If the protocol driver uses optional handlers, add the entry point for the ProtocolSetOptions function to the NDIS_PROTOCOL_DRIVER_CHARACTERISTICS structure. To register optional handlers, ProtocolSetOptions calls the NdisSetOptionalHandlers function.
In the DriverEntry routine, replace the call to the NdisRegisterProtocol function with a call to the NdisRegisterProtocolDriver function. If an error occurs after a successful call to NdisRegisterProtocolDriver, the driver must call the NdisDeregisterProtocolDriver function before DriverEntry returns.
Optionally create the protocol driver's ProtocolUninstall function or, if it exists, update it. The ProtocolUninstall entry point is in the NDIS_PROTOCOL_DRIVER_CHARACTERISTICS structure.
To deregister the protocol driver, the driver must call the NdisDeregisterProtocolDriver function from its Unload routine.
Protocol Bind and Unbind Operations
In NDIS 6.0, the bind and unbind functions receive all of the required binding information from NDIS. Protocol drivers should not issue OID queries to obtain information that is included in the NDIS_BIND_PARAMETERS structure.
Rewrite the ProtocolBindAdapter function (renamed ProtocolBindAdapterEx) to support the NDIS_BIND_PARAMETERS structure.
Replace calls to the NdisOpenAdapter function with calls to the NdisOpenAdapterEx function.
Rewrite the ProtocolOpenAdapterComplete function (renamed ProtocolOpenAdapterCompleteEx).
To support the returned status, modify the protocol driver's ProtocolUnbindAdapter function (renamed ProtocolUnbindAdapterEx).
Replace calls to the NdisCloseAdapter function with calls to the NdisCloseAdapterEx function.
Rewrite the ProtocolCloseAdapterComplete function (renamed ProtocolCloseAdapterCompleteEx).
Send and receive data paths should support multipacket operations.
Rewrite the send and receive code paths to use NET_BUFFER structures and NET_BUFFER_LIST structures instead of NDIS_PACKET structures.
Protocol drivers should not use OID queries to obtain link status information. Instead, protocol driver should use status indications from underlying drivers for status changes in link parameters.
Replace calls to the NdisRequest function with calls to the NdisOidRequest function.
Rewrite the ProtocolRequestComplete function (renamed ProtocolOidRequestComplete) to support the NDIS_OID_REQUEST structure.
To cancel OID requests, call the NdisCancelOidRequest function.
Use status indications from underlying drivers for status changes in link parameters.
Rewrite the ProtocolStatus function (renamed ProtocolStatusEx) to support the NDIS_STATUS_INDICATION structure.
- Replace the ProtocolPnPEvent function with the ProtocolNetPnPEvent function.
- Include NDIS 6.0 protocol binding pause and restart functionality. For more information about binding states, see Supporting NDIS 6.0 Protocol Binding Pause and Restart Operations.