[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 typedef struct
395 {
396 NTFSIDENTIFIER Identifier;
397 ULONG Flags;
398 UCHAR MajorFunction;
399 UCHAR MinorFunction;
400 WORK_QUEUE_ITEM WorkQueueItem;
401 PIRP Irp;
402 BOOLEAN IsTopLevel;
403 PDEVICE_OBJECT DeviceObject;
404 NTSTATUS SavedExceptionCode;
405 } NTFS_IRP_CONTEXT, *PNTFS_IRP_CONTEXT;
406
407 typedef struct _NTFS_ATTR_CONTEXT
408 {
409 PUCHAR CacheRun;
410 ULONGLONG CacheRunOffset;
411 LONGLONG CacheRunStartLCN;
412 ULONGLONG CacheRunLength;
413 LONGLONG CacheRunLastLCN;
414 ULONGLONG CacheRunCurrentOffset;
415 NTFS_ATTR_RECORD Record;
416 } NTFS_ATTR_CONTEXT, *PNTFS_ATTR_CONTEXT;
417
418 #define FCB_CACHE_INITIALIZED 0x0001
419 #define FCB_IS_VOLUME_STREAM 0x0002
420 #define FCB_IS_VOLUME 0x0004
421 #define MAX_PATH 260
422
423 typedef struct _FCB
424 {
425 NTFSIDENTIFIER Identifier;
426
427 FSRTL_COMMON_FCB_HEADER RFCB;
428 SECTION_OBJECT_POINTERS SectionObjectPointers;
429
430 PFILE_OBJECT FileObject;
431 PNTFS_VCB Vcb;
432
433 WCHAR *ObjectName; /* point on filename (250 chars max) in PathName */
434 WCHAR PathName[MAX_PATH]; /* path+filename 260 max */
435
436 ERESOURCE PagingIoResource;
437 ERESOURCE MainResource;
438
439 LIST_ENTRY FcbListEntry;
440 struct _FCB* ParentFcb;
441
442 ULONG DirIndex;
443
444 LONG RefCount;
445 ULONG Flags;
446
447 ULONGLONG MFTIndex;
448 USHORT LinkCount;
449
450 FILENAME_ATTRIBUTE Entry;
451
452 } NTFS_FCB, *PNTFS_FCB;
453
454 extern PNTFS_GLOBAL_DATA NtfsGlobalData;
455
456 //int CdfsStrcmpi( wchar_t *str1, wchar_t *str2 );
457 //void CdfsWstrcpy( wchar_t *str1, wchar_t *str2, int max );
458
459
460 /* attrib.c */
461
462 //VOID
463 //NtfsDumpAttribute(PATTRIBUTE Attribute);
464
465 PUCHAR
466 DecodeRun(PUCHAR DataRun,
467 LONGLONG *DataRunOffset,
468 ULONGLONG *DataRunLength);
469
470 VOID
471 NtfsDumpFileAttributes(PFILE_RECORD_HEADER FileRecord);
472
473 PSTANDARD_INFORMATION
474 GetStandardInformationFromRecord(PFILE_RECORD_HEADER FileRecord);
475
476 PFILENAME_ATTRIBUTE
477 GetFileNameFromRecord(PFILE_RECORD_HEADER FileRecord, UCHAR NameType);
478
479 PFILENAME_ATTRIBUTE
480 GetBestFileNameFromRecord(PFILE_RECORD_HEADER FileRecord);
481
482 /* blockdev.c */
483
484 NTSTATUS
485 NtfsReadDisk(IN PDEVICE_OBJECT DeviceObject,
486 IN LONGLONG StartingOffset,
487 IN ULONG Length,
488 IN ULONG SectorSize,
489 IN OUT PUCHAR Buffer,
490 IN BOOLEAN Override);
491
492 NTSTATUS
493 NtfsReadSectors(IN PDEVICE_OBJECT DeviceObject,
494 IN ULONG DiskSector,
495 IN ULONG SectorCount,
496 IN ULONG SectorSize,
497 IN OUT PUCHAR Buffer,
498 IN BOOLEAN Override);
499
500 NTSTATUS
501 NtfsDeviceIoControl(IN PDEVICE_OBJECT DeviceObject,
502 IN ULONG ControlCode,
503 IN PVOID InputBuffer,
504 IN ULONG InputBufferSize,
505 IN OUT PVOID OutputBuffer,
506 IN OUT PULONG OutputBufferSize,
507 IN BOOLEAN Override);
508
509
510 /* close.c */
511
512 NTSTATUS
513 NtfsCloseFile(PDEVICE_EXTENSION DeviceExt,
514 PFILE_OBJECT FileObject);
515
516 DRIVER_DISPATCH NtfsFsdClose;
517 NTSTATUS NTAPI
518 NtfsFsdClose(PDEVICE_OBJECT DeviceObject,
519 PIRP Irp);
520
521
522 /* create.c */
523
524 DRIVER_DISPATCH NtfsFsdCreate;
525 NTSTATUS NTAPI
526 NtfsFsdCreate(PDEVICE_OBJECT DeviceObject,
527 PIRP Irp);
528
529
530 /* devctl.c */
531
532 DRIVER_DISPATCH NtfsFsdDeviceControl;
533 NTSTATUS NTAPI
534 NtfsFsdDeviceControl(PDEVICE_OBJECT DeviceObject,
535 PIRP Irp);
536
537
538 /* dirctl.c */
539
540 DRIVER_DISPATCH NtfsFsdDirectoryControl;
541 NTSTATUS NTAPI
542 NtfsFsdDirectoryControl(PDEVICE_OBJECT DeviceObject,
543 PIRP Irp);
544
545
546 /* dispatch.c */
547
548 DRIVER_DISPATCH NtfsFsdDispatch;
549 NTSTATUS NTAPI
550 NtfsFsdDispatch(PDEVICE_OBJECT DeviceObject,
551 PIRP Irp);
552
553
554 /* fastio.c */
555
556 BOOLEAN NTAPI
557 NtfsAcqLazyWrite(PVOID Context,
558 BOOLEAN Wait);
559
560 VOID NTAPI
561 NtfsRelLazyWrite(PVOID Context);
562
563 BOOLEAN NTAPI
564 NtfsAcqReadAhead(PVOID Context,
565 BOOLEAN Wait);
566
567 VOID NTAPI
568 NtfsRelReadAhead(PVOID Context);
569
570 FAST_IO_CHECK_IF_POSSIBLE NtfsFastIoCheckIfPossible;
571 FAST_IO_READ NtfsFastIoRead;
572 FAST_IO_WRITE NtfsFastIoWrite;
573
574
575 /* fcb.c */
576
577 PNTFS_FCB
578 NtfsCreateFCB(PCWSTR FileName,
579 PNTFS_VCB Vcb);
580
581 VOID
582 NtfsDestroyFCB(PNTFS_FCB Fcb);
583
584 BOOLEAN
585 NtfsFCBIsDirectory(PNTFS_FCB Fcb);
586
587 BOOLEAN
588 NtfsFCBIsReparsePoint(PNTFS_FCB Fcb);
589
590 BOOLEAN
591 NtfsFCBIsRoot(PNTFS_FCB Fcb);
592
593 VOID
594 NtfsGrabFCB(PNTFS_VCB Vcb,
595 PNTFS_FCB Fcb);
596
597 VOID
598 NtfsReleaseFCB(PNTFS_VCB Vcb,
599 PNTFS_FCB Fcb);
600
601 VOID
602 NtfsAddFCBToTable(PNTFS_VCB Vcb,
603 PNTFS_FCB Fcb);
604
605 PNTFS_FCB
606 NtfsGrabFCBFromTable(PNTFS_VCB Vcb,
607 PCWSTR FileName);
608
609 NTSTATUS
610 NtfsFCBInitializeCache(PNTFS_VCB Vcb,
611 PNTFS_FCB Fcb);
612
613 PNTFS_FCB
614 NtfsMakeRootFCB(PNTFS_VCB Vcb);
615
616 PNTFS_FCB
617 NtfsOpenRootFCB(PNTFS_VCB Vcb);
618
619 NTSTATUS
620 NtfsAttachFCBToFileObject(PNTFS_VCB Vcb,
621 PNTFS_FCB Fcb,
622 PFILE_OBJECT FileObject);
623
624 NTSTATUS
625 NtfsGetFCBForFile(PNTFS_VCB Vcb,
626 PNTFS_FCB *pParentFCB,
627 PNTFS_FCB *pFCB,
628 const PWSTR pFileName);
629
630 NTSTATUS
631 NtfsReadFCBAttribute(PNTFS_VCB Vcb,
632 PNTFS_FCB pFCB,
633 ULONG Type,
634 PCWSTR Name,
635 ULONG NameLength,
636 PVOID * Data);
637
638
639 /* finfo.c */
640
641 DRIVER_DISPATCH NtfsFsdQueryInformation;
642 NTSTATUS NTAPI
643 NtfsFsdQueryInformation(PDEVICE_OBJECT DeviceObject,
644 PIRP Irp);
645
646
647 /* fsctl.c */
648
649 DRIVER_DISPATCH NtfsFsdFileSystemControl;
650 NTSTATUS NTAPI
651 NtfsFsdFileSystemControl(PDEVICE_OBJECT DeviceObject,
652 PIRP Irp);
653
654
655 /* mft.c */
656 VOID
657 ReleaseAttributeContext(PNTFS_ATTR_CONTEXT Context);
658
659 ULONG
660 ReadAttribute(PDEVICE_EXTENSION Vcb,
661 PNTFS_ATTR_CONTEXT Context,
662 ULONGLONG Offset,
663 PCHAR Buffer,
664 ULONG Length);
665
666 ULONGLONG
667 AttributeDataLength(PNTFS_ATTR_RECORD AttrRecord);
668
669 ULONG
670 AttributeAllocatedLength(PNTFS_ATTR_RECORD AttrRecord);
671
672 NTSTATUS
673 ReadFileRecord(PDEVICE_EXTENSION Vcb,
674 ULONGLONG index,
675 PFILE_RECORD_HEADER file);
676
677 NTSTATUS
678 FindAttribute(PDEVICE_EXTENSION Vcb,
679 PFILE_RECORD_HEADER MftRecord,
680 ULONG Type,
681 PCWSTR Name,
682 ULONG NameLength,
683 PNTFS_ATTR_CONTEXT * AttrCtx);
684
685 VOID
686 ReadVCN(PDEVICE_EXTENSION Vcb,
687 PFILE_RECORD_HEADER file,
688 ATTRIBUTE_TYPE type,
689 ULONGLONG vcn,
690 ULONG count,
691 PVOID buffer);
692
693 NTSTATUS
694 FixupUpdateSequenceArray(PDEVICE_EXTENSION Vcb,
695 PNTFS_RECORD_HEADER Record);
696
697 NTSTATUS
698 ReadLCN(PDEVICE_EXTENSION Vcb,
699 ULONGLONG lcn,
700 ULONG count,
701 PVOID buffer);
702
703 VOID
704 EnumerAttribute(PFILE_RECORD_HEADER file,
705 PDEVICE_EXTENSION Vcb,
706 PDEVICE_OBJECT DeviceObject);
707
708 NTSTATUS
709 NtfsLookupFile(PDEVICE_EXTENSION Vcb,
710 PUNICODE_STRING PathName,
711 PFILE_RECORD_HEADER *FileRecord,
712 PNTFS_ATTR_CONTEXT *DataContext,
713 PULONGLONG MFTIndex);
714
715 NTSTATUS
716 NtfsLookupFileAt(PDEVICE_EXTENSION Vcb,
717 PUNICODE_STRING PathName,
718 PFILE_RECORD_HEADER *FileRecord,
719 PNTFS_ATTR_CONTEXT *DataContext,
720 PULONGLONG MFTIndex,
721 ULONGLONG CurrentMFTIndex);
722
723 NTSTATUS
724 NtfsFindFileAt(PDEVICE_EXTENSION Vcb,
725 PUNICODE_STRING SearchPattern,
726 PULONG FirstEntry,
727 PFILE_RECORD_HEADER *FileRecord,
728 PNTFS_ATTR_CONTEXT *DataContext,
729 PULONGLONG MFTIndex,
730 ULONGLONG CurrentMFTIndex);
731
732 /* misc.c */
733
734 BOOLEAN
735 NtfsIsIrpTopLevel(PIRP Irp);
736
737 PNTFS_IRP_CONTEXT
738 NtfsAllocateIrpContext(PDEVICE_OBJECT DeviceObject,
739 PIRP Irp);
740
741 PVOID
742 NtfsGetUserBuffer(PIRP Irp);
743
744 #if 0
745 BOOLEAN
746 wstrcmpjoki(PWSTR s1, PWSTR s2);
747
748 VOID
749 CdfsSwapString(PWCHAR Out,
750 PUCHAR In,
751 ULONG Count);
752 #endif
753
754 VOID
755 NtfsFileFlagsToAttributes(ULONG NtfsAttributes,
756 PULONG FileAttributes);
757
758
759 /* rw.c */
760
761 DRIVER_DISPATCH NtfsFsdRead;
762 NTSTATUS NTAPI
763 NtfsFsdRead(PDEVICE_OBJECT DeviceObject,
764 PIRP Irp);
765
766 DRIVER_DISPATCH NtfsFsdWrite;
767 NTSTATUS NTAPI
768 NtfsFsdWrite(PDEVICE_OBJECT DeviceObject,
769 PIRP Irp);
770
771
772 /* volinfo.c */
773
774 ULONGLONG
775 NtfsGetFreeClusters(PDEVICE_EXTENSION DeviceExt);
776
777 NTSTATUS
778 NtfsQueryVolumeInformation(PNTFS_IRP_CONTEXT IrpContext);
779
780 NTSTATUS
781 NtfsSetVolumeInformation(PNTFS_IRP_CONTEXT IrpContext);
782
783
784 /* ntfs.c */
785
786 DRIVER_INITIALIZE DriverEntry;
787
788 VOID
789 NTAPI
790 NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject);
791
792 #endif /* NTFS_H */