[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 } NTFS_GLOBAL_DATA, *PNTFS_GLOBAL_DATA;
141
142
143 typedef enum
144 {
145 AttributeStandardInformation = 0x10,
146 AttributeAttributeList = 0x20,
147 AttributeFileName = 0x30,
148 AttributeObjectId = 0x40,
149 AttributeSecurityDescriptor = 0x50,
150 AttributeVolumeName = 0x60,
151 AttributeVolumeInformation = 0x70,
152 AttributeData = 0x80,
153 AttributeIndexRoot = 0x90,
154 AttributeIndexAllocation = 0xA0,
155 AttributeBitmap = 0xB0,
156 AttributeReparsePoint = 0xC0,
157 AttributeEAInformation = 0xD0,
158 AttributeEA = 0xE0,
159 AttributePropertySet = 0xF0,
160 AttributeLoggedUtilityStream = 0x100,
161 AttributeEnd = 0xFFFFFFFF
162 } ATTRIBUTE_TYPE, *PATTRIBUTE_TYPE;
163
164 #define NTFS_FILE_MFT 0
165 #define NTFS_FILE_MFTMIRR 1
166 #define NTFS_FILE_LOGFILE 2
167 #define NTFS_FILE_VOLUME 3
168 #define NTFS_FILE_ATTRDEF 4
169 #define NTFS_FILE_ROOT 5
170 #define NTFS_FILE_BITMAP 6
171 #define NTFS_FILE_BOOT 7
172 #define NTFS_FILE_BADCLUS 8
173 #define NTFS_FILE_QUOTA 9
174 #define NTFS_FILE_UPCASE 10
175 #define NTFS_FILE_EXTEND 11
176
177 #define NTFS_MFT_MASK 0x0000FFFFFFFFFFFFULL
178
179 #define COLLATION_BINARY 0x00
180 #define COLLATION_FILE_NAME 0x01
181 #define COLLATION_UNICODE_STRING 0x02
182 #define COLLATION_NTOFS_ULONG 0x10
183 #define COLLATION_NTOFS_SID 0x11
184 #define COLLATION_NTOFS_SECURITY_HASH 0x12
185 #define COLLATION_NTOFS_ULONGS 0x13
186
187 #define INDEX_ROOT_SMALL 0x0
188 #define INDEX_ROOT_LARGE 0x1
189
190 #define NTFS_INDEX_ENTRY_NODE 1
191 #define NTFS_INDEX_ENTRY_END 2
192
193 #define NTFS_FILE_NAME_POSIX 0
194 #define NTFS_FILE_NAME_WIN32 1
195 #define NTFS_FILE_NAME_DOS 2
196 #define NTFS_FILE_NAME_WIN32_AND_DOS 3
197
198 #define NTFS_FILE_TYPE_READ_ONLY 0x1
199 #define NTFS_FILE_TYPE_HIDDEN 0x2
200 #define NTFS_FILE_TYPE_SYSTEM 0x4
201 #define NTFS_FILE_TYPE_ARCHIVE 0x20
202 #define NTFS_FILE_TYPE_REPARSE 0x400
203 #define NTFS_FILE_TYPE_COMPRESSED 0x800
204 #define NTFS_FILE_TYPE_DIRECTORY 0x10000000
205
206 typedef struct
207 {
208 ULONG Type; /* Magic number 'FILE' */
209 USHORT UsaOffset; /* Offset to the update sequence */
210 USHORT UsaCount; /* Size in words of Update Sequence Number & Array (S) */
211 ULONGLONG Lsn; /* $LogFile Sequence Number (LSN) */
212 } NTFS_RECORD_HEADER, *PNTFS_RECORD_HEADER;
213
214 /* NTFS_RECORD_HEADER.Type */
215 #define NRH_FILE_TYPE 0x454C4946 /* 'FILE' */
216 #define NRH_INDX_TYPE 0x58444E49 /* 'INDX' */
217
218
219 typedef struct _FILE_RECORD_HEADER
220 {
221 NTFS_RECORD_HEADER Ntfs;
222 USHORT SequenceNumber; /* Sequence number */
223 USHORT LinkCount; /* Hard link count */
224 USHORT AttributeOffset; /* Offset to the first Attribute */
225 USHORT Flags; /* Flags */
226 ULONG BytesInUse; /* Real size of the FILE record */
227 ULONG BytesAllocated; /* Allocated size of the FILE record */
228 ULONGLONG BaseFileRecord; /* File reference to the base FILE record */
229 USHORT NextAttributeNumber; /* Next Attribute Id */
230 USHORT Pading; /* Align to 4 UCHAR boundary (XP) */
231 ULONG MFTRecordNumber; /* Number of this MFT Record (XP) */
232 } FILE_RECORD_HEADER, *PFILE_RECORD_HEADER;
233
234 /* Flags in FILE_RECORD_HEADER */
235
236 #define FRH_IN_USE 0x0001 /* Record is in use */
237 #define FRH_DIRECTORY 0x0002 /* Record is a directory */
238 #define FRH_UNKNOWN1 0x0004 /* Don't know */
239 #define FRH_UNKNOWN2 0x0008 /* Don't know */
240
241 typedef struct
242 {
243 ULONG Type;
244 ULONG Length;
245 UCHAR IsNonResident;
246 UCHAR NameLength;
247 USHORT NameOffset;
248 USHORT Flags;
249 USHORT Instance;
250 union
251 {
252 // Resident attributes
253 struct
254 {
255 ULONG ValueLength;
256 USHORT ValueOffset;
257 UCHAR Flags;
258 UCHAR Reserved;
259 } Resident;
260 // Non-resident attributes
261 struct
262 {
263 ULONGLONG LowestVCN;
264 ULONGLONG HighestVCN;
265 USHORT MappingPairsOffset;
266 USHORT CompressionUnit;
267 UCHAR Reserved[4];
268 LONGLONG AllocatedSize;
269 LONGLONG DataSize;
270 LONGLONG InitializedSize;
271 LONGLONG CompressedSize;
272 } NonResident;
273 };
274 } NTFS_ATTR_RECORD, *PNTFS_ATTR_RECORD;
275
276 typedef struct
277 {
278 ULONGLONG CreationTime;
279 ULONGLONG ChangeTime;
280 ULONGLONG LastWriteTime;
281 ULONGLONG LastAccessTime;
282 ULONG FileAttribute;
283 ULONG AlignmentOrReserved[3];
284 #if 0
285 ULONG QuotaId;
286 ULONG SecurityId;
287 ULONGLONG QuotaCharge;
288 USN Usn;
289 #endif
290 } STANDARD_INFORMATION, *PSTANDARD_INFORMATION;
291
292
293 typedef struct
294 {
295 ATTRIBUTE_TYPE AttributeType;
296 USHORT Length;
297 UCHAR NameLength;
298 UCHAR NameOffset;
299 ULONGLONG StartVcn; // LowVcn
300 ULONGLONG FileReferenceNumber;
301 USHORT AttributeNumber;
302 USHORT AlignmentOrReserved[3];
303 } ATTRIBUTE_LIST, *PATTRIBUTE_LIST;
304
305
306 typedef struct
307 {
308 ULONGLONG DirectoryFileReferenceNumber;
309 ULONGLONG CreationTime;
310 ULONGLONG ChangeTime;
311 ULONGLONG LastWriteTime;
312 ULONGLONG LastAccessTime;
313 ULONGLONG AllocatedSize;
314 ULONGLONG DataSize;
315 ULONG FileAttributes;
316 union
317 {
318 struct
319 {
320 USHORT PackedEaSize;
321 USHORT AlignmentOrReserved;
322 } EaInfo;
323 ULONG ReparseTag;
324 } Extended;
325 UCHAR NameLength;
326 UCHAR NameType;
327 WCHAR Name[1];
328 } FILENAME_ATTRIBUTE, *PFILENAME_ATTRIBUTE;
329
330 typedef struct
331 {
332 ULONG FirstEntryOffset;
333 ULONG TotalSizeOfEntries;
334 ULONG AllocatedSize;
335 UCHAR Flags;
336 UCHAR Padding[3];
337 } INDEX_HEADER_ATTRIBUTE, *PINDEX_HEADER_ATTRIBUTE;
338
339 typedef struct
340 {
341 ULONG AttributeType;
342 ULONG CollationRule;
343 ULONG SizeOfEntry;
344 UCHAR ClustersPerIndexRecord;
345 UCHAR Padding[3];
346 INDEX_HEADER_ATTRIBUTE Header;
347 } INDEX_ROOT_ATTRIBUTE, *PINDEX_ROOT_ATTRIBUTE;
348
349 typedef struct
350 {
351 NTFS_RECORD_HEADER Ntfs;
352 ULONGLONG VCN;
353 INDEX_HEADER_ATTRIBUTE Header;
354 } INDEX_BUFFER, *PINDEX_BUFFER;
355
356 typedef struct
357 {
358 union
359 {
360 struct
361 {
362 ULONGLONG IndexedFile;
363 } Directory;
364 struct
365 {
366 USHORT DataOffset;
367 USHORT DataLength;
368 ULONG Reserved;
369 } ViewIndex;
370 } Data;
371 USHORT Length;
372 USHORT KeyLength;
373 USHORT Flags;
374 USHORT Reserved;
375 FILENAME_ATTRIBUTE FileName;
376 } INDEX_ENTRY_ATTRIBUTE, *PINDEX_ENTRY_ATTRIBUTE;
377
378 typedef struct
379 {
380 ULONGLONG Unknown1;
381 UCHAR MajorVersion;
382 UCHAR MinorVersion;
383 USHORT Flags;
384 ULONG Unknown2;
385 } VOLINFO_ATTRIBUTE, *PVOLINFO_ATTRIBUTE;
386
387 typedef struct {
388 ULONG ReparseTag;
389 USHORT DataLength;
390 USHORT Reserved;
391 UCHAR Data[1];
392 } REPARSE_POINT_ATTRIBUTE, *PREPARSE_POINT_ATTRIBUTE;
393
394 #define IRPCONTEXT_CANWAIT 0x1
395
396 typedef struct
397 {
398 NTFSIDENTIFIER Identifier;
399 ULONG Flags;
400 PIO_STACK_LOCATION Stack;
401 UCHAR MajorFunction;
402 UCHAR MinorFunction;
403 WORK_QUEUE_ITEM WorkQueueItem;
404 PIRP Irp;
405 BOOLEAN IsTopLevel;
406 PDEVICE_OBJECT DeviceObject;
407 PFILE_OBJECT FileObject;
408 NTSTATUS SavedExceptionCode;
409 CCHAR PriorityBoost;
410 } NTFS_IRP_CONTEXT, *PNTFS_IRP_CONTEXT;
411
412 typedef struct _NTFS_ATTR_CONTEXT
413 {
414 PUCHAR CacheRun;
415 ULONGLONG CacheRunOffset;
416 LONGLONG CacheRunStartLCN;
417 ULONGLONG CacheRunLength;
418 LONGLONG CacheRunLastLCN;
419 ULONGLONG CacheRunCurrentOffset;
420 NTFS_ATTR_RECORD Record;
421 } NTFS_ATTR_CONTEXT, *PNTFS_ATTR_CONTEXT;
422
423 #define FCB_CACHE_INITIALIZED 0x0001
424 #define FCB_IS_VOLUME_STREAM 0x0002
425 #define FCB_IS_VOLUME 0x0004
426 #define MAX_PATH 260
427
428 typedef struct _FCB
429 {
430 NTFSIDENTIFIER Identifier;
431
432 FSRTL_COMMON_FCB_HEADER RFCB;
433 SECTION_OBJECT_POINTERS SectionObjectPointers;
434
435 PFILE_OBJECT FileObject;
436 PNTFS_VCB Vcb;
437
438 WCHAR *ObjectName; /* point on filename (250 chars max) in PathName */
439 WCHAR PathName[MAX_PATH]; /* path+filename 260 max */
440
441 ERESOURCE PagingIoResource;
442 ERESOURCE MainResource;
443
444 LIST_ENTRY FcbListEntry;
445 struct _FCB* ParentFcb;
446
447 ULONG DirIndex;
448
449 LONG RefCount;
450 ULONG Flags;
451
452 ULONGLONG MFTIndex;
453 USHORT LinkCount;
454
455 FILENAME_ATTRIBUTE Entry;
456
457 } NTFS_FCB, *PNTFS_FCB;
458
459 extern PNTFS_GLOBAL_DATA NtfsGlobalData;
460
461 //int CdfsStrcmpi( wchar_t *str1, wchar_t *str2 );
462 //void CdfsWstrcpy( wchar_t *str1, wchar_t *str2, int max );
463
464
465 /* attrib.c */
466
467 //VOID
468 //NtfsDumpAttribute(PATTRIBUTE Attribute);
469
470 PUCHAR
471 DecodeRun(PUCHAR DataRun,
472 LONGLONG *DataRunOffset,
473 ULONGLONG *DataRunLength);
474
475 VOID
476 NtfsDumpFileAttributes(PFILE_RECORD_HEADER FileRecord);
477
478 PSTANDARD_INFORMATION
479 GetStandardInformationFromRecord(PFILE_RECORD_HEADER FileRecord);
480
481 PFILENAME_ATTRIBUTE
482 GetFileNameFromRecord(PFILE_RECORD_HEADER FileRecord, UCHAR NameType);
483
484 PFILENAME_ATTRIBUTE
485 GetBestFileNameFromRecord(PFILE_RECORD_HEADER FileRecord);
486
487 /* blockdev.c */
488
489 NTSTATUS
490 NtfsReadDisk(IN PDEVICE_OBJECT DeviceObject,
491 IN LONGLONG StartingOffset,
492 IN ULONG Length,
493 IN ULONG SectorSize,
494 IN OUT PUCHAR Buffer,
495 IN BOOLEAN Override);
496
497 NTSTATUS
498 NtfsReadSectors(IN PDEVICE_OBJECT DeviceObject,
499 IN ULONG DiskSector,
500 IN ULONG SectorCount,
501 IN ULONG SectorSize,
502 IN OUT PUCHAR Buffer,
503 IN BOOLEAN Override);
504
505 NTSTATUS
506 NtfsDeviceIoControl(IN PDEVICE_OBJECT DeviceObject,
507 IN ULONG ControlCode,
508 IN PVOID InputBuffer,
509 IN ULONG InputBufferSize,
510 IN OUT PVOID OutputBuffer,
511 IN OUT PULONG OutputBufferSize,
512 IN BOOLEAN Override);
513
514
515 /* close.c */
516
517 NTSTATUS
518 NtfsCloseFile(PDEVICE_EXTENSION DeviceExt,
519 PFILE_OBJECT FileObject);
520
521 DRIVER_DISPATCH NtfsFsdClose;
522 NTSTATUS NTAPI
523 NtfsFsdClose(PDEVICE_OBJECT DeviceObject,
524 PIRP Irp);
525
526
527 /* create.c */
528
529 DRIVER_DISPATCH NtfsFsdCreate;
530 NTSTATUS NTAPI
531 NtfsFsdCreate(PDEVICE_OBJECT DeviceObject,
532 PIRP Irp);
533
534
535 /* devctl.c */
536
537 DRIVER_DISPATCH NtfsFsdDeviceControl;
538 NTSTATUS NTAPI
539 NtfsFsdDeviceControl(PDEVICE_OBJECT DeviceObject,
540 PIRP Irp);
541
542
543 /* dirctl.c */
544
545 NTSTATUS
546 NtfsDirectoryControl(PNTFS_IRP_CONTEXT IrpContext);
547
548
549 /* dispatch.c */
550
551 DRIVER_DISPATCH NtfsFsdDispatch;
552 NTSTATUS NTAPI
553 NtfsFsdDispatch(PDEVICE_OBJECT DeviceObject,
554 PIRP Irp);
555
556
557 /* fastio.c */
558
559 BOOLEAN NTAPI
560 NtfsAcqLazyWrite(PVOID Context,
561 BOOLEAN Wait);
562
563 VOID NTAPI
564 NtfsRelLazyWrite(PVOID Context);
565
566 BOOLEAN NTAPI
567 NtfsAcqReadAhead(PVOID Context,
568 BOOLEAN Wait);
569
570 VOID NTAPI
571 NtfsRelReadAhead(PVOID Context);
572
573 FAST_IO_CHECK_IF_POSSIBLE NtfsFastIoCheckIfPossible;
574 FAST_IO_READ NtfsFastIoRead;
575 FAST_IO_WRITE NtfsFastIoWrite;
576
577
578 /* fcb.c */
579
580 PNTFS_FCB
581 NtfsCreateFCB(PCWSTR FileName,
582 PNTFS_VCB Vcb);
583
584 VOID
585 NtfsDestroyFCB(PNTFS_FCB Fcb);
586
587 BOOLEAN
588 NtfsFCBIsDirectory(PNTFS_FCB Fcb);
589
590 BOOLEAN
591 NtfsFCBIsReparsePoint(PNTFS_FCB Fcb);
592
593 BOOLEAN
594 NtfsFCBIsRoot(PNTFS_FCB Fcb);
595
596 VOID
597 NtfsGrabFCB(PNTFS_VCB Vcb,
598 PNTFS_FCB Fcb);
599
600 VOID
601 NtfsReleaseFCB(PNTFS_VCB Vcb,
602 PNTFS_FCB Fcb);
603
604 VOID
605 NtfsAddFCBToTable(PNTFS_VCB Vcb,
606 PNTFS_FCB Fcb);
607
608 PNTFS_FCB
609 NtfsGrabFCBFromTable(PNTFS_VCB Vcb,
610 PCWSTR FileName);
611
612 NTSTATUS
613 NtfsFCBInitializeCache(PNTFS_VCB Vcb,
614 PNTFS_FCB Fcb);
615
616 PNTFS_FCB
617 NtfsMakeRootFCB(PNTFS_VCB Vcb);
618
619 PNTFS_FCB
620 NtfsOpenRootFCB(PNTFS_VCB Vcb);
621
622 NTSTATUS
623 NtfsAttachFCBToFileObject(PNTFS_VCB Vcb,
624 PNTFS_FCB Fcb,
625 PFILE_OBJECT FileObject);
626
627 NTSTATUS
628 NtfsGetFCBForFile(PNTFS_VCB Vcb,
629 PNTFS_FCB *pParentFCB,
630 PNTFS_FCB *pFCB,
631 const PWSTR pFileName);
632
633 NTSTATUS
634 NtfsReadFCBAttribute(PNTFS_VCB Vcb,
635 PNTFS_FCB pFCB,
636 ULONG Type,
637 PCWSTR Name,
638 ULONG NameLength,
639 PVOID * Data);
640
641
642 /* finfo.c */
643
644 NTSTATUS
645 NtfsQueryInformation(PNTFS_IRP_CONTEXT IrpContext);
646
647
648 /* fsctl.c */
649
650 DRIVER_DISPATCH NtfsFsdFileSystemControl;
651 NTSTATUS NTAPI
652 NtfsFsdFileSystemControl(PDEVICE_OBJECT DeviceObject,
653 PIRP Irp);
654
655
656 /* mft.c */
657 VOID
658 ReleaseAttributeContext(PNTFS_ATTR_CONTEXT Context);
659
660 ULONG
661 ReadAttribute(PDEVICE_EXTENSION Vcb,
662 PNTFS_ATTR_CONTEXT Context,
663 ULONGLONG Offset,
664 PCHAR Buffer,
665 ULONG Length);
666
667 ULONGLONG
668 AttributeDataLength(PNTFS_ATTR_RECORD AttrRecord);
669
670 ULONG
671 AttributeAllocatedLength(PNTFS_ATTR_RECORD AttrRecord);
672
673 NTSTATUS
674 ReadFileRecord(PDEVICE_EXTENSION Vcb,
675 ULONGLONG index,
676 PFILE_RECORD_HEADER file);
677
678 NTSTATUS
679 FindAttribute(PDEVICE_EXTENSION Vcb,
680 PFILE_RECORD_HEADER MftRecord,
681 ULONG Type,
682 PCWSTR Name,
683 ULONG NameLength,
684 PNTFS_ATTR_CONTEXT * AttrCtx);
685
686 VOID
687 ReadVCN(PDEVICE_EXTENSION Vcb,
688 PFILE_RECORD_HEADER file,
689 ATTRIBUTE_TYPE type,
690 ULONGLONG vcn,
691 ULONG count,
692 PVOID buffer);
693
694 NTSTATUS
695 FixupUpdateSequenceArray(PDEVICE_EXTENSION Vcb,
696 PNTFS_RECORD_HEADER Record);
697
698 NTSTATUS
699 ReadLCN(PDEVICE_EXTENSION Vcb,
700 ULONGLONG lcn,
701 ULONG count,
702 PVOID buffer);
703
704 VOID
705 EnumerAttribute(PFILE_RECORD_HEADER file,
706 PDEVICE_EXTENSION Vcb,
707 PDEVICE_OBJECT DeviceObject);
708
709 NTSTATUS
710 NtfsLookupFile(PDEVICE_EXTENSION Vcb,
711 PUNICODE_STRING PathName,
712 PFILE_RECORD_HEADER *FileRecord,
713 PNTFS_ATTR_CONTEXT *DataContext,
714 PULONGLONG MFTIndex);
715
716 NTSTATUS
717 NtfsLookupFileAt(PDEVICE_EXTENSION Vcb,
718 PUNICODE_STRING PathName,
719 PFILE_RECORD_HEADER *FileRecord,
720 PNTFS_ATTR_CONTEXT *DataContext,
721 PULONGLONG MFTIndex,
722 ULONGLONG CurrentMFTIndex);
723
724 NTSTATUS
725 NtfsFindFileAt(PDEVICE_EXTENSION Vcb,
726 PUNICODE_STRING SearchPattern,
727 PULONG FirstEntry,
728 PFILE_RECORD_HEADER *FileRecord,
729 PNTFS_ATTR_CONTEXT *DataContext,
730 PULONGLONG MFTIndex,
731 ULONGLONG CurrentMFTIndex);
732
733 /* misc.c */
734
735 BOOLEAN
736 NtfsIsIrpTopLevel(PIRP Irp);
737
738 PNTFS_IRP_CONTEXT
739 NtfsAllocateIrpContext(PDEVICE_OBJECT DeviceObject,
740 PIRP Irp);
741
742 PVOID
743 NtfsGetUserBuffer(PIRP Irp);
744
745 #if 0
746 BOOLEAN
747 wstrcmpjoki(PWSTR s1, PWSTR s2);
748
749 VOID
750 CdfsSwapString(PWCHAR Out,
751 PUCHAR In,
752 ULONG Count);
753 #endif
754
755 VOID
756 NtfsFileFlagsToAttributes(ULONG NtfsAttributes,
757 PULONG FileAttributes);
758
759
760 /* rw.c */
761
762 DRIVER_DISPATCH NtfsFsdRead;
763 NTSTATUS NTAPI
764 NtfsFsdRead(PDEVICE_OBJECT DeviceObject,
765 PIRP Irp);
766
767 DRIVER_DISPATCH NtfsFsdWrite;
768 NTSTATUS NTAPI
769 NtfsFsdWrite(PDEVICE_OBJECT DeviceObject,
770 PIRP Irp);
771
772
773 /* volinfo.c */
774
775 ULONGLONG
776 NtfsGetFreeClusters(PDEVICE_EXTENSION DeviceExt);
777
778 NTSTATUS
779 NtfsQueryVolumeInformation(PNTFS_IRP_CONTEXT IrpContext);
780
781 NTSTATUS
782 NtfsSetVolumeInformation(PNTFS_IRP_CONTEXT IrpContext);
783
784
785 /* ntfs.c */
786
787 DRIVER_INITIALIZE DriverEntry;
788
789 VOID
790 NTAPI
791 NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject);
792
793 #endif /* NTFS_H */