ReactOS  0.4.15-dev-1039-gb9754fa
fileinfo.c File Reference
#include "cdprocs.h"
Include dependency graph for fileinfo.c:

Go to the source code of this file.

Macros

#define BugCheckFileId   (CDFS_BUG_CHECK_FILEINFO)
 

Functions

VOID CdQueryBasicInfo (_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Out_ PFILE_BASIC_INFORMATION Buffer, _Inout_ PULONG Length)
 
VOID CdQueryStandardInfo (_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Out_ PFILE_STANDARD_INFORMATION Buffer, _Inout_ PULONG Length)
 
VOID CdQueryInternalInfo (_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Out_ PFILE_INTERNAL_INFORMATION Buffer, _Inout_ PULONG Length)
 
VOID CdQueryEaInfo (_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Out_ PFILE_EA_INFORMATION Buffer, _Inout_ PULONG Length)
 
VOID CdQueryPositionInfo (_In_ PIRP_CONTEXT IrpContext, _In_ PFILE_OBJECT FileObject, _Out_ PFILE_POSITION_INFORMATION Buffer, _Inout_ PULONG Length)
 
NTSTATUS CdQueryNameInfo (_In_ PIRP_CONTEXT IrpContext, _In_ PFILE_OBJECT FileObject, _Out_ PFILE_NAME_INFORMATION Buffer, _Inout_ PULONG Length)
 
 _Requires_lock_held_ (_Global_critical_region_)
 
 _Function_class_ (FAST_IO_QUERY_BASIC_INFO)
 
 _Function_class_ (FAST_IO_QUERY_STANDARD_INFO)
 
 _Function_class_ (FAST_IO_QUERY_NETWORK_OPEN_INFO)
 
VOID CdQueryNetworkInfo (_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Out_ PFILE_NETWORK_OPEN_INFORMATION Buffer, _Inout_ PULONG Length)
 

Macro Definition Documentation

◆ BugCheckFileId

#define BugCheckFileId   (CDFS_BUG_CHECK_FILEINFO)

Definition at line 23 of file fileinfo.c.

Function Documentation

◆ _Function_class_() [1/3]

_Function_class_ ( FAST_IO_QUERY_BASIC_INFO  )

Definition at line 465 of file fileinfo.c.

501 {
502  BOOLEAN Result = FALSE;
504 
505  PFCB Fcb;
506 
507  PAGED_CODE();
508 
510 
512 
514 
515  //
516  // Decode the file object to find the type of open and the data
517  // structures.
518  //
519 
521 
522  //
523  // We only support this request on user file or directory objects.
524  //
525 
526  if ((TypeOfOpen != UserFileOpen) &&
528 
530  return FALSE;
531  }
532 
533  //
534  // Acquire the file shared to access the Fcb.
535  //
536 
537  if (!ExAcquireResourceSharedLite( Fcb->Resource, Wait )) {
538 
540  return FALSE;
541  }
542 
543  //
544  // Use a try-finally to facilitate cleanup.
545  //
546 
547  _SEH2_TRY {
548 
549  //
550  // Only deal with 'good' Fcb's.
551  //
552 
553  if (CdVerifyFcbOperation( NULL, Fcb )) {
554 
555  //
556  // Fill in the input buffer from the Fcb fields.
557  //
558 
559  Buffer->CreationTime.QuadPart =
560  Buffer->LastWriteTime.QuadPart =
561  Buffer->ChangeTime.QuadPart = Fcb->CreationTime;
562 
563  Buffer->LastAccessTime.QuadPart = 0;
564 
565  Buffer->FileAttributes = Fcb->FileAttributes;
566 
567  //
568  // Update the IoStatus block with the size of this data.
569  //
570 
571  IoStatus->Status = STATUS_SUCCESS;
572  IoStatus->Information = sizeof( FILE_BASIC_INFORMATION );
573 
574  Result = TRUE;
575  }
576 
577  } _SEH2_FINALLY {
578 
579  ExReleaseResourceLite( Fcb->Resource );
580 
582  } _SEH2_END;
583 
584  return Result;
585 }
LONGLONG CreationTime
Definition: cdstruc.h:1036
#define FCB_STATE_INITIALIZED
Definition: cdstruc.h:1048
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2659
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
Definition: cdstruc.h:908
ULONG FileAttributes
Definition: cdstruc.h:983
#define ASSERT_FILE_OBJECT(FO)
Definition: cddata.h:253
_SEH2_TRY
Definition: create.c:4226
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN TypeOfOpen
Definition: cdprocs.h:588
TYPE_OF_OPEN CdFastDecodeFileObject(_In_ PFILE_OBJECT FileObject, _Out_ PFCB *Fcb)
Definition: filobsup.c:206
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
enum _TYPE_OF_OPEN TYPE_OF_OPEN
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
_SEH2_END
Definition: create.c:4400
_SEH2_FINALLY
Definition: create.c:4371
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
BOOLEAN CdVerifyFcbOperation(_In_opt_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb)
Definition: verfysup.c:615
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
_In_ PFCB Fcb
Definition: cdprocs.h:159
return STATUS_SUCCESS
Definition: btrfs.c:3014
ULONG FcbState
Definition: cdstruc.h:977
#define PAGED_CODE()
IN BOOLEAN Wait
Definition: fatprocs.h:1538
#define FILE_BASIC_INFORMATION
Definition: disk.h:53

◆ _Function_class_() [2/3]

_Function_class_ ( FAST_IO_QUERY_STANDARD_INFO  )

Definition at line 588 of file fileinfo.c.

624 {
625  BOOLEAN Result = FALSE;
627 
628  PFCB Fcb;
629 
630  PAGED_CODE();
631 
633 
635 
637 
638  //
639  // Decode the file object to find the type of open and the data
640  // structures.
641  //
642 
644 
645  //
646  // We only support this request on initialized user file or directory objects.
647  //
648 
649  if ((TypeOfOpen != UserFileOpen) &&
651 
653  return FALSE;
654  }
655 
656  //
657  // Acquire the file shared to access the Fcb.
658  //
659 
660  if (!ExAcquireResourceSharedLite( Fcb->Resource, Wait )) {
661 
663  return FALSE;
664  }
665 
666  //
667  // Use a try-finally to facilitate cleanup.
668  //
669 
670  _SEH2_TRY {
671 
672  //
673  // Only deal with 'good' Fcb's.
674  //
675 
676  if (CdVerifyFcbOperation( NULL, Fcb )) {
677 
678  //
679  // Check whether this is a directory.
680  //
681 
683 
684  Buffer->AllocationSize.QuadPart =
685  Buffer->EndOfFile.QuadPart = 0;
686 
687  Buffer->Directory = TRUE;
688 
689  } else {
690 
691  Buffer->AllocationSize.QuadPart = Fcb->AllocationSize.QuadPart;
692  Buffer->EndOfFile.QuadPart = Fcb->FileSize.QuadPart;
693 
694  Buffer->Directory = FALSE;
695  }
696 
697  Buffer->NumberOfLinks = 1;
698  Buffer->DeletePending = FALSE;
699 
700  //
701  // Update the IoStatus block with the size of this data.
702  //
703 
704  IoStatus->Status = STATUS_SUCCESS;
705  IoStatus->Information = sizeof( FILE_STANDARD_INFORMATION );
706 
707  Result = TRUE;
708  }
709 
710  } _SEH2_FINALLY {
711 
712  ExReleaseResourceLite( Fcb->Resource );
713 
715  } _SEH2_END;
716 
717  return Result;
718 }
#define FCB_STATE_INITIALIZED
Definition: cdstruc.h:1048
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2659
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
Definition: cdstruc.h:908
ULONG FileAttributes
Definition: cdstruc.h:983
#define ASSERT_FILE_OBJECT(FO)
Definition: cddata.h:253
_SEH2_TRY
Definition: create.c:4226
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN TypeOfOpen
Definition: cdprocs.h:588
TYPE_OF_OPEN CdFastDecodeFileObject(_In_ PFILE_OBJECT FileObject, _Out_ PFCB *Fcb)
Definition: filobsup.c:206
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
#define FILE_STANDARD_INFORMATION
Definition: disk.h:54
enum _TYPE_OF_OPEN TYPE_OF_OPEN
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
_SEH2_END
Definition: create.c:4400
_SEH2_FINALLY
Definition: create.c:4371
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
BOOLEAN CdVerifyFcbOperation(_In_opt_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb)
Definition: verfysup.c:615
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
_In_ PFCB Fcb
Definition: cdprocs.h:159
return STATUS_SUCCESS
Definition: btrfs.c:3014
ULONG FcbState
Definition: cdstruc.h:977
#define PAGED_CODE()
IN BOOLEAN Wait
Definition: fatprocs.h:1538

◆ _Function_class_() [3/3]

_Function_class_ ( FAST_IO_QUERY_NETWORK_OPEN_INFO  )

Definition at line 721 of file fileinfo.c.

757 {
758  BOOLEAN Result = FALSE;
760 
761  PFCB Fcb;
762 
763  PAGED_CODE();
764 
766 
768 
770 
771  //
772  // Decode the file object to find the type of open and the data
773  // structures.
774  //
775 
777 
778  //
779  // We only support this request on user file or directory objects.
780  //
781 
782  if ((TypeOfOpen != UserFileOpen) &&
784 
786  return FALSE;
787  }
788 
789  //
790  // Acquire the file shared to access the Fcb.
791  //
792 
793  if (!ExAcquireResourceSharedLite( Fcb->Resource, Wait )) {
794 
796  return FALSE;
797  }
798 
799  //
800  // Use a try-finally to facilitate cleanup.
801  //
802 
803  _SEH2_TRY {
804 
805  //
806  // Only deal with 'good' Fcb's.
807  //
808 
809  if (CdVerifyFcbOperation( NULL, Fcb )) {
810 
811  //
812  // Fill in the input buffer from the Fcb fields.
813  //
814 
815  Buffer->CreationTime.QuadPart =
816  Buffer->LastWriteTime.QuadPart =
817  Buffer->ChangeTime.QuadPart = Fcb->CreationTime;
818 
819  Buffer->LastAccessTime.QuadPart = 0;
820 
821  Buffer->FileAttributes = Fcb->FileAttributes;
822 
823  //
824  // Check whether this is a directory.
825  //
826 
828 
829  Buffer->AllocationSize.QuadPart =
830  Buffer->EndOfFile.QuadPart = 0;
831 
832  } else {
833 
834  Buffer->AllocationSize.QuadPart = Fcb->AllocationSize.QuadPart;
835  Buffer->EndOfFile.QuadPart = Fcb->FileSize.QuadPart;
836  }
837 
838  //
839  // Update the IoStatus block with the size of this data.
840  //
841 
842  IoStatus->Status = STATUS_SUCCESS;
843  IoStatus->Information = sizeof( FILE_NETWORK_OPEN_INFORMATION );
844 
845  Result = TRUE;
846  }
847 
848  } _SEH2_FINALLY {
849 
850  ExReleaseResourceLite( Fcb->Resource );
851 
853  } _SEH2_END;
854 
855  return Result;
856 }
LONGLONG CreationTime
Definition: cdstruc.h:1036
#define FCB_STATE_INITIALIZED
Definition: cdstruc.h:1048
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2659
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
Definition: cdstruc.h:908
ULONG FileAttributes
Definition: cdstruc.h:983
#define ASSERT_FILE_OBJECT(FO)
Definition: cddata.h:253
struct _FILE_NETWORK_OPEN_INFORMATION FILE_NETWORK_OPEN_INFORMATION
_SEH2_TRY
Definition: create.c:4226
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN TypeOfOpen
Definition: cdprocs.h:588
TYPE_OF_OPEN CdFastDecodeFileObject(_In_ PFILE_OBJECT FileObject, _Out_ PFCB *Fcb)
Definition: filobsup.c:206
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
enum _TYPE_OF_OPEN TYPE_OF_OPEN
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
_SEH2_END
Definition: create.c:4400
_SEH2_FINALLY
Definition: create.c:4371
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
BOOLEAN CdVerifyFcbOperation(_In_opt_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb)
Definition: verfysup.c:615
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
_In_ PFCB Fcb
Definition: cdprocs.h:159
return STATUS_SUCCESS
Definition: btrfs.c:3014
ULONG FcbState
Definition: cdstruc.h:977
#define PAGED_CODE()
IN BOOLEAN Wait
Definition: fatprocs.h:1538

◆ _Requires_lock_held_()

_Requires_lock_held_ ( _Global_critical_region_  )

Definition at line 77 of file fileinfo.c.

136 {
139 
140  ULONG Length;
143 
145  PFCB Fcb;
146  PCCB Ccb;
147 
148  BOOLEAN ReleaseFcb = FALSE;
149 
150  PAGED_CODE();
151 
152  //
153  // Reference our input parameters to make things easier
154  //
155 
156  Length = IrpSp->Parameters.QueryFile.Length;
157  FileInformationClass = IrpSp->Parameters.QueryFile.FileInformationClass;
158  Buffer = Irp->AssociatedIrp.SystemBuffer;
159 
160  //
161  // Decode the file object
162  //
163 
164  TypeOfOpen = CdDecodeFileObject( IrpContext, IrpSp->FileObject, &Fcb, &Ccb );
165 
166  //
167  // Use a try-finally to facilitate cleanup.
168  //
169 
170  _SEH2_TRY {
171 
172  //
173  // We only support query on file and directory handles.
174  //
175 
176  switch (TypeOfOpen) {
177 
178  case UserDirectoryOpen :
179  case UserFileOpen :
180 
181  //
182  // Acquire shared access to this file. NOTE that this could be
183  // a recursive acquire, if we already preacquired in
184  // CdAcquireForCreateSection().
185  //
186 
187  CdAcquireFileShared( IrpContext, Fcb );
188  ReleaseFcb = TRUE;
189 
190  //
191  // Make sure we have the correct sizes for a directory.
192  //
193 
195 
197  CdVerifyOrCreateDirStreamFile( IrpContext, Fcb);
198  }
199 
200  //
201  // Make sure the Fcb is in a usable condition. This will raise
202  // an error condition if the volume is unusable
203  //
204 
205  CdVerifyFcbOperation( IrpContext, Fcb );
206 
207  //
208  // Based on the information class we'll do different
209  // actions. Each of hte procedures that we're calling fills
210  // up the output buffer, if possible. They will raise the
211  // status STATUS_BUFFER_OVERFLOW for an insufficient buffer.
212  // This is considered a somewhat unusual case and is handled
213  // more cleanly with the exception mechanism rather than
214  // testing a return status value for each call.
215  //
216 
217  switch (FileInformationClass) {
218 
219  case FileAllInformation:
220 
221  //
222  // We don't allow this operation on a file opened by file Id.
223  //
224 
225  if (FlagOn( Ccb->Flags, CCB_FLAG_OPEN_BY_ID )) {
226 
228  break;
229  }
230 
231  //
232  // In this case go ahead and call the individual routines to
233  // fill in the buffer. Only the name routine will
234  // pointer to the output buffer and then call the
235  // individual routines to fill in the buffer.
236  //
237 
238  Length -= (sizeof( FILE_ACCESS_INFORMATION ) +
239  sizeof( FILE_MODE_INFORMATION ) +
240  sizeof( FILE_ALIGNMENT_INFORMATION ));
241 
242  CdQueryBasicInfo( IrpContext, Fcb, &Buffer->BasicInformation, &Length );
243  CdQueryStandardInfo( IrpContext, Fcb, &Buffer->StandardInformation, &Length );
244  CdQueryInternalInfo( IrpContext, Fcb, &Buffer->InternalInformation, &Length );
245  CdQueryEaInfo( IrpContext, Fcb, &Buffer->EaInformation, &Length );
246  CdQueryPositionInfo( IrpContext, IrpSp->FileObject, &Buffer->PositionInformation, &Length );
247  Status = CdQueryNameInfo( IrpContext, IrpSp->FileObject, &Buffer->NameInformation, &Length );
248 
249  break;
250 
252 
254  break;
255 
257 
259  break;
260 
262 
264  break;
265 
266  case FileEaInformation:
267 
268  CdQueryEaInfo( IrpContext, Fcb, (PFILE_EA_INFORMATION) Buffer, &Length );
269  break;
270 
272 
274  break;
275 
276  case FileNameInformation:
277 
278  //
279  // We don't allow this operation on a file opened by file Id.
280  //
281 
282  if (!FlagOn( Ccb->Flags, CCB_FLAG_OPEN_BY_ID )) {
283 
285 
286  } else {
287 
289  }
290 
291  break;
292 
294 
295  if (!FlagOn( Ccb->Flags, CCB_FLAG_OPEN_BY_ID )) {
296 
297  Status = CdQueryAlternateNameInfo( IrpContext, Fcb, Ccb, (PFILE_NAME_INFORMATION) Buffer, &Length );
298 
299  } else {
300 
302  }
303 
304  break;
305 
307 
309  break;
310 
311  default :
312 
314  }
315 
316  break;
317 
318  default :
319 
321  }
322 
323  //
324  // Set the information field to the number of bytes actually filled in
325  // and then complete the request
326  //
327 
328  Irp->IoStatus.Information = IrpSp->Parameters.QueryFile.Length - Length;
329 
330  } _SEH2_FINALLY {
331 
332  //
333  // Release the file.
334  //
335 
336  if (ReleaseFcb) {
337 
338  CdReleaseFile( IrpContext, Fcb );
339  }
340  } _SEH2_END;
341 
342  //
343  // Complete the request if we didn't raise.
344  //
345 
346  CdCompleteRequest( IrpContext, Irp, Status );
347 
348  return Status;
349 }
#define FCB_STATE_INITIALIZED
Definition: cdstruc.h:1048
#define CdReleaseFile(IC, F)
Definition: cdprocs.h:1003
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
Definition: cdstruc.h:908
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
Definition: cdstruc.h:1073
LONG NTSTATUS
Definition: precomp.h:26
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
Definition: pipe.c:75
struct _FILE_ACCESS_INFORMATION FILE_ACCESS_INFORMATION
#define CdAcquireFileShared(IC, F)
Definition: cdprocs.h:997
VOID CdQueryPositionInfo(_In_ PIRP_CONTEXT IrpContext, _In_ PFILE_OBJECT FileObject, _Out_ PFILE_POSITION_INFORMATION Buffer, _Inout_ PULONG Length)
Definition: fileinfo.c:1103
_SEH2_TRY
Definition: create.c:4226
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN TypeOfOpen
Definition: cdprocs.h:588
#define FALSE
Definition: types.h:117
VOID CdCompleteRequest(_Inout_opt_ PIRP_CONTEXT IrpContext, _Inout_opt_ PIRP Irp, _In_ NTSTATUS Status)
Definition: cddata.c:914
VOID CdQueryEaInfo(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Out_ PFILE_EA_INFORMATION Buffer, _Inout_ PULONG Length)
Definition: fileinfo.c:1052
unsigned char BOOLEAN
Definition: bufpool.h:45
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
CdVerifyOrCreateDirStreamFile(IrpContext, Fcb)
struct _FILE_ALIGNMENT_INFORMATION FILE_ALIGNMENT_INFORMATION
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ULONG Flags
Definition: ntfs.h:532
#define CCB_FLAG_OPEN_BY_ID
Definition: cdstruc.h:1109
VOID CdQueryStandardInfo(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Out_ PFILE_STANDARD_INFORMATION Buffer, _Inout_ PULONG Length)
Definition: fileinfo.c:927
VOID CdQueryBasicInfo(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Out_ PFILE_BASIC_INFORMATION Buffer, _Inout_ PULONG Length)
Definition: fileinfo.c:864
Status
Definition: gdiplustypes.h:24
enum _TYPE_OF_OPEN TYPE_OF_OPEN
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:588
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
PFILE_OBJECT FileObject
Definition: iotypes.h:3148
_SEH2_END
Definition: create.c:4400
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
VOID CdQueryInternalInfo(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Out_ PFILE_INTERNAL_INFORMATION Buffer, _Inout_ PULONG Length)
Definition: fileinfo.c:1002
VOID CdQueryNetworkInfo(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Out_ PFILE_NETWORK_OPEN_INFORMATION Buffer, _Inout_ PULONG Length)
Definition: fileinfo.c:1463
_SEH2_FINALLY
Definition: create.c:4371
NTSTATUS CdQueryNameInfo(_In_ PIRP_CONTEXT IrpContext, _In_ PFILE_OBJECT FileObject, _Out_ PFILE_NAME_INFORMATION Buffer, _Inout_ PULONG Length)
Definition: fileinfo.c:1158
BOOLEAN CdVerifyFcbOperation(_In_opt_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb)
Definition: verfysup.c:615
#define FileStandardInformation
Definition: propsheet.cpp:61
unsigned int ULONG
Definition: retypes.h:1
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3107
_In_ PFCB Fcb
Definition: cdprocs.h:159
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:3014
ULONG FcbState
Definition: cdstruc.h:977
#define PAGED_CODE()
#define NT_ASSERT
Definition: rtlfuncs.h:3312

◆ CdQueryBasicInfo()

VOID CdQueryBasicInfo ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFCB  Fcb,
_Out_ PFILE_BASIC_INFORMATION  Buffer,
_Inout_ PULONG  Length 
)

Definition at line 864 of file fileinfo.c.

893 {
894  PAGED_CODE();
895 
896  UNREFERENCED_PARAMETER( IrpContext );
897 
898  //
899  // We only support creation, last modify and last write times on Cdfs.
900  //
901 
903 
904  Buffer->LastWriteTime.QuadPart =
905  Buffer->CreationTime.QuadPart =
906  Buffer->ChangeTime.QuadPart = Fcb->CreationTime;
907 
908  Buffer->LastAccessTime.QuadPart = 0;
909 
910  Buffer->FileAttributes = Fcb->FileAttributes;
911 
912  //
913  // Update the length and status output variables
914  //
915 
916  *Length -= sizeof( FILE_BASIC_INFORMATION );
917 
918  return;
919 }
LONGLONG CreationTime
Definition: cdstruc.h:1036
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
ULONG FileAttributes
Definition: cdstruc.h:983
Definition: bufpool.h:45
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_In_ PFCB Fcb
Definition: cdprocs.h:159
#define PAGED_CODE()
#define FILE_BASIC_INFORMATION
Definition: disk.h:53

◆ CdQueryEaInfo()

VOID CdQueryEaInfo ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFCB  Fcb,
_Out_ PFILE_EA_INFORMATION  Buffer,
_Inout_ PULONG  Length 
)

Definition at line 1052 of file fileinfo.c.

1081 {
1082  PAGED_CODE();
1083 
1084  UNREFERENCED_PARAMETER( IrpContext );
1086 
1087  //
1088  // No Ea's on Cdfs volumes.
1089  //
1090 
1091  Buffer->EaSize = 0;
1092  *Length -= sizeof( FILE_EA_INFORMATION );
1093 
1094  return;
1095 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
Definition: bufpool.h:45
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct _FILE_EA_INFORMATION FILE_EA_INFORMATION
_In_ PFCB Fcb
Definition: cdprocs.h:159
#define PAGED_CODE()

◆ CdQueryInternalInfo()

VOID CdQueryInternalInfo ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFCB  Fcb,
_Out_ PFILE_INTERNAL_INFORMATION  Buffer,
_Inout_ PULONG  Length 
)

Definition at line 1002 of file fileinfo.c.

1031 {
1032  PAGED_CODE();
1033 
1034  UNREFERENCED_PARAMETER( IrpContext );
1035 
1036  //
1037  // Index number is the file Id number in the Fcb.
1038  //
1039 
1040  Buffer->IndexNumber = Fcb->FileId;
1041  *Length -= sizeof( FILE_INTERNAL_INFORMATION );
1042 
1043  return;
1044 }
struct _FILE_INTERNAL_INFORMATION FILE_INTERNAL_INFORMATION
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
Definition: bufpool.h:45
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
FILE_ID FileId
Definition: cdstruc.h:958
_In_ PFCB Fcb
Definition: cdprocs.h:159
#define PAGED_CODE()

◆ CdQueryNameInfo()

NTSTATUS CdQueryNameInfo ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFILE_OBJECT  FileObject,
_Out_ PFILE_NAME_INFORMATION  Buffer,
_Inout_ PULONG  Length 
)

Definition at line 1158 of file fileinfo.c.

1187 {
1189  ULONG LengthToCopy;
1190 
1191  PAGED_CODE();
1192 
1193  UNREFERENCED_PARAMETER( IrpContext );
1194 
1195  NT_ASSERT(*Length >= sizeof(ULONG));
1196 
1197  //
1198  // Simply copy the name in the file object to the user's buffer.
1199  //
1200 
1201  //
1202  // Place the size of the filename in the user's buffer and reduce the remaining
1203  // size to match.
1204  //
1205 
1206  Buffer->FileNameLength = LengthToCopy = FileObject->FileName.Length;
1207  *Length -= sizeof(ULONG);
1208 
1209  if (LengthToCopy > *Length) {
1210 
1211  LengthToCopy = *Length;
1213  }
1214 
1215  RtlCopyMemory( Buffer->FileName, FileObject->FileName.Buffer, LengthToCopy );
1216 
1217  //
1218  // Reduce the available bytes by the amount stored into this buffer. In the overflow
1219  // case, this simply drops to zero. The returned filenamelength will indicate to the
1220  // caller how much space is required.
1221  //
1222 
1223  *Length -= LengthToCopy;
1224 
1225  return Status;
1226 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
LONG NTSTATUS
Definition: precomp.h:26
Definition: bufpool.h:45
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define PAGED_CODE()
#define NT_ASSERT
Definition: rtlfuncs.h:3312

◆ CdQueryNetworkInfo()

VOID CdQueryNetworkInfo ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFCB  Fcb,
_Out_ PFILE_NETWORK_OPEN_INFORMATION  Buffer,
_Inout_ PULONG  Length 
)

Definition at line 1463 of file fileinfo.c.

1492 {
1493  PAGED_CODE();
1494 
1495  UNREFERENCED_PARAMETER( IrpContext );
1496 
1497  //
1498  // We only support creation, last modify and last write times on Cdfs.
1499  //
1500 
1501  Buffer->LastWriteTime.QuadPart =
1502  Buffer->CreationTime.QuadPart =
1503  Buffer->ChangeTime.QuadPart = Fcb->CreationTime;
1504 
1505  Buffer->LastAccessTime.QuadPart = 0;
1506 
1507  Buffer->FileAttributes = Fcb->FileAttributes;
1508 
1509  //
1510  // We get the sizes from the header. Return a size of zero
1511  // for all directories.
1512  //
1513 
1515 
1516  Buffer->AllocationSize.QuadPart =
1517  Buffer->EndOfFile.QuadPart = 0;
1518 
1519  } else {
1520 
1521  Buffer->AllocationSize.QuadPart = Fcb->AllocationSize.QuadPart;
1522  Buffer->EndOfFile.QuadPart = Fcb->FileSize.QuadPart;
1523  }
1524 
1525  //
1526  // Update the length and status output variables
1527  //
1528 
1529  *Length -= sizeof( FILE_NETWORK_OPEN_INFORMATION );
1530 
1531  return;
1532 }
LONGLONG CreationTime
Definition: cdstruc.h:1036
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
ULONG FileAttributes
Definition: cdstruc.h:983
struct _FILE_NETWORK_OPEN_INFORMATION FILE_NETWORK_OPEN_INFORMATION
Definition: bufpool.h:45
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
_In_ PFCB Fcb
Definition: cdprocs.h:159
#define PAGED_CODE()

◆ CdQueryPositionInfo()

VOID CdQueryPositionInfo ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFILE_OBJECT  FileObject,
_Out_ PFILE_POSITION_INFORMATION  Buffer,
_Inout_ PULONG  Length 
)

Definition at line 1103 of file fileinfo.c.

1132 {
1133  PAGED_CODE();
1134 
1135  UNREFERENCED_PARAMETER( IrpContext );
1136 
1137  //
1138  // Get the current position found in the file object.
1139  //
1140 
1141  Buffer->CurrentByteOffset = FileObject->CurrentByteOffset;
1142 
1143  //
1144  // Update the length and status output variables
1145  //
1146 
1147  *Length -= sizeof( FILE_POSITION_INFORMATION );
1148 
1149  return;
1150 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
struct _FILE_POSITION_INFORMATION FILE_POSITION_INFORMATION
Definition: bufpool.h:45
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define PAGED_CODE()

◆ CdQueryStandardInfo()

VOID CdQueryStandardInfo ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFCB  Fcb,
_Out_ PFILE_STANDARD_INFORMATION  Buffer,
_Inout_ PULONG  Length 
)

Definition at line 927 of file fileinfo.c.

955 {
956  PAGED_CODE();
957 
958  UNREFERENCED_PARAMETER( IrpContext );
959 
960  //
961  // There is only one link and delete is never pending on a Cdrom file.
962  //
963 
964  Buffer->NumberOfLinks = 1;
965  Buffer->DeletePending = FALSE;
966 
967  //
968  // We get the sizes from the header. Return a size of zero
969  // for all directories.
970  //
971 
973 
974  Buffer->AllocationSize.QuadPart =
975  Buffer->EndOfFile.QuadPart = 0;
976 
977  Buffer->Directory = TRUE;
978 
979  } else {
980 
981  Buffer->AllocationSize.QuadPart = Fcb->AllocationSize.QuadPart;
982  Buffer->EndOfFile.QuadPart = Fcb->FileSize.QuadPart;
983 
984  Buffer->Directory = FALSE;
985  }
986 
987  //
988  // Update the length and status output variables
989  //
990 
991  *Length -= sizeof( FILE_STANDARD_INFORMATION );
992 
993  return;
994 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
ULONG FileAttributes
Definition: cdstruc.h:983
#define FALSE
Definition: types.h:117
Definition: bufpool.h:45
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define FILE_STANDARD_INFORMATION
Definition: disk.h:54
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
_In_ PFCB Fcb
Definition: cdprocs.h:159
#define PAGED_CODE()