/*++

    Copyright (c) Microsoft Corporation.  All rights reserved.

Rule Name:

    Irql_Filter_Driver_Function

Domain:

    ndis

Rule ID:

    Not Applicable

Description:

    This rule verifies that Filter related DDIs are only called at proper IRQL levels.
    Check for the proper IRQL when the function is entering.
    
    Related Rule:

Help Link:

    https://go.microsoft.com/fwlink/?LinkId=507169

--*/


#include "slic_base.h"

NdisEnumerateFilterModules.entry
{
    if ( sdv_irql_current != PASSIVE_LEVEL ) {
        abort "$fname should only be called at IRQL  = PASSIVE_LEVEL.";
    }
}

NdisFCancelSendNetBufferLists.entry
{
    if ( SDV_IRQL_ELEVATED_LEVEL(sdv_irql_current) ) {
        abort "$fname should only be called at IRQL <= DISPATCH_LEVEL.";
    }
}

NdisFDeregisterFilterDriver.entry
{
    if ( sdv_irql_current != PASSIVE_LEVEL ) {
        abort "$fname should only be called at IRQL  = PASSIVE_LEVEL.";
    }
}

NdisFDevicePnPEventNotify.entry
{
    if ( sdv_irql_current != PASSIVE_LEVEL ) {
        abort "$fname should only be called at IRQL  = PASSIVE_LEVEL.";
    }
}

NdisFIndicateReceiveNetBufferLists.entry
{
    if ( SDV_IRQL_ELEVATED_LEVEL(sdv_irql_current) ) {
        abort "$fname should only be called at IRQL <= DISPATCH_LEVEL.";
    }
}

NdisFNetPnPEvent.entry
{
    if ( sdv_irql_current != PASSIVE_LEVEL ) {
        abort "$fname should only be called at IRQL  = PASSIVE_LEVEL.";
    }
}

NdisFPauseComplete.entry
{
    if ( SDV_IRQL_ELEVATED_LEVEL(sdv_irql_current) ) {
        abort "$fname should only be called at IRQL <= DISPATCH_LEVEL.";
    }
}

NdisFRegisterFilterDriver.entry
{
    if ( sdv_irql_current != PASSIVE_LEVEL ) {
        abort "$fname should only be called at IRQL  = PASSIVE_LEVEL.";
    }
}

NdisFRestartComplete.entry
{
    if ( sdv_irql_current != PASSIVE_LEVEL ) {
        abort "$fname should only be called at IRQL  = PASSIVE_LEVEL.";
    }
}

NdisFRestartFilter.entry
{
    if ( SDV_IRQL_ELEVATED_LEVEL(sdv_irql_current) ) {
        abort "$fname should only be called at IRQL <= DISPATCH_LEVEL.";
    }
}

NdisFReturnNetBufferLists.entry
{
    if ( SDV_IRQL_ELEVATED_LEVEL(sdv_irql_current) ) {
        abort "$fname should only be called at IRQL <= DISPATCH_LEVEL.";
    }
}

NdisFSendNetBufferLists.entry
{
    if ( SDV_IRQL_ELEVATED_LEVEL(sdv_irql_current) ) {
        abort "$fname should only be called at IRQL <= DISPATCH_LEVEL.";
    }
}

NdisFSendNetBufferListsComplete.entry
{
    if ( SDV_IRQL_ELEVATED_LEVEL(sdv_irql_current) ) {
        abort "$fname should only be called at IRQL <= DISPATCH_LEVEL.";
    }
}

NdisFSetAttributes.entry
{
    if ( sdv_irql_current != PASSIVE_LEVEL ) {
        abort "$fname should only be called at IRQL  = PASSIVE_LEVEL.";
    }
}

