/*++

    Copyright (c) Microsoft Corporation.  All rights reserved.

Rule Name:

    NdisMNetPnPEventInOIDRequest

Domain:

    ndis

Rule ID:

    Not Applicable

Description:

    This rules checks that NdisMNetPnPEvent is not called ina context of an OID request.

    The rules uses a binary state to decide if the current symbolic execution is 
    internal tominiportOidRequest or not. In case it is in check ndisMPnPEvent is called 
    then the rule will abort.  
    
    Related Rule:

Help Link:

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

--*/





#include "slic_base.h"

state{
   enum {in_oidreq, out_oidreq} s = in_oidreq;
}


sdv_MINIPORT_OID_REQUEST.entry
{
    s = in_oidreq;
}

sdv_MINIPORT_OID_REQUEST.exit
{    
    s = out_oidreq;
}

NdisMOidRequestComplete.entry
{
    if($3 == NDIS_STATUS_PENDING)
    {
        halt;
    }
}

NdisMNetPnPEvent.entry
{
    if ( s == in_oidreq)
    {
        abort "You cannot call $fname in the context of an OID request.";
    }
}
