Bar file parser
From HowardForums Wiki
bar_file_parser was a custom created tool to extract information from qualcomm .bar files, it is experimental and not to be used for production.
.bar file structure
Here are some notes on the .bar file structure (they are incomplete)
Header
Starts at byte 0
length is variable
byte 0 - byte 5 - same for every file
byte 6 - different - # of objects in the resource file? no
# of unique objects in the resource file? maybe
if there is binary +1
if there is text +1
if there is object(not hex) +1
if it is a hex +1 for each hex
byte 7 - byte 11 - same for every file
byte 12 - different changes based on byte 6
byte 6 byte 12
01 08
02 10
03 18
04 20
05 28
06 30
byte 13 - byte 15 - same
byte 16 - different - changes based on byte 12
byte 16 = byte 12 + 20
byte 12 byte 16
08 28
20 40
30 50
... ...
byte 17 - byte 19 - same
byte 20 - byte 23 - different for every file (# of resources in the file? yes)
byte 24 - byte 27 - different (unknown)
for text resources (and binary, objects(files))
30 + 4* (# text resources - 1)
for 1text 1binary resources - unknown?
for multiple resources unknown what this byte is for
byte 28 - byte 31 - different for all (unknown)
for text resources
size of text all resources (in bytes)
for binary resources
size of all binary resources (in bytes)
for object resources (files,hex)
size of all (in bytes)
for dialog resources
size of all in bytes
for all resources (mix kinds included)
total size of all data in bytes
byte 32 - byte 33 - different between different resources
(first 2 bytes)
text - 01 00 E9 03
binary - 00 50 29 23
object(files,hex) - 06 00 89 13
dialogs - 00 20 71 17
arbitrary - FF FF 01 00
byte 33 - byte 34
(id of resource)
byte 36 - byte 37 - how many ids there are in this bunch, i.e. if id was 1000, and byte 36 was 74, it would be 1000-1074
byte 38 - byte 39 - if above is 0, then this is the id that contains the same text
byte 32 - byte xx
for each resource there is 8 bytes which goes like byte 32-35 and then byte 36-39
but it always starts at byte 32
after the headers for each resource follows the position where each resource starts
like byte 40
byte 40 - different
start of first text resource
start of first binary resource
start of first object resource
start of first dialog resource (not complete
byte 44
start of next text resource
start of next binary resource
start of next object resource
start of next dialog resource (not complete)
every 4 bytes is the start of the next text/binary resource
Size Info - size of complete file including header
last 4 bytes of header
ex. A56F0000 -> 00006FA5 (reverse order)
Item Types (what they are separated by)
0C00 - Object(file)
1C00 - Object(hex)
FFFE - Text
00 - Binary Data
00 - Arbitrary Data
7117 - Dialog?
Arbitrary Data
# items changes length of header
Binary Data
If the same data exists it is only added once to the bar file (but is loaded as two different objects)
