ReactOS  0.4.14-dev-317-g96040ec
volinfo.cpp File Reference
#include "udffs.h"
Include dependency graph for volinfo.cpp:

Go to the source code of this file.

Macros

#define UDF_BUG_CHECK_ID   UDF_FILE_VOL_INFORMATION
 
#define UDFSetFsTitle(tit)
 

Functions

NTSTATUS UDFQueryFsVolumeInfo (IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_VOLUME_INFORMATION Buffer, IN OUT PULONG Length)
 
NTSTATUS UDFQueryFsSizeInfo (IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_SIZE_INFORMATION Buffer, IN OUT PULONG Length)
 
NTSTATUS UDFQueryFsFullSizeInfo (IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_FULL_SIZE_INFORMATION Buffer, IN OUT PULONG Length)
 
NTSTATUS UDFQueryFsDeviceInfo (IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_DEVICE_INFORMATION Buffer, IN OUT PULONG Length)
 
NTSTATUS UDFQueryFsAttributeInfo (IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_ATTRIBUTE_INFORMATION Buffer, IN OUT PULONG Length)
 
NTSTATUS UDFSetLabelInfo (IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_LABEL_INFORMATION Buffer, IN OUT PULONG Length)
 
NTSTATUS NTAPI UDFQueryVolInfo (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS UDFCommonQueryVolInfo (PtrUDFIrpContext PtrIrpContext, PIRP Irp)
 
NTSTATUS NTAPI UDFSetVolInfo (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS UDFCommonSetVolInfo (PtrUDFIrpContext PtrIrpContext, PIRP Irp)
 

Macro Definition Documentation

◆ UDF_BUG_CHECK_ID

#define UDF_BUG_CHECK_ID   UDF_FILE_VOL_INFORMATION

Definition at line 22 of file volinfo.cpp.

◆ UDFSetFsTitle

#define UDFSetFsTitle (   tit)
Value:
FsTypeTitle = UDF_FS_TITLE_##tit; \
FsTypeTitleLen = sizeof(UDF_FS_TITLE_##tit) - sizeof(WCHAR);
__wchar_t WCHAR
Definition: xmlstorage.h:180

Function Documentation

◆ UDFCommonQueryVolInfo()

NTSTATUS UDFCommonQueryVolInfo ( PtrUDFIrpContext  PtrIrpContext,
PIRP  Irp 
)

Definition at line 149 of file volinfo.cpp.

153 {
156  ULONG Length;
157  BOOLEAN CanWait = FALSE;
158  PVCB Vcb;
159  BOOLEAN PostRequest = FALSE;
160  BOOLEAN AcquiredVCB = FALSE;
162 // PtrUDFFCB Fcb = NULL;
163  PtrUDFCCB Ccb = NULL;
164 
165  _SEH2_TRY {
166 
167  UDFPrint(("UDFCommonQueryVolInfo: \n"));
168 
169  ASSERT(PtrIrpContext);
170  ASSERT(Irp);
171 
172  PAGED_CODE();
173 
176 
177  // Get the FCB and CCB pointers.
178  Ccb = (PtrUDFCCB)(FileObject->FsContext2);
179  ASSERT(Ccb);
180 
182  ASSERT(Vcb);
183  //Vcb->VCBFlags |= UDF_VCB_SKIP_EJECT_CHECK;
184  // Reference our input parameters to make things easier
185  Length = IrpSp->Parameters.QueryVolume.Length;
186  // Acquire the Vcb for this volume.
187  CanWait = ((PtrIrpContext->IrpContextFlags & UDF_IRP_CONTEXT_CAN_BLOCK) ? TRUE : FALSE);
188 #ifdef UDF_ENABLE_SECURITY
190  Ccb->PreviouslyGrantedAccess,
191  PtrIrpContext->MajorFunction,
192  PtrIrpContext->MinorFunction,
193  0,
194  NULL,
195  &(IrpSp->Parameters.QueryVolume.FsInformationClass));
196  if(!NT_SUCCESS(RC)) {
197  try_return(RC);
198  }
199 #endif //UDF_ENABLE_SECURITY
200  switch (IrpSp->Parameters.QueryVolume.FsInformationClass) {
201 
203 
204  // This is the only routine we need the Vcb shared because of
205  // copying the volume label. All other routines copy fields that
206  // cannot change or are just manifest constants.
208  if (!UDFAcquireResourceShared(&(Vcb->VCBResource), CanWait)) {
209  PostRequest = TRUE;
210  try_return (RC = STATUS_PENDING);
211  }
212  AcquiredVCB = TRUE;
213 
214  RC = UDFQueryFsVolumeInfo( PtrIrpContext, Vcb, (PFILE_FS_VOLUME_INFORMATION)(Irp->AssociatedIrp.SystemBuffer), &Length );
215  break;
216 
218 
219  RC = UDFQueryFsSizeInfo( PtrIrpContext, Vcb, (PFILE_FS_SIZE_INFORMATION)(Irp->AssociatedIrp.SystemBuffer), &Length );
220  break;
221 
223 
224  RC = UDFQueryFsDeviceInfo( PtrIrpContext, Vcb, (PFILE_FS_DEVICE_INFORMATION)(Irp->AssociatedIrp.SystemBuffer), &Length );
225  break;
226 
228 
229  RC = UDFQueryFsAttributeInfo( PtrIrpContext, Vcb, (PFILE_FS_ATTRIBUTE_INFORMATION)(Irp->AssociatedIrp.SystemBuffer), &Length );
230  break;
231 
233 
234  RC = UDFQueryFsFullSizeInfo( PtrIrpContext, Vcb, (PFILE_FS_FULL_SIZE_INFORMATION)(Irp->AssociatedIrp.SystemBuffer), &Length );
235  break;
236 
237  default:
238 
240  Irp->IoStatus.Information = 0;
241  break;
242 
243  }
244 
245  // Set the information field to the number of bytes actually filled in
246  Irp->IoStatus.Information = IrpSp->Parameters.QueryVolume.Length - Length;
247 
248 try_exit: NOTHING;
249 
250  } _SEH2_FINALLY {
251 
252  if (AcquiredVCB) {
253  UDFReleaseResource(&(Vcb->VCBResource));
254  AcquiredVCB = FALSE;
255  }
256 
257  // Post IRP if required
258  if (PostRequest) {
259 
260  // Since, the I/O Manager gave us a system buffer, we do not
261  // need to "lock" anything.
262 
263  // Perform the post operation which will mark the IRP pending
264  // and will return STATUS_PENDING back to us
265  RC = UDFPostRequest(PtrIrpContext, Irp);
266 
267  } else
269 
270  Irp->IoStatus.Status = RC;
271  // Free up the Irp Context
272  UDFReleaseIrpContext(PtrIrpContext);
273  // complete the IRP
275  } // can we complete the IRP ?
276 
277  } _SEH2_END;
278 
279  return RC;
280 } // end UDFCommonQueryVolInfo()
VOID UDFReleaseIrpContext(PtrUDFIrpContext PtrIrpContext)
Definition: misc.cpp:1086
NTSTATUS NTAPI IoCheckFunctionAccess(IN ACCESS_MASK GrantedAccess, IN UCHAR MajorFunction, IN UCHAR MinorFunction, IN ULONG IoControlCode, IN PVOID ExtraData OPTIONAL, IN PVOID ExtraData2 OPTIONAL)
Definition: util.c:276
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
struct _UDFContextControlBlock * PtrUDFCCB
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define UDFReleaseResource(Resource)
Definition: env_spec_w32.h:661
#define FileFsFullSizeInformation
Definition: ntifs_ex.h:389
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
Definition: cdstruc.h:504
#define UDF_IRP_CONTEXT_CAN_BLOCK
Definition: struct.h:385
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
#define IO_DISK_INCREMENT
Definition: iotypes.h:568
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define _SEH2_AbnormalTermination()
Definition: pseh2_64.h:13
#define IoCompleteRequest
Definition: irp.c:1240
uint32 IrpContextFlags
Definition: struct.h:364
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
NTSTATUS UDFQueryFsDeviceInfo(IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_DEVICE_INFORMATION Buffer, IN OUT PULONG Length)
Definition: volinfo.cpp:454
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define try_return(S)
Definition: cdprocs.h:2189
#define Vcb
Definition: cdprocs.h:1425
NTSTATUS UDFQueryFsSizeInfo(IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_SIZE_INFORMATION Buffer, IN OUT PULONG Length)
Definition: volinfo.cpp:349
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2867
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS UDFQueryFsAttributeInfo(IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_ATTRIBUTE_INFORMATION Buffer, IN OUT PULONG Length)
Definition: volinfo.cpp:493
* PFILE_OBJECT
Definition: iotypes.h:1955
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define NOTHING
Definition: env_spec_w32.h:461
struct _VCB * PVCB
Definition: fatstruc.h:556
#define UDFAcquireResourceShared(Resource, CanWait)
Definition: env_spec_w32.h:658
VOID UDFFlushTryBreak(IN PVCB Vcb)
Definition: flush.cpp:625
uint8 MinorFunction
Definition: struct.h:368
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
NTSTATUS UDFPostRequest(IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp)
Definition: misc.cpp:1128
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
_SEH2_END
Definition: create.c:4424
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
_SEH2_FINALLY
Definition: create.c:4395
NTSTATUS UDFQueryFsVolumeInfo(IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_VOLUME_INFORMATION Buffer, IN OUT PULONG Length)
Definition: volinfo.cpp:297
NTSTATUS UDFQueryFsFullSizeInfo(IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_FULL_SIZE_INFORMATION Buffer, IN OUT PULONG Length)
Definition: volinfo.cpp:401
unsigned int ULONG
Definition: retypes.h:1
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
uint8 MajorFunction
Definition: struct.h:366

Referenced by UDFCommonDispatch(), and UDFQueryVolInfo().

◆ UDFCommonSetVolInfo()

NTSTATUS UDFCommonSetVolInfo ( PtrUDFIrpContext  PtrIrpContext,
PIRP  Irp 
)

Definition at line 663 of file volinfo.cpp.

667 {
670  ULONG Length;
671  BOOLEAN CanWait = FALSE;
672  PVCB Vcb;
673  BOOLEAN PostRequest = FALSE;
674  BOOLEAN AcquiredVCB = FALSE;
676 // PtrUDFFCB Fcb = NULL;
677  PtrUDFCCB Ccb = NULL;
678 
679  _SEH2_TRY {
680 
681  UDFPrint(("UDFCommonSetVolInfo: \n"));
682  ASSERT(PtrIrpContext);
683  ASSERT(Irp);
684 
685  PAGED_CODE();
686 
689 
690  // Get the FCB and CCB pointers.
691  Ccb = (PtrUDFCCB)(FileObject->FsContext2);
692  ASSERT(Ccb);
693 
694  if(Ccb && Ccb->Fcb && (Ccb->Fcb->NodeIdentifier.NodeType != UDF_NODE_TYPE_VCB)) {
695  UDFPrint((" Can't change Label on Non-volume object\n"));
697  }
698 
700  ASSERT(Vcb);
701  Vcb->VCBFlags |= UDF_VCB_SKIP_EJECT_CHECK;
702  // Reference our input parameters to make things easier
703 
704  if(Vcb->VCBFlags & UDF_VCB_FLAGS_RAW_DISK) {
705  UDFPrint((" Can't change Label on blank volume ;)\n"));
707  }
708 
709  Length = IrpSp->Parameters.SetVolume.Length;
710  // Acquire the Vcb for this volume.
711  CanWait = ((PtrIrpContext->IrpContextFlags & UDF_IRP_CONTEXT_CAN_BLOCK) ? TRUE : FALSE);
712  if (!UDFAcquireResourceShared(&(Vcb->VCBResource), CanWait)) {
713  PostRequest = TRUE;
714  try_return (RC = STATUS_PENDING);
715  }
716  AcquiredVCB = TRUE;
717 #ifdef UDF_ENABLE_SECURITY
719  Ccb->PreviouslyGrantedAccess,
720  PtrIrpContext->MajorFunction,
721  PtrIrpContext->MinorFunction,
722  0,
723  NULL,
724  &(IrpSp->Parameters.SetVolume.FsInformationClass));
725  if(!NT_SUCCESS(RC)) {
726  try_return(RC);
727  }
728 #endif //UDF_ENABLE_SECURITY
729  switch (IrpSp->Parameters.SetVolume.FsInformationClass) {
730 
732 
733  RC = UDFSetLabelInfo( PtrIrpContext, Vcb, (PFILE_FS_LABEL_INFORMATION)(Irp->AssociatedIrp.SystemBuffer), &Length );
734  Irp->IoStatus.Information = 0;
735  break;
736 
737  default:
738 
740  Irp->IoStatus.Information = 0;
741  break;
742 
743  }
744 
745  // Set the information field to the number of bytes actually filled in
746  Irp->IoStatus.Information = IrpSp->Parameters.SetVolume.Length - Length;
747 
748 try_exit: NOTHING;
749 
750  } _SEH2_FINALLY {
751 
752  if (AcquiredVCB) {
753  UDFReleaseResource(&(Vcb->VCBResource));
754  AcquiredVCB = FALSE;
755  }
756 
757  // Post IRP if required
758  if (PostRequest) {
759 
760  // Since, the I/O Manager gave us a system buffer, we do not
761  // need to "lock" anything.
762 
763  // Perform the post operation which will mark the IRP pending
764  // and will return STATUS_PENDING back to us
765  RC = UDFPostRequest(PtrIrpContext, Irp);
766 
767  } else {
768 
769  // Can complete the IRP here if no exception was encountered
770  if (!_SEH2_AbnormalTermination()) {
771  Irp->IoStatus.Status = RC;
772 
773  // Free up the Irp Context
774  UDFReleaseIrpContext(PtrIrpContext);
775  // complete the IRP
777  }
778  } // can we complete the IRP ?
779 
780  } _SEH2_END;
781 
782  return RC;
783 } // end UDFCommonSetVolInfo()
VOID UDFReleaseIrpContext(PtrUDFIrpContext PtrIrpContext)
Definition: misc.cpp:1086
NTSTATUS NTAPI IoCheckFunctionAccess(IN ACCESS_MASK GrantedAccess, IN UCHAR MajorFunction, IN UCHAR MinorFunction, IN ULONG IoControlCode, IN PVOID ExtraData OPTIONAL, IN PVOID ExtraData2 OPTIONAL)
Definition: util.c:276
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
struct _UDFContextControlBlock * PtrUDFCCB
struct _FCB::@710::@713 Fcb
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define UDF_NODE_TYPE_VCB
Definition: struct.h:61
#define UDFReleaseResource(Resource)
Definition: env_spec_w32.h:661
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
Definition: cdstruc.h:504
#define UDF_IRP_CONTEXT_CAN_BLOCK
Definition: struct.h:385
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
#define UDF_VCB_FLAGS_RAW_DISK
Definition: udf_common.h:476
NTSTATUS UDFSetLabelInfo(IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_LABEL_INFORMATION Buffer, IN OUT PULONG Length)
Definition: volinfo.cpp:789
#define IO_DISK_INCREMENT
Definition: iotypes.h:568
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define _SEH2_AbnormalTermination()
Definition: pseh2_64.h:13
#define IoCompleteRequest
Definition: irp.c:1240
uint32 IrpContextFlags
Definition: struct.h:364
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define UDF_VCB_SKIP_EJECT_CHECK
Definition: udf_common.h:470
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define try_return(S)
Definition: cdprocs.h:2189
#define Vcb
Definition: cdprocs.h:1425
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2867
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
* PFILE_OBJECT
Definition: iotypes.h:1955
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define NOTHING
Definition: env_spec_w32.h:461
struct _VCB * PVCB
Definition: fatstruc.h:556
#define UDFAcquireResourceShared(Resource, CanWait)
Definition: env_spec_w32.h:658
uint8 MinorFunction
Definition: struct.h:368
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
NTSTATUS UDFPostRequest(IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp)
Definition: misc.cpp:1128
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
_SEH2_END
Definition: create.c:4424
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
_SEH2_FINALLY
Definition: create.c:4395
unsigned int ULONG
Definition: retypes.h:1
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
uint8 MajorFunction
Definition: struct.h:366

Referenced by UDFCommonDispatch(), and UDFSetVolInfo().

◆ UDFQueryFsAttributeInfo()

NTSTATUS UDFQueryFsAttributeInfo ( IN PtrUDFIrpContext  PtrIrpContext,
IN PVCB  Vcb,
IN PFILE_FS_ATTRIBUTE_INFORMATION  Buffer,
IN OUT PULONG  Length 
)

Definition at line 493 of file volinfo.cpp.

499 {
501 
503  PCWSTR FsTypeTitle;
504  ULONG FsTypeTitleLen;
505 
506  PAGED_CODE();
507  UDFPrint((" UDFQueryFsAttributeInfo: \n"));
508  // Fill out the fixed portion of the buffer.
509  Buffer->FileSystemAttributes = FILE_CASE_SENSITIVE_SEARCH |
512 #ifdef ALLOW_SPARSE
514 #endif //ALLOW_SPARSE
515 #ifdef UDF_ENABLE_SECURITY
517 #endif //UDF_ENABLE_SECURITY
519 
521 
522  Buffer->MaximumComponentNameLength = UDF_X_NAME_LEN-1;
523 
524  *Length -= FIELD_OFFSET( FILE_FS_ATTRIBUTE_INFORMATION, FileSystemName );
525  // Make sure we can copy full unicode characters.
526  *Length &= ~1;
527  // Determine how much of the file system name will fit.
528 
529 #define UDFSetFsTitle(tit) \
530  FsTypeTitle = UDF_FS_TITLE_##tit; \
531  FsTypeTitleLen = sizeof(UDF_FS_TITLE_##tit) - sizeof(WCHAR);
532 
533  switch(Vcb->TargetDeviceObject->DeviceType) {
534  case FILE_DEVICE_CD_ROM: {
535  if(Vcb->VCBFlags & UDF_VCB_FLAGS_RAW_DISK) {
536  if(!Vcb->LastLBA) {
537  UDFSetFsTitle(BLANK);
538  } else {
540  }
541  } else
542  if(Vcb->CDR_Mode) {
543  if(Vcb->MediaClassEx == CdMediaClass_DVDR ||
544  Vcb->MediaClassEx == CdMediaClass_DVDRW ||
545  Vcb->MediaClassEx == CdMediaClass_DVDRAM) {
547  } else
548  if(Vcb->MediaClassEx == CdMediaClass_DVDpR ||
549  Vcb->MediaClassEx == CdMediaClass_DVDpRW) {
550  UDFSetFsTitle(DVDpR);
551  } else
552  if(Vcb->MediaClassEx == CdMediaClass_DVDROM) {
554  } else
555  if(Vcb->MediaClassEx == CdMediaClass_CDROM) {
556  UDFSetFsTitle(CDROM);
557  } else {
559  }
560  } else {
561  if(Vcb->MediaClassEx == CdMediaClass_DVDROM ||
562  Vcb->MediaClassEx == CdMediaClass_DVDR ||
563  Vcb->MediaClassEx == CdMediaClass_DVDpR) {
565  } else
566  if(Vcb->MediaClassEx == CdMediaClass_DVDR) {
568  } else
569  if(Vcb->MediaClassEx == CdMediaClass_DVDRW) {
571  } else
572  if(Vcb->MediaClassEx == CdMediaClass_DVDpRW) {
573  UDFSetFsTitle(DVDpRW);
574  } else
575  if(Vcb->MediaClassEx == CdMediaClass_DVDRAM) {
577  } else
578  if(Vcb->MediaClassEx == CdMediaClass_CDROM) {
579  UDFSetFsTitle(CDROM);
580  } else {
582  }
583  }
584  break;
585  }
586  default: {
587  UDFSetFsTitle(HDD);
588  break;
589  }
590  }
591 
592 #undef UDFSetFsTitle
593 
594  if (*Length >= FsTypeTitleLen) {
595  BytesToCopy = FsTypeTitleLen;
596  } else {
597  BytesToCopy = *Length;
599  }
600 
601  *Length -= BytesToCopy;
602  // Do the file system name.
603  Buffer->FileSystemNameLength = BytesToCopy;
604  RtlCopyMemory( &Buffer->FileSystemName[0], FsTypeTitle, BytesToCopy );
605  // And return to our caller
606  return Status;
607 } // end UDFQueryFsAttributeInfo()
#define CdMediaClass_DVDRAM
Definition: cdrw_usr.h:747
Definition: user_lib.h:39
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define UDFPrint(Args)
Definition: udffs.h:225
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define CdMediaClass_DVDpR
Definition: cdrw_usr.h:750
#define CdMediaClass_DVDR
Definition: cdrw_usr.h:748
Definition: user_lib.h:34
Definition: user_lib.h:38
LONG NTSTATUS
Definition: precomp.h:26
#define CdMediaClass_DVDRW
Definition: cdrw_usr.h:749
#define UDFNtAclSupported(Vcb)
Definition: udf_info.h:1040
#define PAGED_CODE()
Definition: video.h:57
_In_ UINT _In_ UINT BytesToCopy
Definition: ndis.h:3167
#define UDF_VCB_FLAGS_RAW_DISK
Definition: udf_common.h:476
#define FILE_DEVICE_CD_ROM
Definition: winioctl.h:107
#define UDF_VCB_FLAGS_VOLUME_READ_ONLY
Definition: udf_common.h:463
#define UDFSetFsTitle(tit)
#define CdMediaClass_DVDROM
Definition: cdrw_usr.h:746
Definition: bufpool.h:45
#define FILE_UNICODE_ON_DISK
Definition: from_kernel.h:235
#define FILE_CASE_SENSITIVE_SEARCH
Definition: from_kernel.h:233
#define Vcb
Definition: cdprocs.h:1425
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define FILE_NAMED_STREAMS
Definition: from_kernel.h:245
#define FILE_CASE_PRESERVED_NAMES
Definition: from_kernel.h:234
#define ALLOW_SPARSE
Definition: udffs.h:58
Definition: user_lib.h:35
Status
Definition: gdiplustypes.h:24
#define FILE_SUPPORTS_SPARSE_FILES
Definition: from_kernel.h:239
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define CdMediaClass_CDROM
Definition: cdrw_usr.h:743
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define CdMediaClass_DVDpRW
Definition: cdrw_usr.h:751
unsigned int ULONG
Definition: retypes.h:1
#define UDFStreamsSupported(Vcb)
Definition: udf_info.h:1037
#define FILE_PERSISTENT_ACLS
Definition: from_kernel.h:236
#define FILE_READ_ONLY_VOLUME
Definition: from_kernel.h:246
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define UDF_X_NAME_LEN
Definition: udffs.h:32

Referenced by UDFCommonQueryVolInfo().

◆ UDFQueryFsDeviceInfo()

NTSTATUS UDFQueryFsDeviceInfo ( IN PtrUDFIrpContext  PtrIrpContext,
IN PVCB  Vcb,
IN PFILE_FS_DEVICE_INFORMATION  Buffer,
IN OUT PULONG  Length 
)

Definition at line 454 of file volinfo.cpp.

460 {
461  PAGED_CODE();
462 
463  UDFPrint((" UDFQueryFsDeviceInfo: \n"));
464  // Update the output buffer.
465  if (Vcb->TargetDeviceObject->DeviceType != FILE_DEVICE_CD_ROM && Vcb->TargetDeviceObject->DeviceType != FILE_DEVICE_DVD)
466  {
467  ASSERT(! (Vcb->TargetDeviceObject->Characteristics & (FILE_READ_ONLY_DEVICE | FILE_WRITE_ONCE_MEDIA)));
468  Buffer->Characteristics = Vcb->TargetDeviceObject->Characteristics & ~(FILE_READ_ONLY_DEVICE | FILE_WRITE_ONCE_MEDIA);
469  }
470  else
471  {
472  Buffer->Characteristics = Vcb->TargetDeviceObject->Characteristics;
473  }
474  Buffer->DeviceType = Vcb->TargetDeviceObject->DeviceType;
475  UDFPrint((" Characteristics %x, DeviceType %x\n", Buffer->Characteristics, Buffer->DeviceType));
476  // Adjust the length variable
477  *Length -= sizeof( FILE_FS_DEVICE_INFORMATION );
478  return STATUS_SUCCESS;
479 } // end UDFQueryFsDeviceInfo()
#define UDFPrint(Args)
Definition: udffs.h:225
#define PAGED_CODE()
Definition: video.h:57
#define FILE_DEVICE_CD_ROM
Definition: winioctl.h:107
Definition: bufpool.h:45
#define Vcb
Definition: cdprocs.h:1425
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define FILE_WRITE_ONCE_MEDIA
Definition: nt_native.h:810
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
struct _FILE_FS_DEVICE_INFORMATION FILE_FS_DEVICE_INFORMATION
#define FILE_DEVICE_DVD
Definition: winioctl.h:156
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define FILE_READ_ONLY_DEVICE
Definition: nt_native.h:808

Referenced by UDFCommonQueryVolInfo().

◆ UDFQueryFsFullSizeInfo()

NTSTATUS UDFQueryFsFullSizeInfo ( IN PtrUDFIrpContext  PtrIrpContext,
IN PVCB  Vcb,
IN PFILE_FS_FULL_SIZE_INFORMATION  Buffer,
IN OUT PULONG  Length 
)

Definition at line 401 of file volinfo.cpp.

407 {
408  PAGED_CODE();
409 
410  UDFPrint((" UDFQueryFsFullSizeInfo: \n"));
411  // Fill in the output buffer.
412  if(Vcb->BitmapModified) {
413  Vcb->TotalAllocUnits =
414  Buffer->TotalAllocationUnits.QuadPart = UDFGetTotalSpace(Vcb);
415  Vcb->FreeAllocUnits =
416  Buffer->CallerAvailableAllocationUnits.QuadPart =
417  Buffer->ActualAvailableAllocationUnits.QuadPart = UDFGetFreeSpace(Vcb);
418  Vcb->BitmapModified = FALSE;
419  } else {
420  Buffer->TotalAllocationUnits.QuadPart = Vcb->TotalAllocUnits;
421  Buffer->CallerAvailableAllocationUnits.QuadPart =
422  Buffer->ActualAvailableAllocationUnits.QuadPart = Vcb->FreeAllocUnits;
423  }
424  if(!Buffer->TotalAllocationUnits.QuadPart)
425  Buffer->TotalAllocationUnits.QuadPart = max(1, Vcb->LastPossibleLBA);
426  Buffer->SectorsPerAllocationUnit = Vcb->LBlockSize / Vcb->BlockSize;
427  if(!Buffer->SectorsPerAllocationUnit)
428  Buffer->SectorsPerAllocationUnit = 1;
429  Buffer->BytesPerSector = Vcb->BlockSize;
430  if(!Buffer->BytesPerSector)
431  Buffer->BytesPerSector = 2048;
432 
433  UDFPrint((" Space: Total %I64x, Free %I64x\n",
434  Buffer->TotalAllocationUnits.QuadPart,
435  Buffer->ActualAvailableAllocationUnits.QuadPart));
436 
437  // Adjust the length variable
439  return STATUS_SUCCESS;
440 } // UDFQueryFsSizeInfo()
#define max(a, b)
Definition: svc.c:63
struct _FILE_FS_FULL_SIZE_INFORMATION FILE_FS_FULL_SIZE_INFORMATION
#define UDFPrint(Args)
Definition: udffs.h:225
int64 __fastcall UDFGetFreeSpace(IN PVCB Vcb)
Definition: alloc.cpp:1105
#define PAGED_CODE()
Definition: video.h:57
Definition: bufpool.h:45
#define Vcb
Definition: cdprocs.h:1425
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
return STATUS_SUCCESS
Definition: btrfs.c:2938
int64 __fastcall UDFGetTotalSpace(IN PVCB Vcb)
Definition: alloc.cpp:1138

Referenced by UDFCommonQueryVolInfo().

◆ UDFQueryFsSizeInfo()

NTSTATUS UDFQueryFsSizeInfo ( IN PtrUDFIrpContext  PtrIrpContext,
IN PVCB  Vcb,
IN PFILE_FS_SIZE_INFORMATION  Buffer,
IN OUT PULONG  Length 
)

Definition at line 349 of file volinfo.cpp.

355 {
356  PAGED_CODE();
357 
358  UDFPrint((" UDFQueryFsSizeInfo: \n"));
359  // Fill in the output buffer.
360  if(Vcb->BitmapModified) {
361  Vcb->TotalAllocUnits =
362  Buffer->TotalAllocationUnits.QuadPart = UDFGetTotalSpace(Vcb);
363  Vcb->FreeAllocUnits =
364  Buffer->AvailableAllocationUnits.QuadPart = UDFGetFreeSpace(Vcb);
365  Vcb->BitmapModified = FALSE;
366  } else {
367  Buffer->TotalAllocationUnits.QuadPart = Vcb->TotalAllocUnits;
368  Buffer->AvailableAllocationUnits.QuadPart = Vcb->FreeAllocUnits;
369  }
370  Vcb->LowFreeSpace = (Vcb->FreeAllocUnits < max(Vcb->FECharge,UDF_DEFAULT_FE_CHARGE)*128);
371  if(!Buffer->TotalAllocationUnits.QuadPart)
372  Buffer->TotalAllocationUnits.QuadPart = max(1, Vcb->LastPossibleLBA);
373  Buffer->SectorsPerAllocationUnit = Vcb->LBlockSize / Vcb->BlockSize;
374  if(!Buffer->SectorsPerAllocationUnit)
375  Buffer->SectorsPerAllocationUnit = 1;
376  Buffer->BytesPerSector = Vcb->BlockSize;
377  if(!Buffer->BytesPerSector)
378  Buffer->BytesPerSector = 2048;
379 
380  UDFPrint((" Space: Total %I64x, Free %I64x\n",
381  Buffer->TotalAllocationUnits.QuadPart,
382  Buffer->AvailableAllocationUnits.QuadPart));
383 
384  // Adjust the length variable
385  *Length -= sizeof( FILE_FS_SIZE_INFORMATION );
386  return STATUS_SUCCESS;
387 } // UDFQueryFsSizeInfo()
#define max(a, b)
Definition: svc.c:63
#define UDFPrint(Args)
Definition: udffs.h:225
int64 __fastcall UDFGetFreeSpace(IN PVCB Vcb)
Definition: alloc.cpp:1105
#define PAGED_CODE()
Definition: video.h:57
#define UDF_DEFAULT_FE_CHARGE
Definition: udf_rel.h:500
Definition: bufpool.h:45
#define Vcb
Definition: cdprocs.h:1425
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct _FILE_FS_SIZE_INFORMATION FILE_FS_SIZE_INFORMATION
return STATUS_SUCCESS
Definition: btrfs.c:2938
int64 __fastcall UDFGetTotalSpace(IN PVCB Vcb)
Definition: alloc.cpp:1138

Referenced by UDFCommonQueryVolInfo().

◆ UDFQueryFsVolumeInfo()

NTSTATUS UDFQueryFsVolumeInfo ( IN PtrUDFIrpContext  PtrIrpContext,
IN PVCB  Vcb,
IN PFILE_FS_VOLUME_INFORMATION  Buffer,
IN OUT PULONG  Length 
)

Definition at line 297 of file volinfo.cpp.

303 {
306 
307  PAGED_CODE();
308 
309  UDFPrint((" UDFQueryFsVolumeInfo: \n"));
310  // Fill in the data from the Vcb.
311  Buffer->VolumeCreationTime.QuadPart = Vcb->VolCreationTime;
312  Buffer->VolumeSerialNumber = Vcb->PhSerialNumber;
313  UDFPrint((" SN %x\n", Vcb->PhSerialNumber));
314 
315  Buffer->SupportsObjects = FALSE;
316 
317  *Length -= FIELD_OFFSET( FILE_FS_VOLUME_INFORMATION, VolumeLabel[0] );
318 
319  // Check if the buffer we're given is long enough
320  if (*Length >= (ULONG) Vcb->VolIdent.Length) {
321  BytesToCopy = Vcb->VolIdent.Length;
323  } else {
324  BytesToCopy = *Length;
326  }
327  // Copy over what we can of the volume label, and adjust *Length
328  Buffer->VolumeLabelLength = BytesToCopy;
329 
330  if (BytesToCopy)
331  RtlCopyMemory( &(Buffer->VolumeLabel[0]), Vcb->VolIdent.Buffer, BytesToCopy );
332  *Length -= BytesToCopy;
333 
334  return Status;
335 } // end UDFQueryFsVolumeInfo()
#define UDFPrint(Args)
Definition: udffs.h:225
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
_In_ UINT _In_ UINT BytesToCopy
Definition: ndis.h:3167
Definition: bufpool.h:45
#define Vcb
Definition: cdprocs.h:1425
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by UDFCommonQueryVolInfo().

◆ UDFQueryVolInfo()

NTSTATUS NTAPI UDFQueryVolInfo ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 86 of file volinfo.cpp.

90 {
92  PtrUDFIrpContext PtrIrpContext = NULL;
93  BOOLEAN AreWeTopLevel = FALSE;
94 
95  UDFPrint(("UDFQueryVolInfo: \n"));
96 
99  ASSERT(Irp);
100 
101  // set the top level context
102  AreWeTopLevel = UDFIsIrpTopLevel(Irp);
103  ASSERT(!UDFIsFSDevObj(DeviceObject));
104 
105  _SEH2_TRY {
106 
107  // get an IRP context structure and issue the request
108  PtrIrpContext = UDFAllocateIrpContext(Irp, DeviceObject);
109  if(PtrIrpContext) {
110  RC = UDFCommonQueryVolInfo(PtrIrpContext, Irp);
111  } else {
113  Irp->IoStatus.Status = RC;
114  Irp->IoStatus.Information = 0;
115  // complete the IRP
117  }
118 
120 
121  RC = UDFExceptionHandler(PtrIrpContext, Irp);
122 
124  } _SEH2_END;
125 
126  if (AreWeTopLevel) {
128  }
129 
131 
132  return(RC);
133 } // end UDFQueryVolInfo()
PtrUDFIrpContext UDFAllocateIrpContext(PIRP Irp, PDEVICE_OBJECT PtrTargetDeviceObject)
Definition: misc.cpp:985
#define UDFPrint(Args)
Definition: udffs.h:225
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
VOID UDFLogEvent(NTSTATUS UDFEventLogId, NTSTATUS RC)
Definition: misc.cpp:575
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
_SEH2_TRY
Definition: create.c:4250
#define IO_DISK_INCREMENT
Definition: iotypes.h:568
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:11
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
NTSTATUS UDFExceptionHandler(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
Definition: misc.cpp:358
NTSTATUS UDFCommonQueryVolInfo(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
Definition: volinfo.cpp:149
BOOLEAN __fastcall UDFIsIrpTopLevel(PIRP Irp)
Definition: misc.cpp:228
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
long UDFExceptionFilter(PtrUDFIrpContext PtrIrpContext, PEXCEPTION_POINTERS PtrExceptionPointers)
Definition: misc.cpp:265
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define UDF_ERROR_INTERNAL_ERROR
Definition: errmsg.h:71
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by UDFInitializeFunctionPointers().

◆ UDFSetLabelInfo()

NTSTATUS UDFSetLabelInfo ( IN PtrUDFIrpContext  PtrIrpContext,
IN PVCB  Vcb,
IN PFILE_FS_LABEL_INFORMATION  Buffer,
IN OUT PULONG  Length 
)

Definition at line 789 of file volinfo.cpp.

795 {
796  PAGED_CODE();
797 
798  UDFPrint((" UDFSetLabelInfo: \n"));
799  if(Buffer->VolumeLabelLength > UDF_VOL_LABEL_LEN*sizeof(WCHAR)) {
800  // Too long Volume Label... NT doesn't like it
801  UDFPrint((" UDFSetLabelInfo: STATUS_INVALID_VOLUME_LABEL\n"));
803  }
804 
805  if(Vcb->VolIdent.Buffer) MyFreePool__(Vcb->VolIdent.Buffer);
806  Vcb->VolIdent.Buffer = (PWCHAR)MyAllocatePool__(NonPagedPool, Buffer->VolumeLabelLength+sizeof(WCHAR));
807  if(!Vcb->VolIdent.Buffer) return STATUS_INSUFFICIENT_RESOURCES;
808 
809  Vcb->VolIdent.Length = (USHORT)Buffer->VolumeLabelLength;
810  Vcb->VolIdent.MaximumLength = (USHORT)Buffer->VolumeLabelLength+sizeof(WCHAR);
811  RtlCopyMemory(Vcb->VolIdent.Buffer, &(Buffer->VolumeLabel), Buffer->VolumeLabelLength);
812  Vcb->VolIdent.Buffer[Buffer->VolumeLabelLength/sizeof(WCHAR)] = 0;
814 
815  UDFPrint((" UDFSetLabelInfo: OK\n"));
816  return STATUS_SUCCESS;
817 } // end UDFSetLabelInfo ()
#define UDFPrint(Args)
Definition: udffs.h:225
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
uint16_t * PWCHAR
Definition: typedefs.h:54
#define STATUS_INVALID_VOLUME_LABEL
Definition: udferr_usr.h:156
#define PAGED_CODE()
Definition: video.h:57
Definition: bufpool.h:45
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define UDF_VOL_LABEL_LEN
Definition: osta_misc.h:317
VOID UDFSetModified(IN PVCB Vcb)
Definition: misc_common.cpp:9
unsigned short USHORT
Definition: pedump.c:61
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by UDFCommonSetVolInfo().

◆ UDFSetVolInfo()

NTSTATUS NTAPI UDFSetVolInfo ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 614 of file volinfo.cpp.

618 {
620  PtrUDFIrpContext PtrIrpContext = NULL;
621  BOOLEAN AreWeTopLevel = FALSE;
622 
623  UDFPrint(("UDFSetVolInfo: \n"));
624 
627  ASSERT(Irp);
628 
629  // set the top level context
630  AreWeTopLevel = UDFIsIrpTopLevel(Irp);
631  ASSERT(!UDFIsFSDevObj(DeviceObject));
632 
633  _SEH2_TRY {
634 
635  // get an IRP context structure and issue the request
636  PtrIrpContext = UDFAllocateIrpContext(Irp, DeviceObject);
637  ASSERT(PtrIrpContext);
638 
639  RC = UDFCommonSetVolInfo(PtrIrpContext, Irp);
640 
642 
643  RC = UDFExceptionHandler(PtrIrpContext, Irp);
644 
646  } _SEH2_END;
647 
648  if (AreWeTopLevel) {
650  }
651 
653 
654  return(RC);
655 } // end UDFSetVolInfo()
PtrUDFIrpContext UDFAllocateIrpContext(PIRP Irp, PDEVICE_OBJECT PtrTargetDeviceObject)
Definition: misc.cpp:985
#define UDFPrint(Args)
Definition: udffs.h:225
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
VOID UDFLogEvent(NTSTATUS UDFEventLogId, NTSTATUS RC)
Definition: misc.cpp:575
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
_SEH2_TRY
Definition: create.c:4250
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:11
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS UDFExceptionHandler(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
Definition: misc.cpp:358
BOOLEAN __fastcall UDFIsIrpTopLevel(PIRP Irp)
Definition: misc.cpp:228
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
long UDFExceptionFilter(PtrUDFIrpContext PtrIrpContext, PEXCEPTION_POINTERS PtrExceptionPointers)
Definition: misc.cpp:265
NTSTATUS UDFCommonSetVolInfo(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
Definition: volinfo.cpp:663
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define UDF_ERROR_INTERNAL_ERROR
Definition: errmsg.h:71
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by UDFInitializeFunctionPointers().