54480e61052d2f2fc3088fa6892347fba7f10c06
[reactos.git] / reactos / drivers / filesystems / fastfat_new / finfo.c
1 /*
2 * PROJECT: ReactOS FAT file system driver
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/filesystems/fastfat/finfo.c
5 * PURPOSE: File Information support routines
6 * PROGRAMMERS: Aleksey Bragin (aleksey@reactos.org)
7 */
8
9 /* INCLUDES *****************************************************************/
10
11 #define NDEBUG
12 #include "fastfat.h"
13
14 /* FUNCTIONS ****************************************************************/
15
16 NTSTATUS
17 NTAPI
18 FatiQueryInformation(IN PFAT_IRP_CONTEXT IrpContext,
19 IN PIRP Irp)
20 {
21 PFILE_OBJECT FileObject;
22 PIO_STACK_LOCATION IrpSp;
23 FILE_INFORMATION_CLASS InfoClass;
24 TYPE_OF_OPEN FileType;
25 PVCB Vcb;
26 PFCB Fcb;
27 PCCB Ccb;
28
29 /* Get IRP stack location */
30 IrpSp = IoGetCurrentIrpStackLocation(Irp);
31
32 /* Get the file object */
33 FileObject = IrpSp->FileObject;
34
35 InfoClass = IrpSp->Parameters.QueryFile.FileInformationClass;
36
37 DPRINT1("FatCommonQueryInformation\n", 0);
38 DPRINT1("\tIrp = %08lx\n", Irp);
39 DPRINT1("\tLength = %08lx\n", IrpSp->Parameters.QueryFile.Length);
40 DPRINT1("\tFileInformationClass = %08lx\n", InfoClass);
41 DPRINT1("\tBuffer = %08lx\n", Irp->AssociatedIrp.SystemBuffer);
42
43 FileType = FatDecodeFileObject(FileObject, &Vcb, &Fcb, &Ccb);
44
45 DPRINT1("Vcb %p, Fcb %p, Ccb %p, open type %d\n", Vcb, Fcb, Ccb, FileType);
46
47 return STATUS_SUCCESS;
48 }
49
50 NTSTATUS
51 NTAPI
52 FatQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
53 {
54 NTSTATUS Status;
55 BOOLEAN TopLevel, CanWait;
56 PFAT_IRP_CONTEXT IrpContext;
57
58 CanWait = TRUE;
59 TopLevel = FALSE;
60 Status = STATUS_INVALID_DEVICE_REQUEST;
61
62 /* Get CanWait flag */
63 if (IoGetCurrentIrpStackLocation(Irp)->FileObject != NULL)
64 CanWait = IoIsOperationSynchronous(Irp);
65
66 /* Enter FsRtl critical region */
67 FsRtlEnterFileSystem();
68
69 /* Set Top Level IRP if not set */
70 if (IoGetTopLevelIrp() == NULL)
71 {
72 IoSetTopLevelIrp(Irp);
73 TopLevel = TRUE;
74 }
75
76 /* Build an irp context */
77 IrpContext = FatBuildIrpContext(Irp, CanWait);
78
79 /* Perform the actual read */
80 Status = FatiQueryInformation(IrpContext, Irp);
81
82 /* Restore top level Irp */
83 if (TopLevel) IoSetTopLevelIrp(NULL);
84
85 /* Leave FsRtl critical region */
86 FsRtlExitFileSystem();
87
88 return Status;
89 }
90
91 NTSTATUS
92 NTAPI
93 FatSetInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp)
94 {
95 DPRINT1("FatSetInformation()\n");
96 return STATUS_NOT_IMPLEMENTED;
97 }
98
99 /* EOF */