/*++

Copyright (c) Microsoft Corporation. All rights reserved.

Module Name:

    Wdfassert.h

Environment:

    user mode

NOTE: This header is generated by stubwork.

      To modify contents, add or remove <shared> or <umdf>
      tags in the corresponding .x and .y template files.

--*/

#pragma once

#ifndef WDF_EXTERN_C
  #ifdef __cplusplus
    #define WDF_EXTERN_C       extern "C"
    #define WDF_EXTERN_C_START extern "C" {
    #define WDF_EXTERN_C_END   }
  #else
    #define WDF_EXTERN_C
    #define WDF_EXTERN_C_START
    #define WDF_EXTERN_C_END
  #endif
#endif

WDF_EXTERN_C_START


#if (NTDDI_VERSION >= NTDDI_WIN2K)

//
// Including here because RtlAssert is not declared in XP and Win2K headers for
// free builds
//
NTSYSAPI
VOID
NTAPI
RtlAssert(
    _In_ PVOID FailedAssertion,
    _In_ PVOID FileName,
    _In_ ULONG LineNumber,
    _In_opt_ PSTR Message
    );

//
// WDFVERIFY is active both on checked and free build only if
// the wdf verifier is tuned on
//
#define WDFVERIFY(exp) {                                            \
    if ((WdfDriverGlobals->DriverFlags & WdfVerifyOn) && !(exp)) {  \
        RtlAssert( #exp, __FILE__, __LINE__, NULL );                \
    }                                                               \
}

#define VERIFY_IS_IRQL_PASSIVE_LEVEL()  WDFVERIFY(KeGetCurrentIrql() == PASSIVE_LEVEL)

//
// Following macro is obsolete and it will be phased out in due course
//
#define IS_AT_PASSIVE()                 WDFVERIFY(KeGetCurrentIrql() == PASSIVE_LEVEL)

//
// Compile time active "assert".  File will not compile if this assert is FALSE.
//
// This compile time assert is designed to catch mismatch in the values of the
// declared constants.  So suppress the OACR warning #6326 generated about the
// potential comparison of constants.
//
#define WDFCASSERT(c)   {              \
    __pragma(warning(suppress: 6326))  \
    switch(0) case (c): case 0: ;      \
    }

#define DbgPrint(_fmt_, ...) DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_INFO_LEVEL, _fmt_, __VA_ARGS__)
#ifndef KdPrint
#if DBG
#define KdPrint(_x_) DbgPrint _x_
#else
#define KdPrint(_x_)
#endif
#endif

#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END

