2007-01-08 16:51:06 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Kernel
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
2015-10-04 11:54:25 +00:00
|
|
|
* FILE: ntoskrnl/include/internal/fsrtl.h
|
2007-01-08 16:51:06 +00:00
|
|
|
* PURPOSE: Internal header for the File System Runtime Library
|
|
|
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
|
|
|
*/
|
|
|
|
|
|
|
|
//
|
|
|
|
// Define this if you want debugging support
|
|
|
|
//
|
|
|
|
#define _FSRTL_DEBUG_ 0x00
|
|
|
|
|
|
|
|
//
|
|
|
|
// These define the Debug Masks Supported
|
|
|
|
//
|
|
|
|
#define FSRTL_FASTIO_DEBUG 0x01
|
|
|
|
#define FSRTL_OPLOCK_DEBUG 0x02
|
|
|
|
#define FSRTL_TUNNEL_DEBUG 0x04
|
|
|
|
#define FSRTL_MCB_DEBUG 0x08
|
|
|
|
#define FSRTL_NAME_DEBUG 0x10
|
|
|
|
#define FSRTL_NOTIFY_DEBUG 0x20
|
|
|
|
#define FSRTL_FILELOCK_DEBUG 0x40
|
|
|
|
#define FSRTL_UNC_DEBUG 0x80
|
|
|
|
#define FSRTL_FILTER_DEBUG 0x100
|
|
|
|
#define FSRTL_CONTEXT_DEBUG 0x200
|
|
|
|
|
|
|
|
//
|
|
|
|
// Debug/Tracing support
|
|
|
|
//
|
|
|
|
#if _FSRTL_DEBUG_
|
|
|
|
#ifdef NEW_DEBUG_SYSTEM_IMPLEMENTED // enable when Debug Filters are implemented
|
|
|
|
#define FSTRACE DbgPrintEx
|
|
|
|
#else
|
|
|
|
#define FSTRACE(x, ...) \
|
|
|
|
if (x & FsRtlpTraceLevel) DbgPrint(__VA_ARGS__)
|
|
|
|
#endif
|
|
|
|
#else
|
2012-02-29 09:18:01 +00:00
|
|
|
#define FSTRACE(x, ...) DPRINT(__VA_ARGS__)
|
2007-01-08 16:51:06 +00:00
|
|
|
#endif
|
2005-09-14 01:44:19 +00:00
|
|
|
|
2007-01-08 16:51:06 +00:00
|
|
|
//
|
|
|
|
// Number of internal ERESOURCE structures allocated for callers to request
|
|
|
|
//
|
|
|
|
#define FSRTL_MAX_RESOURCES 16
|
2005-09-14 01:44:19 +00:00
|
|
|
|
2012-02-29 09:18:01 +00:00
|
|
|
//
|
|
|
|
// Number of maximum pair count per MCB
|
|
|
|
//
|
|
|
|
#define MAXIMUM_PAIR_COUNT 15
|
|
|
|
|
|
|
|
//
|
|
|
|
// Notifications flags
|
|
|
|
//
|
2012-02-29 20:03:46 +00:00
|
|
|
#define WATCH_TREE 0x01
|
2014-03-07 19:33:38 +00:00
|
|
|
#define NOTIFY_IMMEDIATELY 0x02
|
2012-02-29 20:03:46 +00:00
|
|
|
#define CLEANUP_IN_PROCESS 0x04
|
2014-03-07 19:33:38 +00:00
|
|
|
#define NOTIFY_LATER 0x08
|
2012-02-29 20:03:46 +00:00
|
|
|
#define WATCH_ROOT 0x10
|
|
|
|
#define DELETE_IN_PROCESS 0x20
|
2012-02-29 09:18:01 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Internal structure for NOTIFY_SYNC
|
|
|
|
//
|
|
|
|
typedef struct _REAL_NOTIFY_SYNC
|
|
|
|
{
|
|
|
|
FAST_MUTEX FastMutex;
|
|
|
|
ULONG_PTR OwningThread;
|
|
|
|
ULONG OwnerCount;
|
|
|
|
} REAL_NOTIFY_SYNC, * PREAL_NOTIFY_SYNC;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Internal structure for notifications
|
|
|
|
//
|
|
|
|
typedef struct _NOTIFY_CHANGE
|
|
|
|
{
|
|
|
|
PREAL_NOTIFY_SYNC NotifySync;
|
|
|
|
PVOID FsContext;
|
|
|
|
PVOID StreamID;
|
|
|
|
PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback;
|
|
|
|
PSECURITY_SUBJECT_CONTEXT SubjectContext;
|
|
|
|
PSTRING FullDirectoryName;
|
2012-02-29 19:26:43 +00:00
|
|
|
LIST_ENTRY NotifyList;
|
|
|
|
LIST_ENTRY NotifyIrps;
|
2012-02-29 09:18:01 +00:00
|
|
|
PFILTER_REPORT_CHANGE FilterCallback;
|
|
|
|
USHORT Flags;
|
|
|
|
UCHAR CharacterSize;
|
|
|
|
ULONG CompletionFilter;
|
|
|
|
PVOID AllocatedBuffer;
|
|
|
|
PVOID Buffer;
|
|
|
|
ULONG BufferLength;
|
|
|
|
ULONG ThisBufferLength;
|
|
|
|
ULONG DataLength;
|
|
|
|
ULONG LastEntry;
|
|
|
|
ULONG ReferenceCount;
|
|
|
|
PEPROCESS OwningProcess;
|
|
|
|
} NOTIFY_CHANGE, *PNOTIFY_CHANGE;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Internal structure for MCB Mapping pointer
|
|
|
|
//
|
|
|
|
typedef struct _INT_MAPPING
|
|
|
|
{
|
|
|
|
VBN Vbn;
|
|
|
|
LBN Lbn;
|
|
|
|
} INT_MAPPING, *PINT_MAPPING;
|
|
|
|
|
2007-01-08 16:51:06 +00:00
|
|
|
//
|
|
|
|
// Initialization Routines
|
|
|
|
//
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2012-02-29 09:18:01 +00:00
|
|
|
VOID
|
2006-09-06 12:19:00 +00:00
|
|
|
NTAPI
|
2012-02-29 09:18:01 +00:00
|
|
|
FsRtlInitializeLargeMcbs(
|
2007-01-08 16:51:06 +00:00
|
|
|
VOID
|
2005-09-14 01:44:19 +00:00
|
|
|
);
|
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2015-05-24 17:42:05 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
FsRtlInitializeTunnels(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2010-11-23 20:01:04 +00:00
|
|
|
//
|
|
|
|
// File contexts Routines
|
|
|
|
//
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
FsRtlPTeardownPerFileObjectContexts(
|
|
|
|
IN PFILE_OBJECT FileObject
|
|
|
|
);
|
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2012-02-29 09:18:01 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
FsRtlInitSystem(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2007-01-08 16:51:06 +00:00
|
|
|
//
|
|
|
|
// Global data inside the File System Runtime Library
|
|
|
|
//
|
|
|
|
extern PERESOURCE FsRtlPagingIoResources;
|
|
|
|
extern PAGED_LOOKASIDE_LIST FsRtlFileLockLookasideList;
|
2020-11-16 08:24:58 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// File locking routine
|
|
|
|
//
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
FsRtlAcquireToCreateMappedSection(_In_ PFILE_OBJECT FileObject,
|
|
|
|
_In_ ULONG SectionPageProtection);
|
2020-12-04 09:18:32 +00:00
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
FsRtlReleaseFileForCcFlush(IN PFILE_OBJECT FileObject);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
FsRtlAcquireFileForCcFlushEx(IN PFILE_OBJECT FileObject);
|
2022-09-05 17:33:19 +00:00
|
|
|
|
|
|
|
_Check_return_
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
FsRtlAcquireFileForModWriteEx(_In_ PFILE_OBJECT FileObject,
|
|
|
|
_In_ PLARGE_INTEGER EndingOffset,
|
|
|
|
_Outptr_result_maybenull_ PERESOURCE *ResourceToRelease);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
FsRtlReleaseFileForModWrite(IN PFILE_OBJECT FileObject,
|
|
|
|
IN PERESOURCE ResourceToRelease);
|