1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*
* ftab.h
* Functions for handling the ftab format
*
* Copyright (c) 2019 Nikias Bassen. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef IDEVICERESTORE_FTAB_H
#define IDEVICERESTORE_FTAB_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
struct ftab_header {
uint32_t always_01; // 1
uint32_t always_ff; // 0xFFFFFFFF
uint32_t unk_0x08; // 0
uint32_t unk_0x0C; // 0
uint32_t unk_0x10; // 0
uint32_t unk_0x14; // 0
uint32_t unk_0x18; // 0
uint32_t unk_0x1C; // 0
uint32_t tag; // e.g. 'rkos'
uint32_t magic; // 'ftab' magic
uint32_t num_entries;
uint32_t pad_0x2C;
};
struct ftab_entry {
uint32_t tag;
uint32_t offset;
uint32_t size;
uint32_t pad_0x0C;
};
struct ftab_fmt {
struct ftab_header header;
struct ftab_entry *entries;
unsigned char **storage;
};
typedef struct ftab_fmt *ftab_t;
int ftab_parse(unsigned char *data, unsigned int data_size, ftab_t *ftab, uint32_t *tag);
int ftab_get_entry_ptr(ftab_t ftab, uint32_t tag, unsigned char **data, unsigned int *data_size);
int ftab_add_entry(ftab_t ftab, uint32_t tag, unsigned char *data, unsigned int data_size);
int ftab_write(ftab_t ftab, unsigned char **data, unsigned int *data_size);
int ftab_free(ftab_t ftab);
#ifdef __cplusplus
}
#endif
#endif
|