ReactOS  0.4.13-dev-101-g0ca4b50
filter.c
Go to the documentation of this file.
1 /*
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
6  * PROGRAMMERS: None.
7  */
8 
9 /* INCLUDES ******************************************************************/
10 
11 #include <ntoskrnl.h>
12 #define NDEBUG
13 #include <debug.h>
14 
15 #undef FsRtlAllocatePoolWithQuotaTag
16 #undef FsRtlAllocatePoolWithTag
17 
18 /* PUBLIC FUNCTIONS **********************************************************/
19 
20 /*++
21  * @name FsRtlIsTotalDeviceFailure
22  * @implemented NT 4.0
23  *
24  * The FsRtlIsTotalDeviceFailure routine checks if an NTSTATUS error code
25  * represents a disk hardware failure.
26  *
27  * @param NtStatus
28  * The NTSTATUS Code to Test
29  *
30  * @return TRUE in case of Hardware Failure, FALSE otherwise.
31  *
32  * @remarks None.
33  *
34  *--*/
35 BOOLEAN
36 NTAPI
38 {
39  return((NT_SUCCESS(NtStatus)) ||
40  (STATUS_CRC_ERROR == NtStatus) ||
41  (STATUS_DEVICE_DATA_ERROR == NtStatus) ? FALSE : TRUE);
42 }
43 
44 /*++
45  * @name FsRtlIsNtstatusExpected
46  * @implemented NT 4.0
47  *
48  * The FsRtlIsNtstatusExpected routine checks if an NTSTATUS error code
49  * is expected by the File System Support Library.
50  *
51  * @param NtStatus
52  * The NTSTATUS Code to Test
53  *
54  * @return TRUE if the Value is Expected, FALSE otherwise.
55  *
56  * @remarks None.
57  *
58  *--*/
59 BOOLEAN
60 NTAPI
62 {
63  return((STATUS_DATATYPE_MISALIGNMENT == NtStatus) ||
64  (STATUS_ACCESS_VIOLATION == NtStatus) ||
65  (STATUS_ILLEGAL_INSTRUCTION == NtStatus) ||
66  (STATUS_INSTRUCTION_MISALIGNMENT == NtStatus)) ? FALSE : TRUE;
67 }
68 
69 /*++
70  * @name FsRtlNormalizeNtstatus
71  * @implemented NT 4.0
72  *
73  * The FsRtlNormalizeNtstatus routine normalizes an NTSTATUS error code.
74  *
75  * @param NtStatusToNormalize
76  * The NTSTATUS error code to Normalize.
77  *
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.
81  *
82  * @return NtStatusToNormalize if it is an expected value, otherwise
83  * NormalizedNtStatus.
84  *
85  * @remarks None.
86  *
87  *--*/
89 NTAPI
90 FsRtlNormalizeNtstatus(IN NTSTATUS NtStatusToNormalize,
91  IN NTSTATUS NormalizedNtStatus)
92 {
93  return(TRUE == FsRtlIsNtstatusExpected(NtStatusToNormalize)) ?
94  NtStatusToNormalize : NormalizedNtStatus;
95 }
96 
97 /*++
98  * @name FsRtlAllocatePool
99  * @implemented
100  *
101  * FILLME
102  *
103  * @param PoolType
104  * FILLME
105  *
106  * @param NumberOfBytes
107  * FILLME
108  *
109  * @return None
110  *
111  * @remarks The pool tag used is "FSrt".
112  *
113  *--*/
114 PVOID
115 NTAPI
118 {
119  PVOID Address;
120 
123  IFS_POOL_TAG);
124 
125  if (NULL == Address)
126  {
128  }
129 
130  return Address;
131 }
132 
133 /*++
134  * @name FsRtlAllocatePoolWithQuota
135  * @implemented
136  *
137  * FILLME
138  *
139  * @param PoolType
140  * FILLME
141  *
142  * @param NumberOfBytes
143  * FILLME
144  *
145  * @return None
146  *
147  * @remarks The pool tag used is "FSrt".
148  *
149  *--*/
150 PVOID
151 NTAPI
154 {
155  PVOID Address;
156 
159  IFS_POOL_TAG);
160  if (NULL == Address)
161  {
163  }
164  return Address;
165 }
166 
167 /*++
168  * @name FsRtlAllocatePoolWithQuotaTag
169  * @implemented
170  *
171  * FILLME
172  *
173  * @param PoolType
174  * FILLME
175  *
176  * @param NumberOfBytes
177  * FILLME
178  *
179  * @param Tag
180  * FILLME
181  *
182  * @return None
183  *
184  * @remarks None
185  *
186  *--*/
187 PVOID
188 NTAPI
191  IN ULONG Tag)
192 {
193  PVOID Address;
194 
197  Tag);
198 
199  if (NULL == Address)
200  {
202  }
203 
204  return Address;
205 }
206 
207 /*++
208  * @name FsRtlAllocatePoolWithTag
209  * @implemented
210  *
211  * FILLME
212  *
213  * @param PoolType
214  * FILLME
215  *
216  * @param NumberOfBytes
217  * FILLME
218  *
219  * @param Tag
220  * FILLME
221  *
222  * @return None
223  *
224  * @remarks None
225  *
226  *--*/
227 PVOID
228 NTAPI
231  IN ULONG Tag)
232 {
233  PVOID Address;
234 
237  Tag);
238 
239  if (NULL == Address)
240  {
242  }
243 
244  return Address;
245 }
246 
#define IN
Definition: typedefs.h:38
BOOLEAN NTAPI FsRtlIsNtstatusExpected(IN NTSTATUS NtStatus)
Definition: filter.c:61
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_ILLEGAL_INSTRUCTION
Definition: ntstatus.h:252
PVOID NTAPI ExAllocatePoolWithQuotaTag(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
Definition: expool.c:2939
PVOID NTAPI FsRtlAllocatePoolWithTag(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes, IN ULONG Tag)
Definition: filter.c:229
BOOLEAN NTAPI FsRtlIsTotalDeviceFailure(IN NTSTATUS NtStatus)
Definition: filter.c:37
LONG NTSTATUS
Definition: precomp.h:26
#define ExRaiseStatus
Definition: ntoskrnl.h:95
PVOID NTAPI FsRtlAllocatePoolWithQuotaTag(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes, IN ULONG Tag)
Definition: filter.c:189
PVOID NTAPI FsRtlAllocatePool(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes)
Definition: filter.c:116
PVOID NTAPI FsRtlAllocatePoolWithQuota(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes)
Definition: filter.c:152
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
#define IFS_POOL_TAG
Definition: tag.h:52
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
INT POOL_TYPE
Definition: typedefs.h:76
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define STATUS_CRC_ERROR
Definition: udferr_usr.h:153
#define STATUS_INSTRUCTION_MISALIGNMENT
Definition: ntstatus.h:392
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
#define STATUS_DATATYPE_MISALIGNMENT
Definition: ntstatus.h:171
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:997
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI FsRtlNormalizeNtstatus(IN NTSTATUS NtStatusToNormalize, IN NTSTATUS NormalizedNtStatus)
Definition: filter.c:90
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444
#define STATUS_DEVICE_DATA_ERROR
Definition: udferr_usr.h:159