00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef _FSRTLP_
00022
#define _FSRTLP_
00023
00024
#include <ntos.h>
00025
#include <FsRtl.h>
00026
#include <NtDdFt.h>
00027
#include <zwapi.h>
00028
00029 #define FsRtlAllocatePool(PoolType, NumberOfBytes ) \
00030
ExAllocatePoolWithTag((POOL_TYPE)((PoolType) | POOL_RAISE_IF_ALLOCATION_FAILURE), \
00031
NumberOfBytes, \
00032
'trSF')
00033
00034
00035 #define FsRtlAllocatePoolWithQuota(PoolType, NumberOfBytes ) \
00036
ExAllocatePoolWithQuotaTag((POOL_TYPE)((PoolType) | POOL_RAISE_IF_ALLOCATION_FAILURE), \
00037
NumberOfBytes, \
00038
'trSF')
00039
00040 #define FsRtlpAllocatePool(a,b) FsRtlAllocatePoolWithTag((a),(b),MODULE_POOL_TAG)
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
#ifdef FSRTLDBG
00093
00094
extern LONG FsRtlDebugTraceLevel;
00095
extern LONG FsRtlDebugTraceIndent;
00096
00097
#define DebugTrace(INDENT,LEVEL,X,Y) { \
00098
LONG _i; \
00099
if (((LEVEL) == 0) || (FsRtlDebugTraceLevel & (LEVEL))) { \
00100
_i = (ULONG)PsGetCurrentThread(); \
00101
DbgPrint("%08lx:",_i); \
00102
if ((INDENT) < 0) { \
00103
FsRtlDebugTraceIndent += (INDENT); \
00104
} \
00105
if (FsRtlDebugTraceIndent < 0) { \
00106
FsRtlDebugTraceIndent = 0; \
00107
} \
00108
for (_i=0; _i<FsRtlDebugTraceIndent; _i+=1) { \
00109
DbgPrint(" "); \
00110
} \
00111
DbgPrint(X,Y); \
00112
if ((INDENT) > 0) { \
00113
FsRtlDebugTraceIndent += (INDENT); \
00114
} \
00115
} \
00116
}
00117
00118
#define DebugDump(STR,LEVEL,PTR) { \
00119
ULONG _i; \
00120
VOID FsRtlDump(); \
00121
if (((LEVEL) == 0) || (FsRtlDebugTraceLevel & (LEVEL))) { \
00122
_i = (ULONG)PsGetCurrentThread(); \
00123
DbgPrint("%08lx:",_i); \
00124
DbgPrint(STR); \
00125
if (PTR != NULL) {FsRtlDump(PTR);} \
00126
DbgBreakPoint(); \
00127
} \
00128
}
00129
00130
#else
00131
00132 #define DebugTrace(INDENT,LEVEL,X,Y) {NOTHING;}
00133
00134 #define DebugDump(STR,LEVEL,PTR) {NOTHING;}
00135
00136
#endif // FSRTLDBG
00137
00138
00139
00140
00141
00142
00143
VOID
00144
FsRtlInitializeFileLocks (
00145 VOID
00146 );
00147
00148
VOID
00149
FsRtlInitializeLargeMcbs (
00150 VOID
00151 );
00152
00153
VOID
00154
FsRtlInitializeTunnels(
00155 VOID
00156 );
00157
00158
NTSTATUS
00159
FsRtlInitializeWorkerThread (
00160 VOID
00161 );
00162
00163
00164
00165
00166
00167
00168 #define FlagOn(Flags,SingleFlag) ((Flags) & (SingleFlag))
00169
00170 #define BooleanFlagOn(Flags,SingleFlag) ((BOOLEAN)(((Flags) & (SingleFlag)) != 0))
00171
00172 #define SetFlag(F,SF) { \
00173
(F) |= (SF); \
00174
}
00175
00176 #define ClearFlag(F,SF) { \
00177
(F) &= ~(SF); \
00178
}
00179
00180
00181
00182
00183
00184
00185 #define WordAlign(Ptr) ( \
00186
((((ULONG_PTR)(Ptr)) + 1) & -2) \
00187
)
00188
00189
00190
00191
00192
00193
00194 #define LongAlign(Ptr) ( \
00195
((((ULONG_PTR)(Ptr)) + 3) & -4) \
00196
)
00197
00198
00199
00200
00201
00202
00203 #define QuadAlign(Ptr) ( \
00204
((((ULONG_PTR)(Ptr)) + 7) & -8) \
00205
)
00206
00207
00208
00209
00210
00211
00212 #define SectorAlign(Ptr) ( \
00213
((((ULONG_PTR)(Ptr)) + 511) & -512) \
00214
)
00215
00216
00217
00218
00219
00220
00221
00222 #define SectorsFromBytes(bytes) ( \
00223
((bytes) + 511) / 512 \
00224
)
00225
00226
00227
00228
00229
00230
00231 #define BytesFromSectors(sectors) ( \
00232
(sectors) * 512 \
00233
)
00234
00235
00236
00237
00238
00239
00240
typedef union _UCHAR1 {
00241 UCHAR Uchar[1];
00242 UCHAR ForceAlignment;
00243 }
UCHAR1, *
PUCHAR1;
00244
00245
typedef union _UCHAR2 {
00246 UCHAR Uchar[2];
00247
USHORT ForceAlignment;
00248 }
UCHAR2, *
PUCHAR2;
00249
00250
typedef union _UCHAR4 {
00251 UCHAR
Uchar[4];
00252 ULONG
ForceAlignment;
00253 }
UCHAR4, *
PUCHAR4;
00254
00255
00256
00257
00258
00259 #define CopyUchar1(Dst,Src) { \
00260
*((UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src)); \
00261
}
00262
00263
00264
00265
00266
00267 #define CopyUchar2(Dst,Src) { \
00268
*((UCHAR2 *)(Dst)) = *((UNALIGNED UCHAR2 *)(Src)); \
00269
}
00270
00271
00272
00273
00274
00275 #define CopyUchar4(Dst,Src) { \
00276
*((UCHAR4 *)(Dst)) = *((UNALIGNED UCHAR4 *)(Src)); \
00277
}
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308 #define try_return(S) { S; goto try_exit; }
00309
00310
#endif // _FSRTLP_