23#define UDF_BUG_CHECK_ID UDF_FILE_VERIFY_FS_CONTROL
44 ULONG MediaChangeCount = 0;
48 UDFPrint((
"UDFVerifyVCB: Modified=%d\n",
Vcb->Modified));
62 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_UNSAFE_IOCTL;
66 &MediaChangeCount,
sizeof(
ULONG),
70 if (
Iosb.Information !=
sizeof(
ULONG)) MediaChangeCount = 0;
71 UDFPrint((
" MediaChangeCount %d -> %d\n",
Vcb->MediaChangeCount, MediaChangeCount));
81 (
NT_SUCCESS(RC) && (
Vcb->MediaChangeCount != MediaChangeCount)) ||
84 UDFPrint((
" set DO_VERIFY_VOLUME\n"));
95 Vcb->MediaChangeCount = MediaChangeCount;
100 UDFPrint((
" UDFNormalizeAndRaiseStatus(%x)\n", RC));
106 UDFPrint((
"UDFVerifyVCB: Modified=%d\n",
Vcb->Modified));
111 UDFPrint((
" DO_VERIFY_VOLUME -> IoSetHardErrorOrVerifyDevice()\n"));
113 Vcb->Vpb->RealDevice );
121 UDFPrint((
"UDFVerifyVCB: Modified=%d\n",
Vcb->Modified));
123 UDFPrint((
" !UDF_VCB_FLAGS_VOLUME_MOUNTED -> IoSetHardErrorOrVerifyDevice()\n"));
133 UDFPrint((
" UDF_VCB_FLAGS_BEING_DISMOUNTED\n"));
138 UDFPrint((
"UDFVerifyVcb: RC = %x\n", RC));
167 ULONG MediaChangeCount = 0;
185 UDFPrint((
"UDFVerifyVolume: Modified=%d\n",
Vcb->Modified));
192 UDFPrint((
"UDFVerifyVolume: STATUS_SUCCESS (1)\n"));
195 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_UNSAFE_IOCTL;
198 Vcb->TargetDeviceObject,
200 &MediaChangeCount,
sizeof(
ULONG),
207 UDFPrint((
"UDFVerifyVolume: STATUS_WRONG_VOLUME (1)\n"));
212 UDFPrint((
"UDFVerifyVolume: STATUS_WRONG_VOLUME (2)\n"));
220 MediaChangeCount = 0;
223 UDFPrint((
"UDFVerifyVolume: Modified=%d\n",
Vcb->Modified));
224 UDFPrint((
"UDFVerifyVolume: MediaChangeCount=%x, Vcb->MediaChangeCount=%x, UnsafeIoctl=%x\n",
225 MediaChangeCount,
Vcb->MediaChangeCount, UnsafeIoctl));
228 if(MediaChangeCount == 0 ||
229 (
Vcb->MediaChangeCount != MediaChangeCount) ||
232 UDFPrint((
"UDFVerifyVolume: compare\n"));
239 NewVcb->TargetDeviceObject =
Vcb->TargetDeviceObject;
254 UDFPrint((
"UDFVerifyVolume: Modified=%d\n",
Vcb->Modified));
260 UDFPrint((
"UDFVerifyVolume: it was very BAD volume. Do not perform Logical check\n"));
261 goto skip_logical_check;
270 NewVcb->WriteBlockSize,
271 5, NewVcb->BlockSizeBits,
273 0, NewVcb->LastPossibleLBA,
Mode,
280 UDFTWriteAsync, UDFTReadAsync,
288 UDFPrint((
"UDFVerifyVolume: Modified=%d\n",
Vcb->Modified));
290 UDFPrint((
" NewVcb->NSRDesc=%x\n", NewVcb->NSRDesc));
295 UDFPrint((
"UDFVerifyVolume: both are RAW -> remount\n",
Vcb->Modified));
297 goto skip_logical_check;
311 UDFPrint((
"UDFVerifyVolume: Modified=%d\n",
Vcb->Modified));
323 UDFPrint((
"UDFVerifyVolume: compared\n"));
324 UDFPrint((
"UDFVerifyVolume: Modified=%d\n",
Vcb->Modified));
326 UDFPrint((
"UDFVerifyVolume: set UDF_VCB_FLAGS_VOLUME_MOUNTED\n"));
338 Vcb->MediaChangeCount = MediaChangeCount;
342 UDFPrint((
"UDFVerifyVolume: clear UDF_VCB_FLAGS_VOLUME_MOUNTED\n"));
343 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_VOLUME_MOUNTED;
346 if(
Vcb->EjectWaiter) {
355 UDFPrint((
" !!! VerifyVolume - QUICK REMOUNT !!!\n"));
358 if(!CacheInitialized) {
361 Vcb->WCacheMaxFrames,
362 Vcb->WCacheMaxBlocks,
364 5,
Vcb->BlockSizeBits,
365 Vcb->WCacheBlocksPerFrameSh,
370 Vcb->WCacheFramesToKeepFree,
374 UDFTWriteAsync, UDFTReadAsync,
382 if(!
Vcb->VerifyCtx.VInited) {
388 if(!CacheInitialized) {
393 UDFPrint((
"UDFMountVolume: RAM mode\n"));
396 UDFPrint((
"UDFMountVolume: RW mode\n"));
418 UDFPrint((
"UDFVerifyVolume: try start EjectWaiter\n"));
421 UDFPrint((
"UDFVerifyVolume: start EjectWaiter failed\n"));
422 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_VOLUME_MOUNTED;
430 UDFPrint((
"UDFVerifyVolume: delete NewVcb\n"));
434 ASSERT(!(NewVcb->EjectWaiter));
447 Irp->IoStatus.Information = 0;
449 Irp->IoStatus.Status = RC;
452 UDFPrint((
"UDFVerifyVolume: RC = %x\n", RC));
509 UDFPrint((
"UDFPerformVerify: check\n"));
529 IrpContext->IrpContextFlags &= ~UDF_IRP_CONTEXT_EXCEPTION;
550 UDFPrint((
"UDFPerformVerify: UDFCheckForDismount\n"));
562 UDFPrint((
"UDFPerformVerify: IO_REMOUNT\n"));
579 UDFPrint((
"UDFPerformVerify: check IoIsErrorUserInduced\n"));
584 UDFPrint((
"UDFPerformVerify: UDFNormalizeAndRaiseStatus\n"));
590 if (IrpContext !=
NULL) {
602 UDFPrint((
"UDFPerformVerify: RC = %x\n", RC));
638 ULONG ResidualReferenceCount;
640 UDFPrint((
"UDFCheckForDismount:\n"));
653 (IrpContext->TargetDeviceObject ==
Vcb->TargetDeviceObject)) {
655 ResidualReferenceCount = 2;
659 ResidualReferenceCount = 1;
669 VcbAcquired = VcbAcquired && VcbPresent;
674 }
else if (!(
Vcb->VCBOpenCount)) {
680 if (
Vcb->Vpb->ReferenceCount <= ResidualReferenceCount) {
697 if (!_VcbAcquired && VcbAcquired) {
750 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_BEING_DISMOUNTED;
780 if (!FinalReference) {
800 Vcb->Vpb->Flags &= ~VPB_MOUNTED;
815 }
else if (FinalReference) {
833 Vcb->Vpb->Flags &= ~VPB_MOUNTED;
839 if (NewVpb !=
NULL) {
865#define VCB_NE(x) (OldVcb->x != NewVcb->x)
875 VCB_NE(LastPossibleLBA) ||
896 if((OldVcb->MRWStatus == 0) != (NewVcb->MRWStatus == 0)) {
897 UDFPrint((
" WRONG_VOLUME (4), missmatch MRW status\n"));
899 for(
uint32 i=OldVcb->FirstTrackNum; i<=OldVcb->LastTrackNum;
i++) {
900 if(
VCB_NE(TrackMap[
i].FirstLba) ||
903 VCB_NE(TrackMap[
i].TrackParam) ||
904 VCB_NE(TrackMap[
i].DataParam) ||
906 UDFPrint((
" WRONG_VOLUME (3), missmatch trk %d\n",
i));
919 if(OldVcb->Modified) {
920 UDFPrint((
" Vcb SIMPLE compare on !!!MODIFIED!!! volume\n"));
922 SimpleLogicalCheck =
TRUE;
926 if(!SimpleLogicalCheck && (OldVcb->InitVatCount != NewVcb->InitVatCount)) {
927 UDFPrint((
" InitVatCount %d != %d \n", OldVcb->InitVatCount, NewVcb->InitVatCount));
932 if(OldVcb->VolCreationTime != NewVcb->VolCreationTime) {
933 UDFPrint((
" VolCreationTime %I64x != %I64x \n", OldVcb->VolCreationTime, NewVcb->VolCreationTime));
937 if(OldVcb->SerialNumber != NewVcb->SerialNumber) {
938 UDFPrint((
" SerialNumber %x != %x \n", OldVcb->SerialNumber, NewVcb->SerialNumber));
942 if(!SimpleLogicalCheck &&
944 UDFPrint((
" VolIdent missmatch \n"));
947 if(SimpleLogicalCheck) {
949 UDFPrint((
" SimpleLogicalCheck Ok\n"));
955 UDFPrint((
" Can't open root file, status %x\n", RC));
960 if(!(OldVcb->RootDirFCB)) {
961 UDFPrint((
" !(OldVcb->RootDirFCB)\n"));
969 UDFPrint((
" !UDFCompareFileInfo\n"));
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
uint32 UDFIsBlockAllocated(IN void *_Vcb, IN uint32 Lba)
_Inout_ PIRP _In_ PDEVICE_OBJECT DeviceToVerify
#define CdrwMediaClassEx_IsRAM(MediaClassEx)
#define NT_SUCCESS(StatCode)
_In_ PIO_STACK_LOCATION IrpSp
NTSTATUS UDFExceptionHandler(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
NTSTATUS UDFPostRequest(IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp)
VOID UDFReleaseIrpContext(PtrUDFIrpContext PtrIrpContext)
VOID UDFReleaseVCB(PVCB Vcb)
NTSTATUS UDFWCacheErrorHandler(IN PVOID Context, IN PWCACHE_ERROR_CONTEXT ErrorInfo)
long UDFExceptionFilter(PtrUDFIrpContext PtrIrpContext, PEXCEPTION_POINTERS PtrExceptionPointers)
NTSTATUS NTAPI UDFPhSendIOCTL(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
NTSTATUS NTAPI UDFTSendIOCTL(IN ULONG IoControlCode, IN PVCB Vcb, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
#define UDFReleaseResource(Resource)
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
#define DbgAllocatePoolWithTag(a, b, c)
#define UDFAcquireResourceShared(Resource, CanWait)
#define UDFAcquireResourceExclusive(Resource, CanWait)
IN OUT PVCB IN PDEVICE_OBJECT TargetDeviceObject
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
NTSTATUS UDFStartEjectWaiter(IN PVCB Vcb)
VOID UDFCleanupVCB(IN PVCB Vcb)
VOID UDFCloseResidual(IN PVCB Vcb)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
OSSTATUS UDFGetDiskInfoAndVerify(IN PDEVICE_OBJECT DeviceObject, IN PVCB Vcb)
#define FILE_REMOVABLE_MEDIA
#define IOCTL_STORAGE_CHECK_VERIFY
#define IoCompleteRequest
VOID NTAPI IoSetHardErrorOrVerifyDevice(IN PIRP Irp, IN PDEVICE_OBJECT DeviceObject)
VOID NTAPI IoReleaseVpbSpinLock(IN KIRQL Irql)
NTSTATUS NTAPI IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN AllowRawMount)
VOID NTAPI IoAcquireVpbSpinLock(OUT PKIRQL Irql)
#define STATUS_FILE_INVALID
OSSTATUS UDFTWrite(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T WrittenBytes, IN uint32 Flags)
OSSTATUS UDFTRead(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T ReadBytes, IN uint32 Flags)
OSSTATUS UDFGetDiskInfo(IN PDEVICE_OBJECT DeviceObject, IN PVCB Vcb)
VOID UDFStopEjectWaiter(PVCB Vcb)
OSSTATUS UDFTReadVerify(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T ReadBytes, IN uint32 Flags)
OSSTATUS UDFTWriteVerify(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T WrittenBytes, IN uint32 Flags)
#define _SEH2_EXCEPT(...)
#define _SEH2_GetExceptionInformation()
OSSTATUS UDFVInit(IN PVCB Vcb)
#define UDF_RESIDUAL_REFERENCE
struct _IO_STACK_LOCATION::@3970::@3991 VerifyVolume
PDEVICE_OBJECT DeviceObject
union _IO_STACK_LOCATION::@1575 Parameters
ULONG WCacheFramesToKeepFree
ULONG WCacheBlocksPerFrameSh
struct _DEVICE_OBJECT * DeviceObject
struct _DEVICE_OBJECT * RealDevice
#define RtlZeroMemory(Destination, Length)
#define UDF_VCB_FLAGS_VOLUME_MOUNTED
#define UDF_VCB_FLAGS_REMOVABLE_MEDIA
#define UDF_VCB_FLAGS_VOLUME_LOCKED
#define UDF_VCB_FLAGS_UNSAFE_IOCTL
#define UDF_VCB_FLAGS_VOLUME_READ_ONLY
#define UDF_VCB_FLAGS_RAW_DISK
#define UDF_VCB_FLAGS_MEDIA_READ_ONLY
#define UDF_VCB_FLAGS_BEING_DISMOUNTED
#define UDF_VCB_FLAGS_MEDIA_LOCKED
#define UDF_DATA_FLAGS_BEING_UNLOADED
OSSTATUS UDFOpenRootFile__(IN PVCB Vcb, IN lb_addr *RootLoc, OUT PUDF_FILE_INFO FileInfo)
OSSTATUS UDFUpdateVAT(IN void *_Vcb, IN uint32 Lba, IN uint32 *RelocTab, IN uint32 BCount)
OSSTATUS UDFCloseFile__(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo)
uint32 UDFCleanUpFile__(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo)
BOOLEAN UDFCompareFileInfo(IN PUDF_FILE_INFO f1, IN PUDF_FILE_INFO f2)
#define UDFNtAclSupported(Vcb)
#define VRS_ISO9660_FOUND
#define STATUS_INVALID_PARAMETER
#define STATUS_UNRECOGNIZED_VOLUME
#define STATUS_WRONG_VOLUME
#define STATUS_VERIFY_REQUIRED
#define STATUS_INSUFFICIENT_RESOURCES
#define MOUNT_ERR_THRESHOLD
#define UDFSetFlag(Flag, Value)
#define UDFRaiseStatus(IC, S)
#define UDFClearFlag(Flag, Value)
#define UDFNormalizeAndRaiseStatus(IC, S)
#define UDFIsRawDevice(RC)
NTSTATUS UDFCompareVcb(IN PVCB OldVcb, IN PVCB NewVcb, IN BOOLEAN PhysicalOnly)
BOOLEAN UDFCheckForDismount(IN PtrUDFIrpContext IrpContext, IN PVCB Vcb, IN BOOLEAN _VcbAcquired)
NTSTATUS UDFVerifyVcb(IN PtrUDFIrpContext IrpContext, IN PVCB Vcb)
NTSTATUS UDFPerformVerify(IN PtrUDFIrpContext IrpContext, IN PIRP Irp, IN PDEVICE_OBJECT DeviceToVerify)
BOOLEAN UDFDismountVcb(IN PVCB Vcb, IN BOOLEAN VcbAcquired)
NTSTATUS UDFVerifyVolume(IN PIRP Irp)
VOID WCacheFlushAll__(IN PW_CACHE Cache, IN PVOID Context)
BOOLEAN WCacheIsInitialized__(IN PW_CACHE Cache)
VOID WCacheRelease__(IN PW_CACHE Cache)
OSSTATUS WCacheInit__(IN PW_CACHE Cache, IN ULONG MaxFrames, IN ULONG MaxBlocks, IN SIZE_T MaxBytesToRead, IN ULONG PacketSizeSh, IN ULONG BlockSizeSh, IN ULONG BlocksPerFrameSh, IN lba_t FirstLba, IN lba_t LastLba, IN ULONG Mode, IN ULONG Flags, IN ULONG FramesToKeepFree, IN PWRITE_BLOCK WriteProc, IN PREAD_BLOCK ReadProc, IN PWRITE_BLOCK_ASYNC WriteProcAsync, IN PREAD_BLOCK_ASYNC ReadProcAsync, IN PCHECK_BLOCK CheckUsedProc, IN PUPDATE_RELOC UpdateRelocProc, IN PWC_ERROR_HANDLER ErrorHandlerProc)
OSSTATUS WCacheSetMode__(IN PW_CACHE Cache, IN ULONG Mode)
ULONG WCacheChFlags__(IN PW_CACHE Cache, IN ULONG SetFlags, IN ULONG ClrFlags)
#define WCACHE_RO_BAD_BLOCKS
#define WCACHE_CACHE_WHOLE_PACKET
#define WCACHE_MARK_BAD_BLOCKS
#define WCACHE_DO_NOT_COMPARE
#define WCACHE_CHAINED_IO
#define IoIsErrorUserInduced(Status)
#define IRP_MJ_FILE_SYSTEM_CONTROL
#define IRP_MN_VERIFY_VOLUME
#define SL_ALLOW_RAW_MOUNT
#define IO_DISK_INCREMENT
#define IRP_MN_MOUNT_VOLUME