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