reactos/sdk/lib/drivers/wdf/shared/inc/private/common/fxmdl.h
Victor Perevertkin 1f377076d7
[WDF] Fix KMDF so it can compile with ReactOS SDK
Not all files are included, but these are necessary to compile cdrom driver.
So far it can only be statically linked with drivers, a proper
implementation requires wdfldr helper driver
2020-11-03 00:06:27 +03:00

91 lines
1.9 KiB
C

//
// Copyright (C) Microsoft. All rights reserved.
//
#ifndef __FXMDL_H__
#define __FXMDL_H__
PMDL
FxMdlAllocateDebug(
__in PFX_DRIVER_GLOBALS FxDriverGlobals,
__in FxObject* Owner,
__in PVOID VirtualAddress,
__in ULONG Length,
__in BOOLEAN SecondaryBuffer,
__in BOOLEAN ChargeQuota,
__in PVOID CallersAddress
);
VOID
FxMdlFreeDebug(
__in PFX_DRIVER_GLOBALS FxDriverGlobals,
__in PMDL Mdl
);
VOID
FxMdlDump(
__in PFX_DRIVER_GLOBALS FxDriverGlobals
);
PMDL
FORCEINLINE
FxMdlAllocate(
__in PFX_DRIVER_GLOBALS FxDriverGlobals,
__in FxObject* Owner,
__in PVOID VirtualAddress,
__in ULONG Length,
__in BOOLEAN SecondaryBuffer,
__in BOOLEAN ChargeQuota
)
{
if (FxDriverGlobals->FxVerifierOn) {
return FxMdlAllocateDebug(FxDriverGlobals,
Owner,
VirtualAddress,
Length,
SecondaryBuffer,
ChargeQuota,
_ReturnAddress());
}
else {
return IoAllocateMdl(VirtualAddress,
Length,
SecondaryBuffer,
ChargeQuota,
NULL);
}
}
VOID
__inline
FxMdlFree(
__in PFX_DRIVER_GLOBALS FxDriverGlobals,
__in PMDL Mdl
)
{
if (FxDriverGlobals->FxVerifierOn) {
FxMdlFreeDebug(FxDriverGlobals, Mdl);
}
else {
IoFreeMdl(Mdl);
}
}
VOID
__inline
FxIrpMdlFree(
__in PMDL Mdl
)
{
IoFreeMdl(Mdl);
}
// Do not allow accidental usage by redefining these DDIs to uncompilable names.
// Do this after we define our own functions so that our own functions use
// the correct DDI.
#undef IoAllocateMdl
#undef IoFreeMdl
#define IoAllocateMdl use_FxMdlAllocate_instead
#define IoFreeMdl use_FxMdlFree_instead
#endif // __FXMDL_H__