0ecd31596360f52ccdbea0cdd57e40454b8462ee
[reactos.git] / reactos / drivers / filesystems / ntfs / ntfs.h
1 #ifndef NTFS_H
2 #define NTFS_H
3
4 #include <ntifs.h>
5 #include <pseh/pseh2.h>
6
7 #ifdef __GNUC__
8 #define INIT_SECTION __attribute__((section ("INIT")))
9 #else
10 #define INIT_SECTION /* Done via alloc_text for MSC */
11 #endif
12
13 #define CACHEPAGESIZE(pDeviceExt) \
14 ((pDeviceExt)->NtfsInfo.UCHARsPerCluster > PAGE_SIZE ? \
15 (pDeviceExt)->NtfsInfo.UCHARsPerCluster : PAGE_SIZE)
16
17 #define TAG_NTFS 'SFTN'
18
19 #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
20 #define ROUND_DOWN(N, S) ((N) - ((N) % (S)))
21
22 #define DEVICE_NAME L"\\Ntfs"
23
24 #include <pshpack1.h>
25 typedef struct _BIOS_PARAMETERS_BLOCK
26 {
27 USHORT BytesPerSector; // 0x0B
28 UCHAR SectorsPerCluster; // 0x0D
29 UCHAR Unused0[7]; // 0x0E, checked when volume is mounted
30 UCHAR MediaId; // 0x15
31 UCHAR Unused1[2]; // 0x16
32 USHORT SectorsPerTrack; // 0x18
33 USHORT Heads; // 0x1A
34 UCHAR Unused2[4]; // 0x1C
35 UCHAR Unused3[4]; // 0x20, checked when volume is mounted
36 } BIOS_PARAMETERS_BLOCK, *PBIOS_PARAMETERS_BLOCK;
37
38 typedef struct _EXTENDED_BIOS_PARAMETERS_BLOCK
39 {
40 USHORT Unknown[2]; // 0x24, always 80 00 80 00
41 ULONGLONG SectorCount; // 0x28
42 ULONGLONG MftLocation; // 0x30
43 ULONGLONG MftMirrLocation; // 0x38
44 CHAR ClustersPerMftRecord; // 0x40
45 UCHAR Unused4[3]; // 0x41
46 CHAR ClustersPerIndexRecord; // 0x44
47 UCHAR Unused5[3]; // 0x45
48 ULONGLONG SerialNumber; // 0x48
49 UCHAR Checksum[4]; // 0x50
50 } EXTENDED_BIOS_PARAMETERS_BLOCK, *PEXTENDED_BIOS_PARAMETERS_BLOCK;
51
52 typedef struct _BOOT_SECTOR
53 {
54 UCHAR Jump[3]; // 0x00
55 UCHAR OEMID[8]; // 0x03
56 BIOS_PARAMETERS_BLOCK BPB;
57 EXTENDED_BIOS_PARAMETERS_BLOCK EBPB;
58 UCHAR BootStrap[426]; // 0x54
59 USHORT EndSector; // 0x1FE
60 } BOOT_SECTOR, *PBOOT_SECTOR;
61 #include <poppack.h>
62
63 //typedef struct _BootSector BootSector;
64
65 typedef struct _NTFS_INFO
66 {
67 ULONG BytesPerSector;
68 ULONG SectorsPerCluster;
69 ULONG BytesPerCluster;
70 ULONGLONG SectorCount;
71 ULONGLONG ClusterCount;
72 ULARGE_INTEGER MftStart;
73 ULARGE_INTEGER MftMirrStart;
74 ULONG BytesPerFileRecord;
75 ULONG BytesPerIndexRecord;
76
77 ULONGLONG SerialNumber;
78 USHORT VolumeLabelLength;
79 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH];
80 UCHAR MajorVersion;
81 UCHAR MinorVersion;
82 USHORT Flags;
83
84 ULONG MftZoneReservation;
85 } NTFS_INFO, *PNTFS_INFO;
86
87 #define NTFS_TYPE_CCB '20SF'
88 #define NTFS_TYPE_FCB '30SF'
89 #define NTFS_TYPE_VCB '50SF'
90 #define NTFS_TYPE_IRP_CONTEST '60SF'
91 #define NTFS_TYPE_GLOBAL_DATA '70SF'
92
93 typedef struct
94 {
95 ULONG Type;
96 ULONG Size;
97 } NTFSIDENTIFIER, *PNTFSIDENTIFIER;
98
99 typedef struct
100 {
101 NTFSIDENTIFIER Identifier;
102
103 ERESOURCE DirResource;
104 // ERESOURCE FatResource;
105
106 KSPIN_LOCK FcbListLock;
107 LIST_ENTRY FcbListHead;
108
109 PVPB Vpb;
110 PDEVICE_OBJECT StorageDevice;
111 PFILE_OBJECT StreamFileObject;
112
113 struct _NTFS_ATTR_CONTEXT* MFTContext;
114 struct _FILE_RECORD_HEADER* MasterFileTable;
115 struct _FCB *VolumeFcb;
116
117 NTFS_INFO NtfsInfo;
118
119 } DEVICE_EXTENSION, *PDEVICE_EXTENSION, NTFS_VCB, *PNTFS_VCB;
120
121 typedef struct
122 {
123 NTFSIDENTIFIER Identifier;
124 LIST_ENTRY NextCCB;
125 PFILE_OBJECT PtrFileObject;
126 LARGE_INTEGER CurrentByteOffset;
127 /* for DirectoryControl */
128 ULONG Entry;
129 /* for DirectoryControl */
130 PWCHAR DirectorySearchPattern;
131 ULONG LastCluster;
132 ULONG LastOffset;
133 } NTFS_CCB, *PNTFS_CCB;
134
135 #define TAG_CCB 'BCCI'
136 #define TAG_FCB 'BCFI'
137
138 typedef struct
139 {
140 NTFSIDENTIFIER Identifier;
141 ERESOURCE Resource;
142 PDRIVER_OBJECT DriverObject;
143 PDEVICE_OBJECT DeviceObject;
144 CACHE_MANAGER_CALLBACKS CacheMgrCallbacks;
145 ULONG Flags;
146 FAST_IO_DISPATCH FastIoDispatch;
147 NPAGED_LOOKASIDE_LIST IrpContextLookasideList;
148 NPAGED_LOOKASIDE_LIST FcbLookasideList;
149 } NTFS_GLOBAL_DATA, *PNTFS_GLOBAL_DATA;
150
151
152 typedef enum
153 {
154 AttributeStandardInformation = 0x10,
155 AttributeAttributeList = 0x20,
156 AttributeFileName = 0x30,
157 AttributeObjectId = 0x40,
158 AttributeSecurityDescriptor = 0x50,
159 AttributeVolumeName = 0x60,
160 AttributeVolumeInformation = 0x70,
161 AttributeData = 0x80,
162 AttributeIndexRoot = 0x90,
163 AttributeIndexAllocation = 0xA0,
164 AttributeBitmap = 0xB0,
165 AttributeReparsePoint = 0xC0,
166 AttributeEAInformation = 0xD0,
167 AttributeEA = 0xE0,
168 AttributePropertySet = 0xF0,
169 AttributeLoggedUtilityStream = 0x100,
170 AttributeEnd = 0xFFFFFFFF
171 } ATTRIBUTE_TYPE, *PATTRIBUTE_TYPE;
172
173 #define NTFS_FILE_MFT 0
174 #define NTFS_FILE_MFTMIRR 1
175 #define NTFS_FILE_LOGFILE 2
176 #define NTFS_FILE_VOLUME 3
177 #define NTFS_FILE_ATTRDEF 4
178 #define NTFS_FILE_ROOT 5
179 #define NTFS_FILE_BITMAP 6
180 #define NTFS_FILE_BOOT 7
181 #define NTFS_FILE_BADCLUS 8
182 #define NTFS_FILE_QUOTA 9
183 #define NTFS_FILE_UPCASE 10
184 #define NTFS_FILE_EXTEND 11
185
186 #define NTFS_MFT_MASK 0x0000FFFFFFFFFFFFULL
187
188 #define COLLATION_BINARY 0x00
189 #define COLLATION_FILE_NAME 0x01
190 #define COLLATION_UNICODE_STRING 0x02
191 #define COLLATION_NTOFS_ULONG 0x10
192 #define COLLATION_NTOFS_SID 0x11
193 #define COLLATION_NTOFS_SECURITY_HASH 0x12
194 #define COLLATION_NTOFS_ULONGS 0x13
195
196 #define INDEX_ROOT_SMALL 0x0
197 #define INDEX_ROOT_LARGE 0x1
198
199 #define NTFS_INDEX_ENTRY_NODE 1
200 #define NTFS_INDEX_ENTRY_END 2
201
202 #define NTFS_FILE_NAME_POSIX 0
203 #define NTFS_FILE_NAME_WIN32 1
204 #define NTFS_FILE_NAME_DOS 2
205 #define NTFS_FILE_NAME_WIN32_AND_DOS 3
206
207 #define NTFS_FILE_TYPE_READ_ONLY 0x1
208 #define NTFS_FILE_TYPE_HIDDEN 0x2
209 #define NTFS_FILE_TYPE_SYSTEM 0x4
210 #define NTFS_FILE_TYPE_ARCHIVE 0x20
211 #define NTFS_FILE_TYPE_REPARSE 0x400
212 #define NTFS_FILE_TYPE_COMPRESSED 0x800
213 #define NTFS_FILE_TYPE_DIRECTORY 0x10000000
214
215 typedef struct
216 {
217 ULONG Type; /* Magic number 'FILE' */
218 USHORT UsaOffset; /* Offset to the update sequence */
219 USHORT UsaCount; /* Size in words of Update Sequence Number & Array (S) */
220 ULONGLONG Lsn; /* $LogFile Sequence Number (LSN) */
221 } NTFS_RECORD_HEADER, *PNTFS_RECORD_HEADER;
222
223 /* NTFS_RECORD_HEADER.Type */
224 #define NRH_FILE_TYPE 0x454C4946 /* 'FILE' */
225 #define NRH_INDX_TYPE 0x58444E49 /* 'INDX' */
226
227
228 typedef struct _FILE_RECORD_HEADER
229 {
230 NTFS_RECORD_HEADER Ntfs;
231 USHORT SequenceNumber; /* Sequence number */
232 USHORT LinkCount; /* Hard link count */
233 USHORT AttributeOffset; /* Offset to the first Attribute */
234 USHORT Flags; /* Flags */
235 ULONG BytesInUse; /* Real size of the FILE record */
236 ULONG BytesAllocated; /* Allocated size of the FILE record */
237 ULONGLONG BaseFileRecord; /* File reference to the base FILE record */
238 USHORT NextAttributeNumber; /* Next Attribute Id */
239 USHORT Pading; /* Align to 4 UCHAR boundary (XP) */
240 ULONG MFTRecordNumber; /* Number of this MFT Record (XP) */
241 } FILE_RECORD_HEADER, *PFILE_RECORD_HEADER;
242
243 /* Flags in FILE_RECORD_HEADER */
244
245 #define FRH_IN_USE 0x0001 /* Record is in use */
246 #define FRH_DIRECTORY 0x0002 /* Record is a directory */
247 #define FRH_UNKNOWN1 0x0004 /* Don't know */
248 #define FRH_UNKNOWN2 0x0008 /* Don't know */
249
250 typedef struct
251 {
252 ULONG Type;
253 ULONG Length;
254 UCHAR IsNonResident;
255 UCHAR NameLength;
256 USHORT NameOffset;
257 USHORT Flags;
258 USHORT Instance;
259 union
260 {
261 // Resident attributes
262 struct
263 {
264 ULONG ValueLength;
265 USHORT ValueOffset;
266 UCHAR Flags;
267 UCHAR Reserved;
268 } Resident;
269 // Non-resident attributes
270 struct
271 {
272 ULONGLONG LowestVCN;
273 ULONGLONG HighestVCN;
274 USHORT MappingPairsOffset;
275 USHORT CompressionUnit;
276 UCHAR Reserved[4];
277 LONGLONG AllocatedSize;
278 LONGLONG DataSize;
279 LONGLONG InitializedSize;
280 LONGLONG CompressedSize;
281 } NonResident;
282 };
283 } NTFS_ATTR_RECORD, *PNTFS_ATTR_RECORD;
284
285 typedef struct
286 {
287 ULONGLONG CreationTime;
288 ULONGLONG ChangeTime;
289 ULONGLONG LastWriteTime;
290 ULONGLONG LastAccessTime;
291 ULONG FileAttribute;
292 ULONG AlignmentOrReserved[3];
293 #if 0
294 ULONG QuotaId;
295 ULONG SecurityId;
296 ULONGLONG QuotaCharge;
297 USN Usn;
298 #endif
299 } STANDARD_INFORMATION, *PSTANDARD_INFORMATION;
300
301
302 typedef struct
303 {
304 ATTRIBUTE_TYPE AttributeType;
305 USHORT Length;
306 UCHAR NameLength;
307 UCHAR NameOffset;
308 ULONGLONG StartVcn; // LowVcn
309 ULONGLONG FileReferenceNumber;
310 USHORT AttributeNumber;
311 USHORT AlignmentOrReserved[3];
312 } ATTRIBUTE_LIST, *PATTRIBUTE_LIST;
313
314
315 typedef struct
316 {
317 ULONGLONG DirectoryFileReferenceNumber;
318 ULONGLONG CreationTime;
319 ULONGLONG ChangeTime;
320 ULONGLONG LastWriteTime;
321 ULONGLONG LastAccessTime;
322 ULONGLONG AllocatedSize;
323 ULONGLONG DataSize;
324 ULONG FileAttributes;
325 union
326 {
327 struct
328 {
329 USHORT PackedEaSize;
330 USHORT AlignmentOrReserved;
331 } EaInfo;
332 ULONG ReparseTag;
333 } Extended;
334 UCHAR NameLength;
335 UCHAR NameType;
336 WCHAR Name[1];
337 } FILENAME_ATTRIBUTE, *PFILENAME_ATTRIBUTE;
338
339 typedef struct
340 {
341 ULONG FirstEntryOffset;
342 ULONG TotalSizeOfEntries;
343 ULONG AllocatedSize;
344 UCHAR Flags;
345 UCHAR Padding[3];
346 } INDEX_HEADER_ATTRIBUTE, *PINDEX_HEADER_ATTRIBUTE;
347
348 typedef struct
349 {
350 ULONG AttributeType;
351 ULONG CollationRule;
352 ULONG SizeOfEntry;
353 UCHAR ClustersPerIndexRecord;
354 UCHAR Padding[3];
355 INDEX_HEADER_ATTRIBUTE Header;
356 } INDEX_ROOT_ATTRIBUTE, *PINDEX_ROOT_ATTRIBUTE;
357
358 typedef struct
359 {
360 NTFS_RECORD_HEADER Ntfs;
361 ULONGLONG VCN;
362 INDEX_HEADER_ATTRIBUTE Header;
363 } INDEX_BUFFER, *PINDEX_BUFFER;
364
365 typedef struct
366 {
367 union
368 {
369 struct
370 {
371 ULONGLONG IndexedFile;
372 } Directory;
373 struct
374 {
375 USHORT DataOffset;
376 USHORT DataLength;
377 ULONG Reserved;
378 } ViewIndex;
379 } Data;
380 USHORT Length;
381 USHORT KeyLength;
382 USHORT Flags;
383 USHORT Reserved;
384 FILENAME_ATTRIBUTE FileName;
385 } INDEX_ENTRY_ATTRIBUTE, *PINDEX_ENTRY_ATTRIBUTE;
386
387 typedef struct
388 {
389 ULONGLONG Unknown1;
390 UCHAR MajorVersion;
391 UCHAR MinorVersion;
392 USHORT Flags;
393 ULONG Unknown2;
394 } VOLINFO_ATTRIBUTE, *PVOLINFO_ATTRIBUTE;
395
396 typedef struct {
397 ULONG ReparseTag;
398 USHORT DataLength;
399 USHORT Reserved;
400 UCHAR Data[1];
401 } REPARSE_POINT_ATTRIBUTE, *PREPARSE_POINT_ATTRIBUTE;
402
403 #define IRPCONTEXT_CANWAIT 0x1
404 #define IRPCONTEXT_COMPLETE 0x2
405 #define IRPCONTEXT_QUEUE 0x4
406
407 typedef struct
408 {
409 NTFSIDENTIFIER Identifier;
410 ULONG Flags;
411 PIO_STACK_LOCATION Stack;
412 UCHAR MajorFunction;
413 UCHAR MinorFunction;
414 WORK_QUEUE_ITEM WorkQueueItem;
415 PIRP Irp;
416 BOOLEAN IsTopLevel;
417 PDEVICE_OBJECT DeviceObject;
418 PFILE_OBJECT FileObject;
419 NTSTATUS SavedExceptionCode;
420 CCHAR PriorityBoost;
421 } NTFS_IRP_CONTEXT, *PNTFS_IRP_CONTEXT;
422
423 typedef struct _NTFS_ATTR_CONTEXT
424 {
425 PUCHAR CacheRun;
426 ULONGLONG CacheRunOffset;
427 LONGLONG CacheRunStartLCN;
428 ULONGLONG CacheRunLength;
429 LONGLONG CacheRunLastLCN;
430 ULONGLONG CacheRunCurrentOffset;
431 NTFS_ATTR_RECORD Record;
432 } NTFS_ATTR_CONTEXT, *PNTFS_ATTR_CONTEXT;
433
434 #define FCB_CACHE_INITIALIZED 0x0001
435 #define FCB_IS_VOLUME_STREAM 0x0002
436 #define FCB_IS_VOLUME 0x0004
437 #define MAX_PATH 260
438
439 typedef struct _FCB
440 {
441 NTFSIDENTIFIER Identifier;
442
443 FSRTL_COMMON_FCB_HEADER RFCB;
444 SECTION_OBJECT_POINTERS SectionObjectPointers;
445
446 PFILE_OBJECT FileObject;
447 PNTFS_VCB Vcb;
448
449 WCHAR Stream[MAX_PATH];
450 WCHAR *ObjectName; /* point on filename (250 chars max) in PathName */
451 WCHAR PathName[MAX_PATH]; /* path+filename 260 max */
452
453 ERESOURCE PagingIoResource;
454 ERESOURCE MainResource;
455
456 LIST_ENTRY FcbListEntry;
457 struct _FCB* ParentFcb;
458
459 ULONG DirIndex;
460
461 LONG RefCount;
462 ULONG Flags;
463
464 ULONGLONG MFTIndex;
465 USHORT LinkCount;
466
467 FILENAME_ATTRIBUTE Entry;
468
469 } NTFS_FCB, *PNTFS_FCB;
470
471 typedef struct _FIND_ATTR_CONTXT
472 {
473 PDEVICE_EXTENSION Vcb;
474 BOOLEAN OnlyResident;
475 PNTFS_ATTR_RECORD FirstAttr;
476 PNTFS_ATTR_RECORD CurrAttr;
477 PNTFS_ATTR_RECORD LastAttr;
478 PNTFS_ATTR_RECORD NonResidentStart;
479 PNTFS_ATTR_RECORD NonResidentEnd;
480 } FIND_ATTR_CONTXT, *PFIND_ATTR_CONTXT;
481
482 extern PNTFS_GLOBAL_DATA NtfsGlobalData;
483
484 FORCEINLINE
485 NTSTATUS
486 NtfsMarkIrpContextForQueue(PNTFS_IRP_CONTEXT IrpContext)
487 {
488 PULONG Flags = &IrpContext->Flags;
489
490 *Flags &= ~IRPCONTEXT_COMPLETE;
491 *Flags |= IRPCONTEXT_QUEUE;
492
493 return STATUS_PENDING;
494 }
495
496 /* attrib.c */
497
498 //VOID
499 //NtfsDumpAttribute(PATTRIBUTE Attribute);
500
501 PUCHAR
502 DecodeRun(PUCHAR DataRun,
503 LONGLONG *DataRunOffset,
504 ULONGLONG *DataRunLength);
505
506 VOID
507 NtfsDumpFileAttributes(PDEVICE_EXTENSION Vcb,
508 PFILE_RECORD_HEADER FileRecord);
509
510 PSTANDARD_INFORMATION
511 GetStandardInformationFromRecord(PDEVICE_EXTENSION Vcb,
512 PFILE_RECORD_HEADER FileRecord);
513
514 PFILENAME_ATTRIBUTE
515 GetFileNameFromRecord(PDEVICE_EXTENSION Vcb,
516 PFILE_RECORD_HEADER FileRecord,
517 UCHAR NameType);
518
519 PFILENAME_ATTRIBUTE
520 GetBestFileNameFromRecord(PDEVICE_EXTENSION Vcb,
521 PFILE_RECORD_HEADER FileRecord);
522
523 NTSTATUS
524 FindFirstAttribute(PFIND_ATTR_CONTXT Context,
525 PDEVICE_EXTENSION Vcb,
526 PFILE_RECORD_HEADER FileRecord,
527 BOOLEAN OnlyResident,
528 PNTFS_ATTR_RECORD * Attribute);
529
530 NTSTATUS
531 FindNextAttribute(PFIND_ATTR_CONTXT Context,
532 PNTFS_ATTR_RECORD * Attribute);
533
534 VOID
535 FindCloseAttribute(PFIND_ATTR_CONTXT Context);
536
537 /* blockdev.c */
538
539 NTSTATUS
540 NtfsReadDisk(IN PDEVICE_OBJECT DeviceObject,
541 IN LONGLONG StartingOffset,
542 IN ULONG Length,
543 IN ULONG SectorSize,
544 IN OUT PUCHAR Buffer,
545 IN BOOLEAN Override);
546
547 NTSTATUS
548 NtfsReadSectors(IN PDEVICE_OBJECT DeviceObject,
549 IN ULONG DiskSector,
550 IN ULONG SectorCount,
551 IN ULONG SectorSize,
552 IN OUT PUCHAR Buffer,
553 IN BOOLEAN Override);
554
555 NTSTATUS
556 NtfsDeviceIoControl(IN PDEVICE_OBJECT DeviceObject,
557 IN ULONG ControlCode,
558 IN PVOID InputBuffer,
559 IN ULONG InputBufferSize,
560 IN OUT PVOID OutputBuffer,
561 IN OUT PULONG OutputBufferSize,
562 IN BOOLEAN Override);
563
564
565 /* close.c */
566
567 NTSTATUS
568 NtfsCloseFile(PDEVICE_EXTENSION DeviceExt,
569 PFILE_OBJECT FileObject);
570
571 NTSTATUS
572 NtfsClose(PNTFS_IRP_CONTEXT IrpContext);
573
574
575 /* create.c */
576
577 NTSTATUS
578 NtfsCreate(PNTFS_IRP_CONTEXT IrpContext);
579
580
581 /* devctl.c */
582
583 NTSTATUS
584 NtfsDeviceControl(PNTFS_IRP_CONTEXT IrpContext);
585
586
587 /* dirctl.c */
588
589 ULONGLONG
590 NtfsGetFileSize(PDEVICE_EXTENSION DeviceExt,
591 PFILE_RECORD_HEADER FileRecord,
592 PCWSTR Stream,
593 ULONG StreamLength,
594 PULONGLONG AllocatedSize);
595
596 NTSTATUS
597 NtfsDirectoryControl(PNTFS_IRP_CONTEXT IrpContext);
598
599
600 /* dispatch.c */
601
602 DRIVER_DISPATCH NtfsFsdDispatch;
603 NTSTATUS NTAPI
604 NtfsFsdDispatch(PDEVICE_OBJECT DeviceObject,
605 PIRP Irp);
606
607
608 /* fastio.c */
609
610 BOOLEAN NTAPI
611 NtfsAcqLazyWrite(PVOID Context,
612 BOOLEAN Wait);
613
614 VOID NTAPI
615 NtfsRelLazyWrite(PVOID Context);
616
617 BOOLEAN NTAPI
618 NtfsAcqReadAhead(PVOID Context,
619 BOOLEAN Wait);
620
621 VOID NTAPI
622 NtfsRelReadAhead(PVOID Context);
623
624 FAST_IO_CHECK_IF_POSSIBLE NtfsFastIoCheckIfPossible;
625 FAST_IO_READ NtfsFastIoRead;
626 FAST_IO_WRITE NtfsFastIoWrite;
627
628
629 /* fcb.c */
630
631 PNTFS_FCB
632 NtfsCreateFCB(PCWSTR FileName,
633 PCWSTR Stream,
634 PNTFS_VCB Vcb);
635
636 VOID
637 NtfsDestroyFCB(PNTFS_FCB Fcb);
638
639 BOOLEAN
640 NtfsFCBIsDirectory(PNTFS_FCB Fcb);
641
642 BOOLEAN
643 NtfsFCBIsReparsePoint(PNTFS_FCB Fcb);
644
645 BOOLEAN
646 NtfsFCBIsCompressed(PNTFS_FCB Fcb);
647
648 BOOLEAN
649 NtfsFCBIsRoot(PNTFS_FCB Fcb);
650
651 VOID
652 NtfsGrabFCB(PNTFS_VCB Vcb,
653 PNTFS_FCB Fcb);
654
655 VOID
656 NtfsReleaseFCB(PNTFS_VCB Vcb,
657 PNTFS_FCB Fcb);
658
659 VOID
660 NtfsAddFCBToTable(PNTFS_VCB Vcb,
661 PNTFS_FCB Fcb);
662
663 PNTFS_FCB
664 NtfsGrabFCBFromTable(PNTFS_VCB Vcb,
665 PCWSTR FileName);
666
667 NTSTATUS
668 NtfsFCBInitializeCache(PNTFS_VCB Vcb,
669 PNTFS_FCB Fcb);
670
671 PNTFS_FCB
672 NtfsMakeRootFCB(PNTFS_VCB Vcb);
673
674 PNTFS_FCB
675 NtfsOpenRootFCB(PNTFS_VCB Vcb);
676
677 NTSTATUS
678 NtfsAttachFCBToFileObject(PNTFS_VCB Vcb,
679 PNTFS_FCB Fcb,
680 PFILE_OBJECT FileObject);
681
682 NTSTATUS
683 NtfsGetFCBForFile(PNTFS_VCB Vcb,
684 PNTFS_FCB *pParentFCB,
685 PNTFS_FCB *pFCB,
686 const PWSTR pFileName);
687
688 NTSTATUS
689 NtfsReadFCBAttribute(PNTFS_VCB Vcb,
690 PNTFS_FCB pFCB,
691 ULONG Type,
692 PCWSTR Name,
693 ULONG NameLength,
694 PVOID * Data);
695
696 NTSTATUS
697 NtfsMakeFCBFromDirEntry(PNTFS_VCB Vcb,
698 PNTFS_FCB DirectoryFCB,
699 PUNICODE_STRING Name,
700 PCWSTR Stream,
701 PFILE_RECORD_HEADER Record,
702 ULONGLONG MFTIndex,
703 PNTFS_FCB * fileFCB);
704
705
706 /* finfo.c */
707
708 NTSTATUS
709 NtfsQueryInformation(PNTFS_IRP_CONTEXT IrpContext);
710
711
712 /* fsctl.c */
713
714 NTSTATUS
715 NtfsFileSystemControl(PNTFS_IRP_CONTEXT IrpContext);
716
717
718 /* mft.c */
719 PNTFS_ATTR_CONTEXT
720 PrepareAttributeContext(PNTFS_ATTR_RECORD AttrRecord);
721
722 VOID
723 ReleaseAttributeContext(PNTFS_ATTR_CONTEXT Context);
724
725 ULONG
726 ReadAttribute(PDEVICE_EXTENSION Vcb,
727 PNTFS_ATTR_CONTEXT Context,
728 ULONGLONG Offset,
729 PCHAR Buffer,
730 ULONG Length);
731
732 ULONGLONG
733 AttributeDataLength(PNTFS_ATTR_RECORD AttrRecord);
734
735 ULONG
736 AttributeAllocatedLength(PNTFS_ATTR_RECORD AttrRecord);
737
738 NTSTATUS
739 ReadFileRecord(PDEVICE_EXTENSION Vcb,
740 ULONGLONG index,
741 PFILE_RECORD_HEADER file);
742
743 NTSTATUS
744 FindAttribute(PDEVICE_EXTENSION Vcb,
745 PFILE_RECORD_HEADER MftRecord,
746 ULONG Type,
747 PCWSTR Name,
748 ULONG NameLength,
749 PNTFS_ATTR_CONTEXT * AttrCtx);
750
751 VOID
752 ReadVCN(PDEVICE_EXTENSION Vcb,
753 PFILE_RECORD_HEADER file,
754 ATTRIBUTE_TYPE type,
755 ULONGLONG vcn,
756 ULONG count,
757 PVOID buffer);
758
759 NTSTATUS
760 FixupUpdateSequenceArray(PDEVICE_EXTENSION Vcb,
761 PNTFS_RECORD_HEADER Record);
762
763 NTSTATUS
764 ReadLCN(PDEVICE_EXTENSION Vcb,
765 ULONGLONG lcn,
766 ULONG count,
767 PVOID buffer);
768
769 VOID
770 EnumerAttribute(PFILE_RECORD_HEADER file,
771 PDEVICE_EXTENSION Vcb,
772 PDEVICE_OBJECT DeviceObject);
773
774 NTSTATUS
775 NtfsLookupFile(PDEVICE_EXTENSION Vcb,
776 PUNICODE_STRING PathName,
777 PFILE_RECORD_HEADER *FileRecord,
778 PULONGLONG MFTIndex);
779
780 NTSTATUS
781 NtfsLookupFileAt(PDEVICE_EXTENSION Vcb,
782 PUNICODE_STRING PathName,
783 PFILE_RECORD_HEADER *FileRecord,
784 PULONGLONG MFTIndex,
785 ULONGLONG CurrentMFTIndex);
786
787 NTSTATUS
788 NtfsFindFileAt(PDEVICE_EXTENSION Vcb,
789 PUNICODE_STRING SearchPattern,
790 PULONG FirstEntry,
791 PFILE_RECORD_HEADER *FileRecord,
792 PULONGLONG MFTIndex,
793 ULONGLONG CurrentMFTIndex);
794
795 /* misc.c */
796
797 BOOLEAN
798 NtfsIsIrpTopLevel(PIRP Irp);
799
800 PNTFS_IRP_CONTEXT
801 NtfsAllocateIrpContext(PDEVICE_OBJECT DeviceObject,
802 PIRP Irp);
803
804 PVOID
805 NtfsGetUserBuffer(PIRP Irp,
806 BOOLEAN Paging);
807
808 #if 0
809 BOOLEAN
810 wstrcmpjoki(PWSTR s1, PWSTR s2);
811
812 VOID
813 CdfsSwapString(PWCHAR Out,
814 PUCHAR In,
815 ULONG Count);
816 #endif
817
818 VOID
819 NtfsFileFlagsToAttributes(ULONG NtfsAttributes,
820 PULONG FileAttributes);
821
822
823 /* rw.c */
824
825 NTSTATUS
826 NtfsRead(PNTFS_IRP_CONTEXT IrpContext);
827
828 NTSTATUS
829 NtfsWrite(PNTFS_IRP_CONTEXT IrpContext);
830
831
832 /* volinfo.c */
833
834 ULONGLONG
835 NtfsGetFreeClusters(PDEVICE_EXTENSION DeviceExt);
836
837 NTSTATUS
838 NtfsQueryVolumeInformation(PNTFS_IRP_CONTEXT IrpContext);
839
840 NTSTATUS
841 NtfsSetVolumeInformation(PNTFS_IRP_CONTEXT IrpContext);
842
843
844 /* ntfs.c */
845
846 DRIVER_INITIALIZE DriverEntry;
847
848 VOID
849 NTAPI
850 NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject);
851
852 #endif /* NTFS_H */