ReactOS 0.4.16-dev-1946-g52006dd
iso.h File Reference
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for iso.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DIR_RECORD
 
struct  _VD_HEADER
 
struct  _PVD
 
struct  _ISO_FILE_INFO
 

Macros

#define ISO_ATTR_HIDDEN   0x01
 
#define ISO_ATTR_DIRECTORY   0x02
 
#define ISO_ATTR_ASSOC   0x04
 
#define ISO_ATTR_MULTI   0x80
 

Typedefs

typedef struct _DIR_RECORD DIR_RECORD
 
typedef struct _DIR_RECORDPDIR_RECORD
 
typedef struct _VD_HEADER VD_HEADER
 
typedef struct _VD_HEADERPVD_HEADER
 
typedef struct _PVD PVD
 
typedef struct _PVDPPVD
 
typedef struct _ISO_FILE_INFO ISO_FILE_INFO
 
typedef struct _ISO_FILE_INFOPISO_FILE_INFO
 

Functions

ULONGLONG IsoGetVolumeSize (_In_ ULONG DeviceId)
 Returns the size of the ISO-9660 volume laid on the storage media device opened via DeviceId.
 
const DEVVTBLIsoMount (ULONG DeviceId)
 

Macro Definition Documentation

◆ ISO_ATTR_ASSOC

#define ISO_ATTR_ASSOC   0x04

Definition at line 94 of file iso.h.

◆ ISO_ATTR_DIRECTORY

#define ISO_ATTR_DIRECTORY   0x02

Definition at line 93 of file iso.h.

◆ ISO_ATTR_HIDDEN

#define ISO_ATTR_HIDDEN   0x01

Definition at line 92 of file iso.h.

◆ ISO_ATTR_MULTI

#define ISO_ATTR_MULTI   0x80

Definition at line 95 of file iso.h.

Typedef Documentation

◆ DIR_RECORD

◆ ISO_FILE_INFO

◆ PDIR_RECORD

◆ PISO_FILE_INFO

◆ PPVD

typedef struct _PVD * PPVD

◆ PVD

typedef struct _PVD PVD

◆ PVD_HEADER

◆ VD_HEADER

Function Documentation

◆ IsoGetVolumeSize()

ULONGLONG IsoGetVolumeSize ( _In_ ULONG  DeviceId)

Returns the size of the ISO-9660 volume laid on the storage media device opened via DeviceId.

This routine is in particular used to determine the useful (volume) size of a CD-ROM media.

Definition at line 583 of file iso.c.

585{
587 ASSERT(Volume);
588 return (ULONGLONG)Volume->VolumeSizeLBN * Volume->LogicalBlockSize;
589}
static PISO_VOLUME_INFO IsoVolumes[MAX_FDS]
Definition: iso.c:44
UNICODE_STRING Volume
Definition: fltkernel.h:1172
#define ASSERT(a)
Definition: mode.c:44
uint64_t ULONGLONG
Definition: typedefs.h:67

Referenced by FsGetVolumeSize().

◆ IsoMount()

const DEVVTBL * IsoMount ( ULONG  DeviceId)

Definition at line 602 of file iso.c.

603{
605 PPVD Pvd = (PPVD)Buffer;
607 ULONG Count;
610
611 TRACE("Enter IsoMount(%lu)\n", DeviceId);
612
613 /* Read the ISO Primary Volume Descriptor */
614 Position.QuadPart = 16 * SECTORSIZE;
615 Status = ArcSeek(DeviceId, &Position, SeekAbsolute);
616 if (Status != ESUCCESS)
617 return NULL;
618 Status = ArcRead(DeviceId, Pvd, SECTORSIZE, &Count);
619 if (Status != ESUCCESS || Count < sizeof(PVD))
620 return NULL;
621
622 /* Check whether the PVD is valid */
623 if (!(Pvd->VdType == 1 && RtlEqualMemory(Pvd->StandardId, "CD001", 5) && Pvd->VdVersion == 1))
624 {
625 WARN("Unrecognized CD-ROM format\n");
626 return NULL;
627 }
628 if (Pvd->LogicalBlockSizeL != SECTORSIZE)
629 {
630 ERR("Unsupported LogicalBlockSize %u\n", Pvd->LogicalBlockSizeL);
631 return NULL;
632 }
633
634 Count = (ULONG)((ULONGLONG)Pvd->VolumeSpaceSizeL * SECTORSIZE / 1024 / 1024);
635 TRACE("Recognized ISO9660 drive, size %lu MB (%lu sectors)\n",
636 Count, Pvd->VolumeSpaceSizeL);
637
639 if (!Volume)
640 return NULL;
641 RtlZeroMemory(Volume, sizeof(*Volume));
642
643 /*
644 * This is equivalent to using the RAW_ISO_VD::VolSpaceI field:
645 * https://github.com/reactos/reactos/blob/435482912c6dc0aaa4371e37b7336b2b1291e65f/drivers/filesystems/cdfs/cd.h#L126
646 * and also what MS CDFS does with the CdRvdVolSz() macro,
647 * in cdfs/strucsup.c!CdUpdateVcbFromVolDescriptor().
648 */
649 Volume->VolumeSizeLBN = Pvd->VolumeSpaceSizeL;
650 Volume->LogicalBlockSize = Pvd->LogicalBlockSizeL;
651
652 /* Cache some useful PVD information */
653 Volume->PvdDirectorySector = Pvd->RootDirRecord.ExtentLocationL;
654 Volume->PvdDirectoryLength = Pvd->RootDirRecord.DataLengthL;
655
656 IsoVolumes[DeviceId] = Volume;
657
658 /* Everything OK, return the ISO9660 function table */
659 return &Iso9660FuncTable;
660}
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
ARC_STATUS ArcSeek(ULONG FileId, LARGE_INTEGER *Position, SEEKMODE SeekMode)
Definition: fs.c:455
ARC_STATUS ArcRead(ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
Definition: fs.c:448
PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: heap.c:545
#define SECTORSIZE
Definition: iso.c:27
#define TAG_ISO_VOLUME
Definition: iso.c:28
static const DEVVTBL Iso9660FuncTable
Definition: iso.c:592
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
Status
Definition: gdiplustypes.h:25
struct _PVD * PPVD
#define RtlEqualMemory(dst, src, len)
Definition: kdvm.h:18
int Count
Definition: noreturn.cpp:7
@ ESUCCESS
Definition: arc.h:32
ULONG ARC_STATUS
Definition: arc.h:4
@ SeekAbsolute
Definition: arc.h:59
#define TRACE(s)
Definition: solgame.cpp:4
ULONG ExtentLocationL
Definition: iso.h:27
ULONG DataLengthL
Definition: iso.h:29
Definition: iso.h:61
DIR_RECORD RootDirRecord
Definition: iso.h:84
USHORT LogicalBlockSizeL
Definition: iso.h:76
ULONG VolumeSpaceSizeL
Definition: iso.h:69
UCHAR StandardId[5]
Definition: iso.h:63
UCHAR VdType
Definition: iso.h:62
UCHAR VdVersion
Definition: iso.h:64
static COORD Position
Definition: mouse.c:34
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: xmlstorage.h:181