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