[RXCE]
[reactos.git] / reactos / sdk / include / ddk / ntrxdef.h
1 #ifndef _RX_NTDEFS_DEFINED_
2 #define _RX_NTDEFS_DEFINED_
3
4 #define INLINE __inline
5 #ifndef INVALID_HANDLE_VALUE
6 #define INVALID_HANDLE_VALUE ((HANDLE)-1)
7 #endif
8
9 #define RxAllocatePoolWithTag ExAllocatePoolWithTag
10 #define RxFreePool ExFreePool
11
12 #define RxIsResourceOwnershipStateExclusive(Resource) (FlagOn((Resource)->Flag, ResourceOwnedExclusive))
13
14 #define RxMdlIsLocked(Mdl) ((Mdl)->MdlFlags & MDL_PAGES_LOCKED)
15 #define RxMdlSourceIsNonPaged(Mdl) ((Mdl)->MdlFlags & MDL_SOURCE_IS_NONPAGED_POOL)
16
17 #define RxGetRequestorProcess(RxContext) IoGetRequestorProcess(RxContext->CurrentIrp)
18
19 #define RxAdjustAllocationSizeforCC(Fcb) \
20 { \
21 if ((Fcb)->Header.FileSize.QuadPart > (Fcb)->Header.AllocationSize.QuadPart) \
22 { \
23 PMRX_NET_ROOT NetRoot = (Fcb)->pNetRoot; \
24 ULONGLONG ClusterSize = NetRoot->DiskParameters.ClusterSize; \
25 ULONGLONG FileSize = (Fcb)->Header.FileSize.QuadPart; \
26 ASSERT(ClusterSize != 0); \
27 (Fcb)->Header.AllocationSize.QuadPart = (FileSize + ClusterSize) &~ (ClusterSize - 1); \
28 } \
29 ASSERT ((Fcb)->Header.ValidDataLength.QuadPart <= (Fcb)->Header.FileSize.QuadPart); \
30 }
31
32 #endif