Detailed parsing of IOS device itunescdb files (i)

Source: Internet
Author: User

IOS Mobile device has a media database file, this file holds the current device media information, such as music, video, e-book, Ringtones and so on, are kept here, nonsense not to say more


ITUNESCDB is a binary file, which is organized with nodes, each node contains specific information, such as node type, nod size, number of child nodes, and so on. It's kind of like XML, but unlike XML, XML is closed.



Open this file with the binary editor to see


MHBD Head

The first four bytes of the binary file mhbd is an identity, according to the specific identity of the different parsing, when the resolution as long as the care of their own needs of the field, the other do not understand the field read out and save it. Here's a look at the fields I'm interested in when I parse

1) 4-byte header ID MHBD

2) 4 bytes of head length

3) Total length of 4 bytes

If you are parsing, just pay attention to these three fields.

M_stridentify = binaryreader.readstring (4);
Validateheader ("MHBD");
M_iheadsize = Binaryreader.readint32 ();
int itotalsize = Binaryreader.readint32 ();

ITUNESCDB file is from the beginning of the MHBD header, MHBD section to save the real media data, but this section of the data is compressed, that is, after the zip compression, so to parse the words must first read out, Then unzip it with a zip to restore the data. How to read section content

int isectionsize = itotalsize- m_iheadsize//Get the length of section

Binaryreader.seek (m_iheadsize, Seek_set); Move the file pointer to the beginning of the section
byte* pdatabuffer = new byte[isectionsize];
Binaryreader.read (pdatabuffer,isectionsize); Read the section


After reading it, unzip it with zip to restore the data. There's time to go on back.



qq:2506314894







Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.