2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/fsrtl/filter.c
5 * PURPOSE: Provides support for usage of SEH inside File System Drivers
9 /* INCLUDES ******************************************************************/
15 #undef FsRtlAllocatePoolWithQuotaTag
16 #undef FsRtlAllocatePoolWithTag
18 /* PUBLIC FUNCTIONS **********************************************************/
21 * @name FsRtlIsTotalDeviceFailure
24 * The FsRtlIsTotalDeviceFailure routine checks if an NTSTATUS error code
25 * represents a disk hardware failure.
28 * The NTSTATUS Code to Test
30 * @return TRUE in case of Hardware Failure, FALSE otherwise.
37 FsRtlIsTotalDeviceFailure(IN NTSTATUS NtStatus
)
39 return((NT_SUCCESS(NtStatus
)) ||
40 (STATUS_CRC_ERROR
== NtStatus
) ||
41 (STATUS_DEVICE_DATA_ERROR
== NtStatus
) ? FALSE
: TRUE
);
45 * @name FsRtlIsNtstatusExpected
48 * The FsRtlIsNtstatusExpected routine checks if an NTSTATUS error code
49 * is expected by the File System Support Library.
52 * The NTSTATUS Code to Test
54 * @return TRUE if the Value is Expected, FALSE otherwise.
61 FsRtlIsNtstatusExpected(IN NTSTATUS NtStatus
)
63 return((STATUS_DATATYPE_MISALIGNMENT
== NtStatus
) ||
64 (STATUS_ACCESS_VIOLATION
== NtStatus
) ||
65 (STATUS_ILLEGAL_INSTRUCTION
== NtStatus
) ||
66 (STATUS_INSTRUCTION_MISALIGNMENT
== NtStatus
)) ? FALSE
: TRUE
;
70 * @name FsRtlNormalizeNtstatus
73 * The FsRtlNormalizeNtstatus routine normalizes an NTSTATUS error code.
75 * @param NtStatusToNormalize
76 * The NTSTATUS error code to Normalize.
78 * @param NormalizedNtStatus
79 * The NTSTATUS error code to return if the NtStatusToNormalize is not
80 * a proper expected error code by the File System Library.
82 * @return NtStatusToNormalize if it is an expected value, otherwise
90 FsRtlNormalizeNtstatus(IN NTSTATUS NtStatusToNormalize
,
91 IN NTSTATUS NormalizedNtStatus
)
93 return(TRUE
== FsRtlIsNtstatusExpected(NtStatusToNormalize
)) ?
94 NtStatusToNormalize
: NormalizedNtStatus
;
98 * @name FsRtlAllocatePool
106 * @param NumberOfBytes
111 * @remarks The pool tag used is "FSrt".
116 FsRtlAllocatePool(IN POOL_TYPE PoolType
,
117 IN ULONG NumberOfBytes
)
121 Address
= ExAllocatePoolWithTag(PoolType
,
127 ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES
);
134 * @name FsRtlAllocatePoolWithQuota
142 * @param NumberOfBytes
147 * @remarks The pool tag used is "FSrt".
152 FsRtlAllocatePoolWithQuota(IN POOL_TYPE PoolType
,
153 IN ULONG NumberOfBytes
)
157 Address
= ExAllocatePoolWithQuotaTag(PoolType
,
162 ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES
);
168 * @name FsRtlAllocatePoolWithQuotaTag
176 * @param NumberOfBytes
189 FsRtlAllocatePoolWithQuotaTag (IN POOL_TYPE PoolType
,
190 IN ULONG NumberOfBytes
,
195 Address
= ExAllocatePoolWithQuotaTag(PoolType
,
201 ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES
);
208 * @name FsRtlAllocatePoolWithTag
216 * @param NumberOfBytes
229 FsRtlAllocatePoolWithTag(IN POOL_TYPE PoolType
,
230 IN ULONG NumberOfBytes
,
235 Address
= ExAllocatePoolWithTag(PoolType
,
241 ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES
);