ReactOS 0.4.16-dev-125-g798ea90
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{
157 BOOLEAN CanWait = FALSE;
158 PVCB Vcb;
159 BOOLEAN PostRequest = FALSE;
160 BOOLEAN AcquiredVCB = FALSE;
162// PtrUDFFCB Fcb = 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
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
201 RtlZeroMemory(Irp->AssociatedIrp.SystemBuffer, Length);
202
203 switch (IrpSp->Parameters.QueryVolume.FsInformationClass) {
204
206
207 // This is the only routine we need the Vcb shared because of
208 // copying the volume label. All other routines copy fields that
209 // cannot change or are just manifest constants.
211 if (!UDFAcquireResourceShared(&(Vcb->VCBResource), CanWait)) {
212 PostRequest = TRUE;
214 }
215 AcquiredVCB = TRUE;
216
217 RC = UDFQueryFsVolumeInfo( PtrIrpContext, Vcb, (PFILE_FS_VOLUME_INFORMATION)(Irp->AssociatedIrp.SystemBuffer), &Length );
218 break;
219
221
222 RC = UDFQueryFsSizeInfo( PtrIrpContext, Vcb, (PFILE_FS_SIZE_INFORMATION)(Irp->AssociatedIrp.SystemBuffer), &Length );
223 break;
224
226
227 RC = UDFQueryFsDeviceInfo( PtrIrpContext, Vcb, (PFILE_FS_DEVICE_INFORMATION)(Irp->AssociatedIrp.SystemBuffer), &Length );
228 break;
229
231
232 RC = UDFQueryFsAttributeInfo( PtrIrpContext, Vcb, (PFILE_FS_ATTRIBUTE_INFORMATION)(Irp->AssociatedIrp.SystemBuffer), &Length );
233 break;
234
236
237 RC = UDFQueryFsFullSizeInfo( PtrIrpContext, Vcb, (PFILE_FS_FULL_SIZE_INFORMATION)(Irp->AssociatedIrp.SystemBuffer), &Length );
238 break;
239
240 default:
241
243 Irp->IoStatus.Information = 0;
244 break;
245
246 }
247
248 // Set the information field to the number of bytes actually filled in
249 Irp->IoStatus.Information = IrpSp->Parameters.QueryVolume.Length - Length;
250
251try_exit: NOTHING;
252
253 } _SEH2_FINALLY {
254
255 if (AcquiredVCB) {
256 UDFReleaseResource(&(Vcb->VCBResource));
257 AcquiredVCB = FALSE;
258 }
259
260 // Post IRP if required
261 if (PostRequest) {
262
263 // Since, the I/O Manager gave us a system buffer, we do not
264 // need to "lock" anything.
265
266 // Perform the post operation which will mark the IRP pending
267 // and will return STATUS_PENDING back to us
268 RC = UDFPostRequest(PtrIrpContext, Irp);
269
270 } else
272
273 Irp->IoStatus.Status = RC;
274 // Free up the Irp Context
275 UDFReleaseIrpContext(PtrIrpContext);
276 // complete the IRP
278 } // can we complete the IRP ?
279
280 } _SEH2_END;
281
282 return RC;
283} // end UDFCommonQueryVolInfo()
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define PAGED_CODE()
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
#define try_return(S)
Definition: cdprocs.h:2179
struct _VCB * PVCB
Definition: fatstruc.h:557
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
NTSTATUS UDFPostRequest(IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp)
Definition: misc.cpp:1128
VOID UDFReleaseIrpContext(PtrUDFIrpContext PtrIrpContext)
Definition: misc.cpp:1086
#define UDFReleaseResource(Resource)
Definition: env_spec_w32.h:661
#define UDFAcquireResourceShared(Resource, CanWait)
Definition: env_spec_w32.h:658
#define _SEH2_FINALLY
Definition: filesup.c:21
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
VOID UDFFlushTryBreak(IN PVCB Vcb)
Definition: flush.cpp:625
@ FileFsDeviceInformation
Definition: from_kernel.h:222
@ FileFsAttributeInformation
Definition: from_kernel.h:223
@ FileFsVolumeInformation
Definition: from_kernel.h:219
@ FileFsSizeInformation
Definition: from_kernel.h:221
#define NOTHING
Definition: input_list.c:10
#define ASSERT(a)
Definition: mode.c:44
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define FileFsFullSizeInformation
Definition: ntifs_ex.h:389
#define IoCompleteRequest
Definition: irp.c:1240
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 STATUS_PENDING
Definition: ntstatus.h:82
#define Vcb
Definition: cdprocs.h:1415
#define _SEH2_AbnormalTermination()
Definition: pseh2_64.h:166
#define UDF_IRP_CONTEXT_CAN_BLOCK
Definition: struct.h:385
struct _UDFContextControlBlock * PtrUDFCCB
PVOID DeviceExtension
Definition: env_spec_w32.h:418
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:3223
struct _IO_STACK_LOCATION::@3974::@3987 QueryVolume
union _IO_STACK_LOCATION::@1575 Parameters
uint32 IrpContextFlags
Definition: struct.h:364
uint8 MinorFunction
Definition: struct.h:368
uint8 MajorFunction
Definition: struct.h:366
Definition: cdstruc.h:498
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define UDFPrint(Args)
Definition: udffs.h:223
NTSTATUS UDFQueryFsFullSizeInfo(IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_FULL_SIZE_INFORMATION Buffer, IN OUT PULONG Length)
Definition: volinfo.cpp:404
NTSTATUS UDFQueryFsDeviceInfo(IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_DEVICE_INFORMATION Buffer, IN OUT PULONG Length)
Definition: volinfo.cpp:457
NTSTATUS UDFQueryFsVolumeInfo(IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_VOLUME_INFORMATION Buffer, IN OUT PULONG Length)
Definition: volinfo.cpp:300
NTSTATUS UDFQueryFsSizeInfo(IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_SIZE_INFORMATION Buffer, IN OUT PULONG Length)
Definition: volinfo.cpp:352
NTSTATUS UDFQueryFsAttributeInfo(IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_ATTRIBUTE_INFORMATION Buffer, IN OUT PULONG Length)
Definition: volinfo.cpp:496
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
* PFILE_OBJECT
Definition: iotypes.h:1998
#define IO_DISK_INCREMENT
Definition: iotypes.h:600

Referenced by UDFCommonDispatch(), and UDFQueryVolInfo().

◆ UDFCommonSetVolInfo()

NTSTATUS UDFCommonSetVolInfo ( PtrUDFIrpContext  PtrIrpContext,
PIRP  Irp 
)

Definition at line 666 of file volinfo.cpp.

670{
674 BOOLEAN CanWait = FALSE;
675 PVCB Vcb;
676 BOOLEAN PostRequest = FALSE;
677 BOOLEAN AcquiredVCB = FALSE;
679// PtrUDFFCB Fcb = NULL;
681
682 _SEH2_TRY {
683
684 UDFPrint(("UDFCommonSetVolInfo: \n"));
685 ASSERT(PtrIrpContext);
686 ASSERT(Irp);
687
688 PAGED_CODE();
689
692
693 // Get the FCB and CCB pointers.
694 Ccb = (PtrUDFCCB)(FileObject->FsContext2);
695 ASSERT(Ccb);
696
697 if(Ccb && Ccb->Fcb && (Ccb->Fcb->NodeIdentifier.NodeType != UDF_NODE_TYPE_VCB)) {
698 UDFPrint((" Can't change Label on Non-volume object\n"));
700 }
701
703 ASSERT(Vcb);
704 Vcb->VCBFlags |= UDF_VCB_SKIP_EJECT_CHECK;
705 // Reference our input parameters to make things easier
706
707 if(Vcb->VCBFlags & UDF_VCB_FLAGS_RAW_DISK) {
708 UDFPrint((" Can't change Label on blank volume ;)\n"));
710 }
711
713 // Acquire the Vcb for this volume.
714 CanWait = ((PtrIrpContext->IrpContextFlags & UDF_IRP_CONTEXT_CAN_BLOCK) ? TRUE : FALSE);
715 if (!UDFAcquireResourceShared(&(Vcb->VCBResource), CanWait)) {
716 PostRequest = TRUE;
718 }
719 AcquiredVCB = TRUE;
720#ifdef UDF_ENABLE_SECURITY
722 Ccb->PreviouslyGrantedAccess,
723 PtrIrpContext->MajorFunction,
724 PtrIrpContext->MinorFunction,
725 0,
726 NULL,
727 &(IrpSp->Parameters.SetVolume.FsInformationClass));
728 if(!NT_SUCCESS(RC)) {
729 try_return(RC);
730 }
731#endif //UDF_ENABLE_SECURITY
732 switch (IrpSp->Parameters.SetVolume.FsInformationClass) {
733
735
736 RC = UDFSetLabelInfo( PtrIrpContext, Vcb, (PFILE_FS_LABEL_INFORMATION)(Irp->AssociatedIrp.SystemBuffer), &Length );
737 Irp->IoStatus.Information = 0;
738 break;
739
740 default:
741
743 Irp->IoStatus.Information = 0;
744 break;
745
746 }
747
748 // Set the information field to the number of bytes actually filled in
749 Irp->IoStatus.Information = IrpSp->Parameters.SetVolume.Length - Length;
750
751try_exit: NOTHING;
752
753 } _SEH2_FINALLY {
754
755 if (AcquiredVCB) {
756 UDFReleaseResource(&(Vcb->VCBResource));
757 AcquiredVCB = FALSE;
758 }
759
760 // Post IRP if required
761 if (PostRequest) {
762
763 // Since, the I/O Manager gave us a system buffer, we do not
764 // need to "lock" anything.
765
766 // Perform the post operation which will mark the IRP pending
767 // and will return STATUS_PENDING back to us
768 RC = UDFPostRequest(PtrIrpContext, Irp);
769
770 } else {
771
772 // Can complete the IRP here if no exception was encountered
774 Irp->IoStatus.Status = RC;
775
776 // Free up the Irp Context
777 UDFReleaseIrpContext(PtrIrpContext);
778 // complete the IRP
780 }
781 } // can we complete the IRP ?
782
783 } _SEH2_END;
784
785 return RC;
786} // end UDFCommonSetVolInfo()
@ FileFsLabelInformation
Definition: from_kernel.h:220
#define UDF_NODE_TYPE_VCB
Definition: struct.h:61
struct _FCB::@729::@732 Fcb
struct _IO_STACK_LOCATION::@3974::@3988 SetVolume
#define UDF_VCB_FLAGS_RAW_DISK
Definition: udf_common.h:476
#define UDF_VCB_SKIP_EJECT_CHECK
Definition: udf_common.h:470
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
NTSTATUS UDFSetLabelInfo(IN PtrUDFIrpContext PtrIrpContext, IN PVCB Vcb, IN PFILE_FS_LABEL_INFORMATION Buffer, IN OUT PULONG Length)
Definition: volinfo.cpp:792

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 496 of file volinfo.cpp.

502{
504
506 PCWSTR FsTypeTitle;
507 ULONG FsTypeTitleLen;
508
509 PAGED_CODE();
510 UDFPrint((" UDFQueryFsAttributeInfo: \n"));
511 // Fill out the fixed portion of the buffer.
512 Buffer->FileSystemAttributes = FILE_CASE_SENSITIVE_SEARCH |
515#ifdef ALLOW_SPARSE
517#endif //ALLOW_SPARSE
518#ifdef UDF_ENABLE_SECURITY
520#endif //UDF_ENABLE_SECURITY
522
524
525 Buffer->MaximumComponentNameLength = UDF_X_NAME_LEN-1;
526
528 // Make sure we can copy full unicode characters.
529 *Length &= ~1;
530 // Determine how much of the file system name will fit.
531
532#define UDFSetFsTitle(tit) \
533 FsTypeTitle = UDF_FS_TITLE_##tit; \
534 FsTypeTitleLen = sizeof(UDF_FS_TITLE_##tit) - sizeof(WCHAR);
535
536 switch(Vcb->TargetDeviceObject->DeviceType) {
537 case FILE_DEVICE_CD_ROM: {
538 if(Vcb->VCBFlags & UDF_VCB_FLAGS_RAW_DISK) {
539 if(!Vcb->LastLBA) {
540 UDFSetFsTitle(BLANK);
541 } else {
543 }
544 } else
545 if(Vcb->CDR_Mode) {
546 if(Vcb->MediaClassEx == CdMediaClass_DVDR ||
547 Vcb->MediaClassEx == CdMediaClass_DVDRW ||
548 Vcb->MediaClassEx == CdMediaClass_DVDRAM) {
550 } else
551 if(Vcb->MediaClassEx == CdMediaClass_DVDpR ||
552 Vcb->MediaClassEx == CdMediaClass_DVDpRW) {
553 UDFSetFsTitle(DVDpR);
554 } else
555 if(Vcb->MediaClassEx == CdMediaClass_DVDROM) {
557 } else
558 if(Vcb->MediaClassEx == CdMediaClass_CDROM) {
559 UDFSetFsTitle(CDROM);
560 } else {
562 }
563 } else {
564 if(Vcb->MediaClassEx == CdMediaClass_DVDROM ||
565 Vcb->MediaClassEx == CdMediaClass_DVDR ||
566 Vcb->MediaClassEx == CdMediaClass_DVDpR) {
568 } else
569 if(Vcb->MediaClassEx == CdMediaClass_DVDR) {
571 } else
572 if(Vcb->MediaClassEx == CdMediaClass_DVDRW) {
574 } else
575 if(Vcb->MediaClassEx == CdMediaClass_DVDpRW) {
576 UDFSetFsTitle(DVDpRW);
577 } else
578 if(Vcb->MediaClassEx == CdMediaClass_DVDRAM) {
580 } else
581 if(Vcb->MediaClassEx == CdMediaClass_CDROM) {
582 UDFSetFsTitle(CDROM);
583 } else {
585 }
586 }
587 break;
588 }
589 default: {
590 UDFSetFsTitle(HDD);
591 break;
592 }
593 }
594
595#undef UDFSetFsTitle
596
597 if (*Length >= FsTypeTitleLen) {
598 BytesToCopy = FsTypeTitleLen;
599 } else {
602 }
603
605 // Do the file system name.
606 Buffer->FileSystemNameLength = BytesToCopy;
607 RtlCopyMemory( &Buffer->FileSystemName[0], FsTypeTitle, BytesToCopy );
608 // And return to our caller
609 return Status;
610} // end UDFQueryFsAttributeInfo()
#define CdMediaClass_DVDR
Definition: cdrw_usr.h:748
#define CdMediaClass_DVDRW
Definition: cdrw_usr.h:749
#define CdMediaClass_CDROM
Definition: cdrw_usr.h:743
#define CdMediaClass_DVDRAM
Definition: cdrw_usr.h:747
#define CdMediaClass_DVDROM
Definition: cdrw_usr.h:746
#define CdMediaClass_DVDpR
Definition: cdrw_usr.h:750
#define CdMediaClass_DVDpRW
Definition: cdrw_usr.h:751
Definition: bufpool.h:45
#define FILE_NAMED_STREAMS
Definition: from_kernel.h:245
#define FILE_SUPPORTS_SPARSE_FILES
Definition: from_kernel.h:239
#define FILE_READ_ONLY_VOLUME
Definition: from_kernel.h:246
#define FILE_PERSISTENT_ACLS
Definition: from_kernel.h:236
#define FILE_CASE_SENSITIVE_SEARCH
Definition: from_kernel.h:233
#define FILE_CASE_PRESERVED_NAMES
Definition: from_kernel.h:234
#define FILE_UNICODE_ON_DISK
Definition: from_kernel.h:235
Status
Definition: gdiplustypes.h:25
_In_ UINT _In_ UINT BytesToCopy
Definition: ndis.h:3168
#define FILE_DEVICE_CD_ROM
Definition: winioctl.h:47
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define UDF_VCB_FLAGS_VOLUME_READ_ONLY
Definition: udf_common.h:463
#define UDFStreamsSupported(Vcb)
Definition: udf_info.h:1037
#define UDFNtAclSupported(Vcb)
Definition: udf_info.h:1040
#define ALLOW_SPARSE
Definition: udffs.h:58
#define UDF_X_NAME_LEN
Definition: udffs.h:32
@ CDR
Definition: user_lib.h:34
@ CDRW
Definition: user_lib.h:35
@ DVDRW
Definition: user_lib.h:39
@ DVDR
Definition: user_lib.h:38
@ DVDROM
Definition: user_lib.h:36
@ DVDRAM
Definition: user_lib.h:37
#define UDFSetFsTitle(tit)

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 457 of file volinfo.cpp.

463{
464 PAGED_CODE();
465
466 UDFPrint((" UDFQueryFsDeviceInfo: \n"));
467 // Update the output buffer.
468 if (Vcb->TargetDeviceObject->DeviceType != FILE_DEVICE_CD_ROM && Vcb->TargetDeviceObject->DeviceType != FILE_DEVICE_DVD)
469 {
470 ASSERT(! (Vcb->TargetDeviceObject->Characteristics & (FILE_READ_ONLY_DEVICE | FILE_WRITE_ONCE_MEDIA)));
471 Buffer->Characteristics = Vcb->TargetDeviceObject->Characteristics & ~(FILE_READ_ONLY_DEVICE | FILE_WRITE_ONCE_MEDIA);
472 }
473 else
474 {
475 Buffer->Characteristics = Vcb->TargetDeviceObject->Characteristics;
476 }
477 Buffer->DeviceType = Vcb->TargetDeviceObject->DeviceType;
478 UDFPrint((" Characteristics %x, DeviceType %x\n", Buffer->Characteristics, Buffer->DeviceType));
479 // Adjust the length variable
481 return STATUS_SUCCESS;
482} // end UDFQueryFsDeviceInfo()
#define FILE_WRITE_ONCE_MEDIA
Definition: nt_native.h:810
struct _FILE_FS_DEVICE_INFORMATION FILE_FS_DEVICE_INFORMATION
#define FILE_READ_ONLY_DEVICE
Definition: nt_native.h:808
#define FILE_DEVICE_DVD
Definition: winioctl.h:96

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 404 of file volinfo.cpp.

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

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 352 of file volinfo.cpp.

358{
359 PAGED_CODE();
360
361 UDFPrint((" UDFQueryFsSizeInfo: \n"));
362 // Fill in the output buffer.
363 if(Vcb->BitmapModified) {
364 Vcb->TotalAllocUnits =
365 Buffer->TotalAllocationUnits.QuadPart = UDFGetTotalSpace(Vcb);
366 Vcb->FreeAllocUnits =
367 Buffer->AvailableAllocationUnits.QuadPart = UDFGetFreeSpace(Vcb);
368 Vcb->BitmapModified = FALSE;
369 } else {
370 Buffer->TotalAllocationUnits.QuadPart = Vcb->TotalAllocUnits;
371 Buffer->AvailableAllocationUnits.QuadPart = Vcb->FreeAllocUnits;
372 }
373 Vcb->LowFreeSpace = (Vcb->FreeAllocUnits < max(Vcb->FECharge,UDF_DEFAULT_FE_CHARGE)*128);
374 if(!Buffer->TotalAllocationUnits.QuadPart)
375 Buffer->TotalAllocationUnits.QuadPart = max(1, Vcb->LastPossibleLBA);
376 Buffer->SectorsPerAllocationUnit = Vcb->LBlockSize / Vcb->BlockSize;
377 if(!Buffer->SectorsPerAllocationUnit)
378 Buffer->SectorsPerAllocationUnit = 1;
379 Buffer->BytesPerSector = Vcb->BlockSize;
380 if(!Buffer->BytesPerSector)
381 Buffer->BytesPerSector = 2048;
382
383 UDFPrint((" Space: Total %I64x, Free %I64x\n",
384 Buffer->TotalAllocationUnits.QuadPart,
385 Buffer->AvailableAllocationUnits.QuadPart));
386
387 // Adjust the length variable
388 *Length -= sizeof( FILE_FS_SIZE_INFORMATION );
389 return STATUS_SUCCESS;
390} // UDFQueryFsSizeInfo()
struct _FILE_FS_SIZE_INFORMATION FILE_FS_SIZE_INFORMATION
#define UDF_DEFAULT_FE_CHARGE
Definition: udf_rel.h:500

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 300 of file volinfo.cpp.

306{
309
310 PAGED_CODE();
311
312 UDFPrint((" UDFQueryFsVolumeInfo: \n"));
313 // Fill in the data from the Vcb.
314 Buffer->VolumeCreationTime.QuadPart = Vcb->VolCreationTime;
315 Buffer->VolumeSerialNumber = Vcb->PhSerialNumber;
316 UDFPrint((" SN %x\n", Vcb->PhSerialNumber));
317
318 Buffer->SupportsObjects = FALSE;
319
320 *Length -= FIELD_OFFSET( FILE_FS_VOLUME_INFORMATION, VolumeLabel[0] );
321
322 // Check if the buffer we're given is long enough
323 if (*Length >= (ULONG) Vcb->VolIdent.Length) {
324 BytesToCopy = Vcb->VolIdent.Length;
326 } else {
329 }
330 // Copy over what we can of the volume label, and adjust *Length
331 Buffer->VolumeLabelLength = BytesToCopy;
332
333 if (BytesToCopy)
334 RtlCopyMemory( &(Buffer->VolumeLabel[0]), Vcb->VolIdent.Buffer, BytesToCopy );
336
337 return Status;
338} // end UDFQueryFsVolumeInfo()

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()
NTSTATUS UDFExceptionHandler(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
Definition: misc.cpp:358
BOOLEAN __fastcall UDFIsIrpTopLevel(PIRP Irp)
Definition: misc.cpp:228
VOID UDFLogEvent(NTSTATUS UDFEventLogId, NTSTATUS RC)
Definition: misc.cpp:575
PtrUDFIrpContext UDFAllocateIrpContext(PIRP Irp, PDEVICE_OBJECT PtrTargetDeviceObject)
Definition: misc.cpp:985
long UDFExceptionFilter(PtrUDFIrpContext PtrIrpContext, PEXCEPTION_POINTERS PtrExceptionPointers)
Definition: misc.cpp:265
#define UDF_ERROR_INTERNAL_ERROR
Definition: errmsg.h:71
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:164
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSTATUS UDFCommonQueryVolInfo(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
Definition: volinfo.cpp:149
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055

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 792 of file volinfo.cpp.

798{
799 PAGED_CODE();
800
801 UDFPrint((" UDFSetLabelInfo: \n"));
802 if(Buffer->VolumeLabelLength > UDF_VOL_LABEL_LEN*sizeof(WCHAR)) {
803 // Too long Volume Label... NT doesn't like it
804 UDFPrint((" UDFSetLabelInfo: STATUS_INVALID_VOLUME_LABEL\n"));
806 }
807
808 if(Vcb->VolIdent.Buffer) MyFreePool__(Vcb->VolIdent.Buffer);
809 Vcb->VolIdent.Buffer = (PWCHAR)MyAllocatePool__(NonPagedPool, Buffer->VolumeLabelLength+sizeof(WCHAR));
810 if(!Vcb->VolIdent.Buffer) return STATUS_INSUFFICIENT_RESOURCES;
811
812 Vcb->VolIdent.Length = (USHORT)Buffer->VolumeLabelLength;
813 Vcb->VolIdent.MaximumLength = (USHORT)Buffer->VolumeLabelLength+sizeof(WCHAR);
814 RtlCopyMemory(Vcb->VolIdent.Buffer, &(Buffer->VolumeLabel), Buffer->VolumeLabelLength);
815 Vcb->VolIdent.Buffer[Buffer->VolumeLabelLength/sizeof(WCHAR)] = 0;
817
818 UDFPrint((" UDFSetLabelInfo: OK\n"));
819 return STATUS_SUCCESS;
820} // end UDFSetLabelInfo ()
#define NonPagedPool
Definition: env_spec_w32.h:307
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
#define MyFreePool__(addr)
Definition: mem_tools.h:152
VOID UDFSetModified(IN PVCB Vcb)
Definition: misc_common.cpp:9
#define UDF_VOL_LABEL_LEN
Definition: osta_misc.h:317
unsigned short USHORT
Definition: pedump.c:61
uint16_t * PWCHAR
Definition: typedefs.h:56
#define STATUS_INVALID_VOLUME_LABEL
Definition: udferr_usr.h:156

Referenced by UDFCommonSetVolInfo().

◆ UDFSetVolInfo()

NTSTATUS NTAPI UDFSetVolInfo ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 617 of file volinfo.cpp.

621{
623 PtrUDFIrpContext PtrIrpContext = NULL;
624 BOOLEAN AreWeTopLevel = FALSE;
625
626 UDFPrint(("UDFSetVolInfo: \n"));
627
630 ASSERT(Irp);
631
632 // set the top level context
633 AreWeTopLevel = UDFIsIrpTopLevel(Irp);
634 ASSERT(!UDFIsFSDevObj(DeviceObject));
635
636 _SEH2_TRY {
637
638 // get an IRP context structure and issue the request
639 PtrIrpContext = UDFAllocateIrpContext(Irp, DeviceObject);
640 ASSERT(PtrIrpContext);
641
642 RC = UDFCommonSetVolInfo(PtrIrpContext, Irp);
643
645
646 RC = UDFExceptionHandler(PtrIrpContext, Irp);
647
649 } _SEH2_END;
650
651 if (AreWeTopLevel) {
653 }
654
656
657 return(RC);
658} // end UDFSetVolInfo()
NTSTATUS UDFCommonSetVolInfo(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
Definition: volinfo.cpp:666

Referenced by UDFInitializeFunctionPointers().