/*++

    Copyright (c) Microsoft Corporation.  All rights reserved.

Rule Name:

    ReqDelete

Domain:

    wdf

Rule ID:

    Not Applicable

Description:

    This rule verifies that driver created requests are not passed to
    WdfRequestCompleteXxx. Instead, the request must be deleted upon completion.
    
    If the driver creates a request through a call to 
    WdfRequestCreate, the request must be deleted using WdfObjectDelete once
    the driver is finished with the request. The driver may not call any WdfRequestCompleteXxx
    DDIs on this request. These DDIs are reserved for framework supplied requests.
    
    Rule diagnostics:
    The rule finds a defect if a request created using WdfRequestCreate is passed to
    WdfRequestComplete, WdfRequestCompleteWithInformation or WdfRequestCompleteWithPriorityBoost
    before being deleted using WdfObjectDelete.


Help Link:

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

--*/



#include "slic_base.h"

state{}


watch sdv_WdfRequestCreate.exit.(*$3);


[sdv_WdfRequestComplete,
sdv_WdfRequestCompleteWithInformation,
sdv_WdfRequestCompleteWithPriorityBoost].entry[guard $1]
{
    abort "Cannot call $fname with a request created by the driver. Please call WdfObjectDelete instead.";
}
		 
sdv_WdfObjectDelete.entry[guard $1]
{
    halt;
}
       


