19#if defined(_WIN32) || defined(_WIN64)
516 if(extent_a->
start < extent_b->
start)
return -1;
517 if(extent_a->
start > extent_b->
start)
return 1;
534 if(buffer == NULL || length == 0)
return;
536#if defined(_WIN32) || defined(_WIN64)
538 HCRYPTPROV hCryptProv;
539 if(CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
541 CryptGenRandom(hCryptProv, (DWORD)length, buffer);
542 CryptReleaseContext(hCryptProv, 0);
547 FILE *urandom = fopen(
"/dev/urandom",
"rb");
550 size_t bytes_read = fread(buffer, 1, length, urandom);
552 if(bytes_read == length)
return;
558 srand((
unsigned int)time(NULL));
559 for(
size_t i = 0; i < length; i++) { buffer[i] = (uint8_t)(rand() % 256); }
Public high-level API types: media classifications, per-sector / per-media tag enums and image summar...
@ OpticalDisc
Purely optical discs.
@ BlockMedia
Media that is physically block-based or abstracted like that.
@ kDataTypeAacsLbaExtents
AACS LBA extents.
@ kDataTypeExtendedCsd
MultiMediaCard Extended CSD register.
@ kDataTypeCdMcn
Compact Disc Media Catalogue Number (lead‑in, 13 ASCII bytes).
@ kDataTypeMmcCsd
MultiMediaCard CSD register.
@ kDataTypeMmcCid
MultiMediaCard CID register.
@ kDataTypeBlurayDi
Blu-ray Disc Information (DI).
@ kDataTypeUsbDescriptors
USB descriptors set.
@ kDataTypeDiscControlBlock
DVD Disc Control Block.
@ kDataTypeAacsVolumeUniqueKey
AACS Volume Unique Key.
@ kDataTypeCdFirstTrackPregap
Compact Disc first track pre-gap.
@ kDataTypeBlurayDds
Blu-ray Disc Definition Structure (DDS).
@ kDataTypeBluraySpareArea
Blu-ray spare area information.
@ kDataTypeXboxSecuritySector
Xbox Security Sector.
@ kDataTypeDvdDiscKey
DVD disc key.
@ kDataTypeHddvdMediumStatus
HD DVD medium status.
@ kDataTypeWiiUDiscKey
Nintendo Wii U disc key (16 bytes, from non-readable disc area).
@ kDataTypeWiiPartitionKeyMap
Nintendo Wii partition-to-key mapping with regions.
@ kDataTypeSdCsd
Secure Digital CSD register.
@ kDataTypeCdText
Compact Disc lead-in CD-Text.
@ kDataTypeAacsMediaIdentifier
AACS media identifier.
@ kDataTypeBlurayCartridgeStatus
Blu-ray cartridge status.
@ kDataTypeNgcwJunkMap
Nintendo GameCube/Wii junk region map with LFG seeds.
@ kDataTypePs3EncryptionMap
PS3 encryption region map (serialized from sector 0).
@ kDataTypeAacsMkb
AACS Media Key Block (MKB).
@ kDataTypeDvddlLayerCapacity
DVD dual-layer capacity.
@ kDataTypeDvdMkb
DVD Media Key Block (MKB).
@ kDataTypeDvdCmi
DVD lead-in Copyright Management Information (CMI).
@ kDataTypeMmcDiscInformation
MMC disc information.
@ kDataTypeDvdRamSpareArea
DVD-RAM spare area information.
@ kDataTypeDvddlMiddleZoneAddress
DVD dual-layer middle zone address.
@ kDataTypePs3Data1
PS3 data1 key (16 bytes, from disc).
@ kDataTypeXboxDmi
Xbox DMI.
@ kDataTypeWiiUPartitionKeyMap
Nintendo Wii U partition-to-key mapping with regions.
@ kDataTypeSdOcr
Secure Digital OCR register.
@ kDataTypeScsiModeSense6
SCSI MODE SENSE (6) response.
@ kDataTypeDvddlJumpIntervalSize
DVD dual-layer jump interval size.
@ kDataTypeCdPma
Compact Disc Power Management Area (PMA).
@ kDataTypePs3Pic
PS3 PIC data (115 bytes, from disc lead-in).
@ kDataTypeMmcOcr
MultiMediaCard OCR register.
@ kDataTypeSessionInfo
Compact Disc session information.
@ kDataTypeDvdPfi2ndLayer
DVD Physical Format Information for the second layer.
@ kDataTypePcmciaCis
PCMCIA Card Information Structure (CIS).
@ kDataTypeFullToc
Compact Disc full Table of Contents.
@ kDataTypeDvdMediaIdentifier
DVD media identifier.
@ kDataTypeAtaIdentify
ATA IDENTIFY DEVICE data.
@ kDataTypeCdLeadIn
Compact Disc lead‑in.
@ kDataTypeAacsDataKeys
AACS data keys.
@ kDataTypeSdScr
Secure Digital SCR register.
@ kDataTypeDvdrRmd
DVD-R RMD (Recording Management Data).
@ kDataTypeDvdRamDds
DVD-RAM Disc Definition Structure (DDS).
@ kDataTypeDvdDmi
DVD Disc Manufacturing Information (DMI).
@ kDataTypeAacsMediaKey
AACS Media Key.
@ kDataTypeMmcTrackResourcesInformation
MMC track resources information.
@ kDataTypePs3Data2
PS3 data2 key (16 bytes, from disc).
@ kDataTypeMmcWriteProtection
MMC write-protection data.
@ kDataTypeDvddlManualLayerJumpLba
DVD dual-layer manual layer jump LBA.
@ kDataTypeXboxPfi
Xbox Physical Format Information (PFI).
@ kDataTypeDvdAdip
DVD Address In Pregroove (ADIP).
@ kDataTypeMmcPowResourcesInformation
MMC POW (Persistent Optical Write?) resources information.
@ kDataTypeDvdrMediaIdentifier
DVD-R media identifier.
@ kDataTypeAacsVolumeIdentifier
AACS volume identifier.
@ kDataTypeCprmMkb
CPRM Media Key Block (MKB).
@ kDataTypeDvdPfi
DVD Physical Format Information.
@ kDataTypeScsiModeSense10
SCSI MODE SENSE (10) response.
@ kDataTypeScsiInquiry
SCSI INQUIRY response.
@ kDataTypePs3DiscKey
PS3 derived disc key (16 bytes).
@ kDataTypeAacsSerialNumber
AACS serial number.
@ kDataTypeCdAtip
Compact Disc Absolute Time In Pregroove (ATIP).
@ kDataTypeDvdrPfi
DVD-R Physical Format Information.
@ kDataTypeCdToc
Compact Disc partial Table of Contents.
@ kDataTypeDvdRamMediumStatus
DVD-RAM medium status.
@ kDataTypeFloppyWriteProtect
Floppy write-protect status.
@ kDataTypeScsiModePage2A
SCSI MODE PAGE 2Ah.
@ kDataTypeHybridRecognizedLayers
Recognized layers (hybrid media).
@ kDataTypeBlurayBca
Blu-ray Burst Cutting Area (BCA).
@ kDataTypeHddvdCpi
HD DVD Copy Protection Information (CPI).
@ kDataTypeCdLeadOut
Compact Disc lead‑out.
@ kDataTypeDvdBca
DVD Burst Cutting Area (BCA).
@ kDataTypeFloppyLeadOut
Floppy lead‑out data.
@ kDataTypeAtapiIdentify
ATAPI IDENTIFY PACKET DEVICE data.
@ kDataTypeSdCid
Secure Digital CID register.
@ kDataTypeDvdDiscKeyDecrypted
Decrypted DVD Disc Key.
@ kDataTypeDvdrPreRecordedInfo
DVD-R pre‑recorded information.
int32_t aaruf_get_datatype_for_media_tag_type(const int32_t tag_type)
Converts an Aaru media tag type to an image data type.
void generate_random_bytes(uint8_t *buffer, size_t length)
Generates cryptographically strong random bytes.
int32_t aaruf_get_media_tag_type_for_datatype(const int32_t type)
Converts an image data type to an Aaru media tag type.
int32_t aaruf_get_xml_mediatype(const int32_t type)
int compare_extents(const void *a, const void *b)
Comparison function for sorting DumpExtent arrays by start sector.
Inclusive [start,end] logical sector range contributed by a single hardware environment.
uint64_t start
Starting LBA (inclusive).