/*++

    Copyright (c) Microsoft Corporation.  All rights reserved.

Rule Name:

    EvtIoStopCompleteOrStopAck

Domain:

    wdf

Rule ID:

    Not Applicable

Description:

   This rule checks that WdfRequestComplete, WdfRequestCompleteWithInformation, WdfRequestCompleteWithPriorityBoost, WdfRequestCancelSentRequest, or WdfRequestStopAcknowledge
   is called from within EvtIoStop callback for each request presented by the framework.
   If this is not done, the driver may block the system from entering another lower power state.

  Rule diagnostics:
  "WdfRequestComplete,WdfRequestCompleteWithInformation,WdfRequestCompleteWithPriorityBoost,WdfRequestCancelSentRequest or WdfRequestStopAcknowledge 
  should be called from within EvtIoStop callback for each request presented by the framework."


Help Link:

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

--*/




#include "slic_base.h"

state{
     enum {INIT, INSTOP} s = INIT;
     enum {INIT1, COMPLETED} r = INIT1;
}with guard (sdv_main, hrequest)
                   
[fun_WDF_IO_QUEUE_IO_STOP].entry[guard $2]
{
        s = INSTOP;               
}
[fun_WDF_IO_QUEUE_IO_STOP].exit[guard $2]
{   
   if(r!=COMPLETED)
   {
      abort "WdfRequestComplete,WdfRequestCompleteWithInformation,WdfRequestCompleteWithPriorityBoost,WdfRequestCancelSentRequest or WdfRequestStopAcknowledge should be called from within EvtIoStop callback for each request presented by the framework.";
   }
   else
   {
	   halt;
   }
}
[ sdv_WdfRequestComplete
, sdv_WdfRequestCompleteWithInformation
, sdv_WdfRequestCompleteWithPriorityBoost
, sdv_WdfRequestStopAcknowledge
, sdv_WdfRequestCancelSentRequest
].entry[guard $1]
{
   if(s == INSTOP) 
   {
      r = COMPLETED;
   }
}




