/*++

    Copyright (c) Microsoft Corporation.  All rights reserved.

Rule Name:

    WmiForward

Domain:

    wdm

Rule ID:

    Not Applicable

Description:

    This rule is not applicable to bus drivers.  It verifies
    that before returning from a dispatch routine, if the IRP is a
    WMI_IRP with disposition IrpForward, then the driver should
    forward it to the lower driver. 
    This rule only applies to FDO and FIDO drivers.

Help Link:

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

--*/


#include "slic_base.h"

state {
    int not_forwarded = 0;
} with guard(sdv_main,sdv_irp) 


sdv_stub_WmiIrpForward.entry [guard $1]
{
    not_forwarded = 1;
}

IoAcquireRemoveLock.exit
{
    if($return!=STATUS_SUCCESS)
    {
        halt;
    }
}



[IoCallDriver,PoCallDriver].entry [guard $2]
{
    not_forwarded = 0;
}

[SDV_RunDispatchFunction].exit [guard $2]
{
    if (not_forwarded) {
        abort "The dispatch routine has not finished its WMI processing.";
    }
}
