Exemplo n.º 1
0
static int UDFPartition( quint8 *data, quint16 *Flags, quint16 *Number,
                         char *Contents, quint32 *Start, quint32 *Length )
{
  *Flags = GETN2(20);
  *Number = GETN2(22);
  GETN(24, 32, Contents);
  *Start = GETN4(188);
  *Length = GETN4(192);
  return 0;
}
Exemplo n.º 2
0
static int UDFPartition( uint8_t *data, uint16_t *Flags, uint16_t *Number,
                         char *Contents, uint32_t *Start, uint32_t *Length )
{
  *Flags = GETN2(20);
  *Number = GETN2(22);
  GETN(24, 32, Contents);
  *Start = GETN4(188);
  *Length = GETN4(192);
  return 0;
}
Exemplo n.º 3
0
static int UDFExtAD( uint8_t *data, struct AD *ad )
{
  ad->Length = GETN4(0);
  ad->Flags = ad->Length >> 30;
  ad->Length &= 0x3FFFFFFF;
  ad->Location = GETN4(12);
  ad->Partition = GETN2(16);
  /* GETN(10, 6, Use); */
  return 0;
}
Exemplo n.º 4
0
static int UDFExtAD( uint8_t *data, struct AD *ad )
{
  uint32_t leng = GETN4(0);
  ad->Flags = leng >> 30;
  ad->Length = (leng & 0x3FFFFFFF);
  ad->Location = GETN4(12);
  ad->Partition = GETN2(16);
  /* GETN(10, 6, Use); */
  return 0;
}
Exemplo n.º 5
0
static int UDFLongAD( uint8_t *data, struct AD *ad )
{
  ad->Length = GETN4(0);
  ad->Flags = ad->Length >> 30;
  ad->Length &= 0x3FFFFFFF;
  ad->Location = GETN4(4);
  ad->Partition = GETN2(8);
  //GETN(10, 6, Use);
  return 0;
}
Exemplo n.º 6
0
static int UDFFileIdentifier( uint8_t *data, uint8_t *FileCharacteristics,
                              char *FileName, struct AD *FileICB )
{
  uint8_t L_FI;
  uint16_t L_IU;

  *FileCharacteristics = GETN1(18);
  L_FI = GETN1(19);
  UDFLongAD(&data[20], FileICB);
  L_IU = GETN2(36);
  if (L_FI) Unicodedecode(&data[38 + L_IU], L_FI, FileName);
  else FileName[0] = '\0';
  return 4 * ((38 + L_FI + L_IU + 3) / 4);
}
Exemplo n.º 7
0
int main(int argc, char **argv)
{
    int i;
    int fd;
    char buffer[2048], *str;
    uint16_t TagID;

    if (argc != 2) exit(2);

    fd = open(argv[1], O_RDONLY);
    if (fd < 0) exit(3);

    for (i = 0; i < 20000; i++) {
        if (read(fd, buffer, 2048) != 2048) break;

        TagID = GETN2(0);

        str = TagIDStr(TagID);
        if (str) printf("Block %3d TagID: %s\n", i, str);

    }
    close(fd);
}
Exemplo n.º 8
0
static int UDFICB( uint8_t *data, uint8_t *FileType, uint16_t *Flags )
{
  *FileType = GETN1(11);
  *Flags = GETN2(18);
  return 0;
}
Exemplo n.º 9
0
static int UDFDescriptor( uint8_t *data, uint16_t *TagID )
{
  *TagID = GETN2(0);
  /* TODO: check CRC 'n stuff */
  return 0;
}
Exemplo n.º 10
0
/**
 * Reads the volume descriptor and checks the parameters.  Returns 0 on OK, 1
 * on error.
 */
static int UDFLogVolume( uint8_t *data, struct Volume *vol)
{
  uint32_t MT_L, N_PM, volume;
  uint32_t ii, type, length, pos;
  struct PartitionMaps *maps;
  volume = GETN4(16);
  Unicodedecode(&data[84], 128, vol->VolumeDesc);
  vol->BlockSize = GETN4(212);  /* should be 2048 */
  memset((void *)&vol->FSD, 0, sizeof(struct AD));
  UDFLongAD(&data[248], &vol->FSD);
  //printf("File Set Descriptor: block: %d, part: %d\n", vol->FSD.Location, vol->FSD.Partition);
  MT_L = GETN4(264);    /* should be 6 */
  N_PM = GETN4(268);    /* should be 1 */
  vol->MapNum = N_PM;
  if ((N_PM >= 1) && (vol->Maps == NULL))
  {
	  vol->Maps = (struct PartitionMaps *)calloc(1, sizeof(struct PartitionMaps) * N_PM);
  }
  UDFExtentAD( &data[432], &vol->Length, &vol->Location);
  //printf("location: %d, length: %d\n", vol->Location, vol->Length);
  pos = 440;
  for (ii = 0; ii < N_PM; ii++)
  {
	  maps = &vol->Maps[ii];
	  type = GETN1(pos);
	  length = GETN1(pos+1);
	  if (type == 1)
	  {
		  maps->MapType = UDF_TYPE1_MAP15;
		  maps->VolSequenNum = GETN2(pos+2);
		  maps->PartitionNum = GETN2(pos+4);
	  }
	  else if (type == 2)
	  {
		  struct EntityIdentifier ident;
		  uint32_t version;
		  UDFEntIdentifier(&data[pos+4], &ident);
		  version = ((uint16_t)ident.indetifierSuffix[1] << 8) | (uint16_t)(ident.indetifierSuffix[0]);
		  //printf("identifier: '%s', version: %04x\n", ident.identifier, version);
		  if (strncmp(ident.identifier, UDF_ID_VIRTUAL, strlen(UDF_ID_VIRTUAL)) == 0)
		  {
			  if (version < 0x0200)
				  maps->MapType = UDF_VIRTUAL_MAP15;
			  else
				  maps->MapType = UDF_VIRTUAL_MAP20;
		  }
		  else if (strncmp(ident.identifier, UDF_ID_SPARABLE, strlen(UDF_ID_SPARABLE)) == 0)
		  {
			  maps->MapType = UDF_SPARABLE_MAP15;
		  }
		  else if (strncmp(ident.identifier, UDF_ID_METADATA, strlen(UDF_ID_METADATA)) == 0)
		  {
			  maps->MapType = UDF_METADATA_MAP25;
		  }

		  maps->VolSequenNum = GETN2(pos+36);
		  maps->PartitionNum = GETN2(pos+38);
		  maps->mdata.meta_file_loc = GETN4(pos+40);
		  maps->mdata.mirror_file_loc = GETN4(pos+44);
		  maps->mdata.bitmap_file_loc = GETN4(pos+48);
		  maps->mdata.alloc_unit_size = GETN4(pos+52);
		  maps->mdata.alig_unit_size = GETN2(pos+56);
		  maps->mdata.flags = data[pos+58];
		  //printf("meta_loc: %u, mirr_loc: %u, bit_loc: %u, alloc_unit: %u, alig_unit: %hu, flags: %hhu\n", maps->mdata.meta_file_loc, maps->mdata.mirror_file_loc, maps->mdata.bitmap_file_loc, maps->mdata.alloc_unit_size, maps->mdata.alig_unit_size, maps->mdata.flags);
	  }
	  //printf("Volume Sequence Number: %hu, Partition Number: %hu\n", maps->VolSequenNum, maps->PartitionNum);
	  pos += length;
  }
  //printf("volume: %d, MT_L: %d, N_PM: %d\n", volume, MT_L, N_PM);
  if (vol->BlockSize != DVD_VIDEO_LB_LEN) return 1;
  return 0;
}
Exemplo n.º 11
0
static int UDFICB( quint8 *data, quint8 *FileType, quint16 *Flags )
{
  *FileType = GETN1(11);
  *Flags = GETN2(18);
  return 0;
}