/
fileinfo.c
executable file
·1504 lines (1011 loc) · 33.5 KB
/
fileinfo.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*++
Copyright (c) 1989-2000 Microsoft Corporation
Module Name:
FileInfo.c
Abstract:
This module implements the File Information routines for Cdfs called by
the Fsd/Fsp dispatch drivers.
--*/
#include "cdprocs.h"
//
// The Bug check file id for this module
//
#define BugCheckFileId (CDFS_BUG_CHECK_FILEINFO)
//
// Local support routines
//
VOID
CdQueryBasicInfo (
IN PIRP_CONTEXT IrpContext,
IN PFCB Fcb,
IN OUT PFILE_BASIC_INFORMATION Buffer,
IN OUT PULONG Length
);
VOID
CdQueryStandardInfo (
IN PIRP_CONTEXT IrpContext,
IN PFCB Fcb,
IN OUT PFILE_STANDARD_INFORMATION Buffer,
IN OUT PULONG Length
);
VOID
CdQueryInternalInfo (
IN PIRP_CONTEXT IrpContext,
IN PFCB Fcb,
IN OUT PFILE_INTERNAL_INFORMATION Buffer,
IN OUT PULONG Length
);
VOID
CdQueryEaInfo (
IN PIRP_CONTEXT IrpContext,
IN PFCB Fcb,
IN OUT PFILE_EA_INFORMATION Buffer,
IN OUT PULONG Length
);
VOID
CdQueryPositionInfo (
IN PIRP_CONTEXT IrpContext,
IN PFILE_OBJECT FileObject,
IN OUT PFILE_POSITION_INFORMATION Buffer,
IN OUT PULONG Length
);
NTSTATUS
CdQueryNameInfo (
IN PIRP_CONTEXT IrpContext,
IN PFILE_OBJECT FileObject,
IN OUT PFILE_NAME_INFORMATION Buffer,
IN OUT PULONG Length
);
NTSTATUS
CdQueryAlternateNameInfo (
IN PIRP_CONTEXT IrpContext,
IN PFCB Fcb,
IN PCCB Ccb,
IN OUT PFILE_NAME_INFORMATION Buffer,
IN OUT PULONG Length
);
VOID
CdQueryNetworkInfo (
IN PIRP_CONTEXT IrpContext,
IN PFCB Fcb,
IN OUT PFILE_NETWORK_OPEN_INFORMATION Buffer,
IN OUT PULONG Length
);
#ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE, CdCommonQueryInfo)
#pragma alloc_text(PAGE, CdCommonSetInfo)
#pragma alloc_text(PAGE, CdFastQueryBasicInfo)
#pragma alloc_text(PAGE, CdFastQueryStdInfo)
#pragma alloc_text(PAGE, CdFastQueryNetworkInfo)
#pragma alloc_text(PAGE, CdQueryAlternateNameInfo)
#pragma alloc_text(PAGE, CdQueryBasicInfo)
#pragma alloc_text(PAGE, CdQueryEaInfo)
#pragma alloc_text(PAGE, CdQueryInternalInfo)
#pragma alloc_text(PAGE, CdQueryNameInfo)
#pragma alloc_text(PAGE, CdQueryNetworkInfo)
#pragma alloc_text(PAGE, CdQueryPositionInfo)
#pragma alloc_text(PAGE, CdQueryStandardInfo)
#endif
NTSTATUS
CdCommonQueryInfo (
IN PIRP_CONTEXT IrpContext,
IN PIRP Irp
)
/*++
Routine Description:
This is the common routine for query file information called by both the
fsd and fsp threads.
Arguments:
Irp - Supplies the Irp to process.
Return Value:
NTSTATUS - The return status for this operation.
--*/
{
NTSTATUS Status = STATUS_SUCCESS;
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
ULONG Length;
FILE_INFORMATION_CLASS FileInformationClass;
PFILE_ALL_INFORMATION Buffer;
TYPE_OF_OPEN TypeOfOpen;
PFCB Fcb;
PCCB Ccb;
BOOLEAN ReleaseFcb = FALSE;
PAGED_CODE();
//
// Reference our input parameters to make things easier
//
Length = IrpSp->Parameters.QueryFile.Length;
FileInformationClass = IrpSp->Parameters.QueryFile.FileInformationClass;
Buffer = Irp->AssociatedIrp.SystemBuffer;
//
// Decode the file object
//
TypeOfOpen = CdDecodeFileObject( IrpContext, IrpSp->FileObject, &Fcb, &Ccb );
//
// Use a try-finally to facilitate cleanup.
//
try {
//
// We only support query on file and directory handles.
//
switch (TypeOfOpen) {
case UserDirectoryOpen :
case UserFileOpen :
//
// Acquire shared access to this file. NOTE that this could be
// a recursive acquire, if we already preacquired in
// CdAcquireForCreateSection().
//
CdAcquireFileShared( IrpContext, Fcb );
ReleaseFcb = TRUE;
//
// Make sure we have the correct sizes for a directory.
//
if (!FlagOn( Fcb->FcbState, FCB_STATE_INITIALIZED )) {
ASSERT( TypeOfOpen == UserDirectoryOpen );
CdCreateInternalStream( IrpContext, Fcb->Vcb, Fcb );
}
//
// Make sure the Fcb is in a usable condition. This will raise
// an error condition if the volume is unusable
//
CdVerifyFcbOperation( IrpContext, Fcb );
//
// Based on the information class we'll do different
// actions. Each of hte procedures that we're calling fills
// up the output buffer, if possible. They will raise the
// status STATUS_BUFFER_OVERFLOW for an insufficient buffer.
// This is considered a somewhat unusual case and is handled
// more cleanly with the exception mechanism rather than
// testing a return status value for each call.
//
switch (FileInformationClass) {
case FileAllInformation:
//
// We don't allow this operation on a file opened by file Id.
//
if (FlagOn( Ccb->Flags, CCB_FLAG_OPEN_BY_ID )) {
Status = STATUS_INVALID_PARAMETER;
break;
}
//
// In this case go ahead and call the individual routines to
// fill in the buffer. Only the name routine will
// pointer to the output buffer and then call the
// individual routines to fill in the buffer.
//
Length -= (sizeof( FILE_ACCESS_INFORMATION ) +
sizeof( FILE_MODE_INFORMATION ) +
sizeof( FILE_ALIGNMENT_INFORMATION ));
CdQueryBasicInfo( IrpContext, Fcb, &Buffer->BasicInformation, &Length );
CdQueryStandardInfo( IrpContext, Fcb, &Buffer->StandardInformation, &Length );
CdQueryInternalInfo( IrpContext, Fcb, &Buffer->InternalInformation, &Length );
CdQueryEaInfo( IrpContext, Fcb, &Buffer->EaInformation, &Length );
CdQueryPositionInfo( IrpContext, IrpSp->FileObject, &Buffer->PositionInformation, &Length );
Status = CdQueryNameInfo( IrpContext, IrpSp->FileObject, &Buffer->NameInformation, &Length );
break;
case FileBasicInformation:
CdQueryBasicInfo( IrpContext, Fcb, (PFILE_BASIC_INFORMATION) Buffer, &Length );
break;
case FileStandardInformation:
CdQueryStandardInfo( IrpContext, Fcb, (PFILE_STANDARD_INFORMATION) Buffer, &Length );
break;
case FileInternalInformation:
CdQueryInternalInfo( IrpContext, Fcb, (PFILE_INTERNAL_INFORMATION) Buffer, &Length );
break;
case FileEaInformation:
CdQueryEaInfo( IrpContext, Fcb, (PFILE_EA_INFORMATION) Buffer, &Length );
break;
case FilePositionInformation:
CdQueryPositionInfo( IrpContext, IrpSp->FileObject, (PFILE_POSITION_INFORMATION) Buffer, &Length );
break;
case FileNameInformation:
//
// We don't allow this operation on a file opened by file Id.
//
if (!FlagOn( Ccb->Flags, CCB_FLAG_OPEN_BY_ID )) {
Status = CdQueryNameInfo( IrpContext, IrpSp->FileObject, (PFILE_NAME_INFORMATION) Buffer, &Length );
} else {
Status = STATUS_INVALID_PARAMETER;
}
break;
case FileAlternateNameInformation:
if (!FlagOn( Ccb->Flags, CCB_FLAG_OPEN_BY_ID )) {
Status = CdQueryAlternateNameInfo( IrpContext, Fcb, Ccb, (PFILE_NAME_INFORMATION) Buffer, &Length );
} else {
Status = STATUS_INVALID_PARAMETER;
}
break;
case FileNetworkOpenInformation:
CdQueryNetworkInfo( IrpContext, Fcb, (PFILE_NETWORK_OPEN_INFORMATION) Buffer, &Length );
break;
default :
Status = STATUS_INVALID_PARAMETER;
}
break;
default :
Status = STATUS_INVALID_PARAMETER;
}
//
// Set the information field to the number of bytes actually filled in
// and then complete the request
//
Irp->IoStatus.Information = IrpSp->Parameters.QueryFile.Length - Length;
} finally {
//
// Release the file.
//
if (ReleaseFcb) {
CdReleaseFile( IrpContext, Fcb );
}
}
//
// Complete the request if we didn't raise.
//
CdCompleteRequest( IrpContext, Irp, Status );
return Status;
}
NTSTATUS
CdCommonSetInfo (
IN PIRP_CONTEXT IrpContext,
IN PIRP Irp
)
/*++
Routine Description:
This is the common routine for set file information called by both the
fsd and fsp threads. We only support operations which set the file position.
Arguments:
Irp - Supplies the Irp to process.
Return Value:
NTSTATUS - The return status for this operation.
--*/
{
NTSTATUS Status = STATUS_INVALID_PARAMETER;
TYPE_OF_OPEN TypeOfOpen;
PFCB Fcb;
PCCB Ccb;
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
PFILE_POSITION_INFORMATION Buffer;
PAGED_CODE();
//
// Decode the file object
//
TypeOfOpen = CdDecodeFileObject( IrpContext, IrpSp->FileObject, &Fcb, &Ccb );
//
// We only support a SetPositionInformation on a user file.
//
if ((TypeOfOpen != UserFileOpen) ||
(IrpSp->Parameters.QueryFile.FileInformationClass != FilePositionInformation)) {
CdCompleteRequest( IrpContext, Irp, Status );
return Status;
}
//
// Acquire shared access to this file.
//
CdAcquireFileShared( IrpContext, Fcb );
try {
//
// Make sure the Fcb is in a usable condition. This
// will raise an error condition if the fcb is unusable
//
CdVerifyFcbOperation( IrpContext, Fcb );
Buffer = Irp->AssociatedIrp.SystemBuffer;
//
// Check if the file does not use intermediate buffering. If it
// does not use intermediate buffering then the new position we're
// supplied must be aligned properly for the device
//
if (FlagOn( IrpSp->FileObject->Flags, FO_NO_INTERMEDIATE_BUFFERING ) &&
((Buffer->CurrentByteOffset.LowPart & Fcb->Vcb->BlockMask) != 0)) {
try_return( NOTHING );
}
//
// The input parameter is fine so set the current byte offset and
// complete the request
//
//
// Lock the Fcb to provide synchronization.
//
CdLockFcb( IrpContext, Fcb );
IrpSp->FileObject->CurrentByteOffset = Buffer->CurrentByteOffset;
CdUnlockFcb( IrpContext, Fcb );
Status = STATUS_SUCCESS;
try_exit: NOTHING;
} finally {
CdReleaseFile( IrpContext, Fcb );
}
//
// Complete the request if there was no raise.
//
CdCompleteRequest( IrpContext, Irp, Status );
return Status;
}
BOOLEAN
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
CdFastQueryBasicInfo (
IN PFILE_OBJECT FileObject,
IN BOOLEAN Wait,
IN OUT PFILE_BASIC_INFORMATION Buffer,
OUT PIO_STATUS_BLOCK IoStatus,
IN PDEVICE_OBJECT DeviceObject
)
/*++
Routine Description:
This routine is for the fast query call for basic file information.
Arguments:
FileObject - Supplies the file object used in this operation
Wait - Indicates if we are allowed to wait for the information
Buffer - Supplies the output buffer to receive the basic information
IoStatus - Receives the final status of the operation
Return Value:
BOOLEAN - TRUE if the operation succeeded and FALSE if the caller
needs to take the long route.
--*/
{
BOOLEAN Result = FALSE;
TYPE_OF_OPEN TypeOfOpen;
PFCB Fcb;
PAGED_CODE();
ASSERT_FILE_OBJECT( FileObject );
FsRtlEnterFileSystem();
//
// Decode the file object to find the type of open and the data
// structures.
//
TypeOfOpen = CdFastDecodeFileObject( FileObject, &Fcb );
//
// We only support this request on user file or directory objects.
//
if ((TypeOfOpen != UserFileOpen) &&
((TypeOfOpen != UserDirectoryOpen) || !FlagOn( Fcb->FcbState, FCB_STATE_INITIALIZED))) {
FsRtlExitFileSystem();
return FALSE;
}
//
// Acquire the file shared to access the Fcb.
//
if (!ExAcquireResourceSharedLite( Fcb->Resource, Wait )) {
FsRtlExitFileSystem();
return FALSE;
}
//
// Use a try-finally to facilitate cleanup.
//
try {
//
// Only deal with 'good' Fcb's.
//
if (CdVerifyFcbOperation( NULL, Fcb )) {
//
// Fill in the input buffer from the Fcb fields.
//
Buffer->CreationTime.QuadPart =
Buffer->LastWriteTime.QuadPart =
Buffer->ChangeTime.QuadPart = Fcb->CreationTime;
Buffer->LastAccessTime.QuadPart = 0;
Buffer->FileAttributes = Fcb->FileAttributes;
//
// Update the IoStatus block with the size of this data.
//
IoStatus->Status = STATUS_SUCCESS;
IoStatus->Information = sizeof( FILE_BASIC_INFORMATION );
Result = TRUE;
}
} finally {
ExReleaseResourceLite( Fcb->Resource );
FsRtlExitFileSystem();
}
return Result;
}
BOOLEAN
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
CdFastQueryStdInfo (
IN PFILE_OBJECT FileObject,
IN BOOLEAN Wait,
IN OUT PFILE_STANDARD_INFORMATION Buffer,
OUT PIO_STATUS_BLOCK IoStatus,
IN PDEVICE_OBJECT DeviceObject
)
/*++
Routine Description:
This routine is for the fast query call for standard file information.
Arguments:
FileObject - Supplies the file object used in this operation
Wait - Indicates if we are allowed to wait for the information
Buffer - Supplies the output buffer to receive the basic information
IoStatus - Receives the final status of the operation
Return Value:
BOOLEAN - TRUE if the operation succeeded and FALSE if the caller
needs to take the long route.
--*/
{
BOOLEAN Result = FALSE;
TYPE_OF_OPEN TypeOfOpen;
PFCB Fcb;
PAGED_CODE();
ASSERT_FILE_OBJECT( FileObject );
FsRtlEnterFileSystem();
//
// Decode the file object to find the type of open and the data
// structures.
//
TypeOfOpen = CdFastDecodeFileObject( FileObject, &Fcb );
//
// We only support this request on initialized user file or directory objects.
//
if ((TypeOfOpen != UserFileOpen) &&
((TypeOfOpen != UserDirectoryOpen) || !FlagOn( Fcb->FcbState, FCB_STATE_INITIALIZED ))) {
FsRtlExitFileSystem();
return FALSE;
}
//
// Acquire the file shared to access the Fcb.
//
if (!ExAcquireResourceSharedLite( Fcb->Resource, Wait )) {
FsRtlExitFileSystem();
return FALSE;
}
//
// Use a try-finally to facilitate cleanup.
//
try {
//
// Only deal with 'good' Fcb's.
//
if (CdVerifyFcbOperation( NULL, Fcb )) {
//
// Check whether this is a directory.
//
if (FlagOn( Fcb->FileAttributes, FILE_ATTRIBUTE_DIRECTORY )) {
Buffer->AllocationSize.QuadPart =
Buffer->EndOfFile.QuadPart = 0;
Buffer->Directory = TRUE;
} else {
Buffer->AllocationSize.QuadPart = Fcb->AllocationSize.QuadPart;
Buffer->EndOfFile.QuadPart = Fcb->FileSize.QuadPart;
Buffer->Directory = FALSE;
}
Buffer->NumberOfLinks = 1;
Buffer->DeletePending = FALSE;
//
// Update the IoStatus block with the size of this data.
//
IoStatus->Status = STATUS_SUCCESS;
IoStatus->Information = sizeof( FILE_STANDARD_INFORMATION );
Result = TRUE;
}
} finally {
ExReleaseResourceLite( Fcb->Resource );
FsRtlExitFileSystem();
}
return Result;
}
BOOLEAN
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
CdFastQueryNetworkInfo (
IN PFILE_OBJECT FileObject,
IN BOOLEAN Wait,
OUT PFILE_NETWORK_OPEN_INFORMATION Buffer,
OUT PIO_STATUS_BLOCK IoStatus,
IN PDEVICE_OBJECT DeviceObject
)
/*++
Routine Description:
This routine is for the fast query call for network file information.
Arguments:
FileObject - Supplies the file object used in this operation
Wait - Indicates if we are allowed to wait for the information
Buffer - Supplies the output buffer to receive the basic information
IoStatus - Receives the final status of the operation
Return Value:
BOOLEAN - TRUE if the operation succeeded and FALSE if the caller
needs to take the long route.
--*/
{
BOOLEAN Result = FALSE;
TYPE_OF_OPEN TypeOfOpen;
PFCB Fcb;
PAGED_CODE();
ASSERT_FILE_OBJECT( FileObject );
FsRtlEnterFileSystem();
//
// Decode the file object to find the type of open and the data
// structures.
//
TypeOfOpen = CdFastDecodeFileObject( FileObject, &Fcb );
//
// We only support this request on user file or directory objects.
//
if ((TypeOfOpen != UserFileOpen) &&
((TypeOfOpen != UserDirectoryOpen) || !FlagOn( Fcb->FcbState, FCB_STATE_INITIALIZED))) {
FsRtlExitFileSystem();
return FALSE;
}
//
// Acquire the file shared to access the Fcb.
//
if (!ExAcquireResourceSharedLite( Fcb->Resource, Wait )) {
FsRtlExitFileSystem();
return FALSE;
}
//
// Use a try-finally to facilitate cleanup.
//
try {
//
// Only deal with 'good' Fcb's.
//
if (CdVerifyFcbOperation( NULL, Fcb )) {
//
// Fill in the input buffer from the Fcb fields.
//
Buffer->CreationTime.QuadPart =
Buffer->LastWriteTime.QuadPart =
Buffer->ChangeTime.QuadPart = Fcb->CreationTime;
Buffer->LastAccessTime.QuadPart = 0;
Buffer->FileAttributes = Fcb->FileAttributes;
//
// Check whether this is a directory.
//
if (FlagOn( Fcb->FileAttributes, FILE_ATTRIBUTE_DIRECTORY )) {
Buffer->AllocationSize.QuadPart =
Buffer->EndOfFile.QuadPart = 0;
} else {
Buffer->AllocationSize.QuadPart = Fcb->AllocationSize.QuadPart;
Buffer->EndOfFile.QuadPart = Fcb->FileSize.QuadPart;
}
//
// Update the IoStatus block with the size of this data.
//
IoStatus->Status = STATUS_SUCCESS;
IoStatus->Information = sizeof( FILE_NETWORK_OPEN_INFORMATION );
Result = TRUE;
}
} finally {
ExReleaseResourceLite( Fcb->Resource );
FsRtlExitFileSystem();
}
return Result;
}
//
// Local support routine
//
VOID
CdQueryBasicInfo (
IN PIRP_CONTEXT IrpContext,
IN PFCB Fcb,
IN OUT PFILE_BASIC_INFORMATION Buffer,
IN OUT PULONG Length
)
/*++
Description:
This routine performs the query basic information function for Cdfs
Arguments:
Fcb - Supplies the Fcb being queried, it has been verified
Buffer - Supplies a pointer to the buffer where the information is to
be returned
Length - Supplies the length of the buffer in bytes, and receives the
remaining bytes free in the buffer upon return.
Return Value:
None
--*/
{
PAGED_CODE();
//
// We only support creation, last modify and last write times on Cdfs.
//
Buffer->LastWriteTime.QuadPart =
Buffer->CreationTime.QuadPart =
Buffer->ChangeTime.QuadPart = Fcb->CreationTime;
Buffer->LastAccessTime.QuadPart = 0;
Buffer->FileAttributes = Fcb->FileAttributes;
//
// Update the length and status output variables
//
*Length -= sizeof( FILE_BASIC_INFORMATION );
return;
}
//
// Local support routine
//
VOID
CdQueryStandardInfo (
IN PIRP_CONTEXT IrpContext,
IN PFCB Fcb,
IN OUT PFILE_STANDARD_INFORMATION Buffer,
IN OUT PULONG Length
)
/*++
Routine Description:
This routine performs the query standard information function for cdfs.
Arguments:
Fcb - Supplies the Fcb being queried, it has been verified
Buffer - Supplies a pointer to the buffer where the information is to
be returned
Length - Supplies the length of the buffer in bytes, and receives the
remaining bytes free in the buffer upon return.
Return Value:
None
--*/
{
PAGED_CODE();
//
// There is only one link and delete is never pending on a Cdrom file.
//
Buffer->NumberOfLinks = 1;
Buffer->DeletePending = FALSE;
//
// We get the sizes from the header. Return a size of zero
// for all directories.
//
if (FlagOn( Fcb->FileAttributes, FILE_ATTRIBUTE_DIRECTORY )) {
Buffer->AllocationSize.QuadPart =
Buffer->EndOfFile.QuadPart = 0;
Buffer->Directory = TRUE;
} else {
Buffer->AllocationSize.QuadPart = Fcb->AllocationSize.QuadPart;
Buffer->EndOfFile.QuadPart = Fcb->FileSize.QuadPart;
Buffer->Directory = FALSE;
}
//
// Update the length and status output variables
//
*Length -= sizeof( FILE_STANDARD_INFORMATION );
return;
}
//
// Local support routine
//
VOID
CdQueryInternalInfo (
IN PIRP_CONTEXT IrpContext,
IN PFCB Fcb,
IN OUT PFILE_INTERNAL_INFORMATION Buffer,
IN OUT PULONG Length
)
/*++
Routine Description:
This routine performs the query internal information function for cdfs.
Arguments:
Fcb - Supplies the Fcb being queried, it has been verified
Buffer - Supplies a pointer to the buffer where the information is to
be returned
Length - Supplies the length of the buffer in bytes, and receives the
remaining bytes free in the buffer upon return.