-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPocketBookUpdate.h
58 lines (48 loc) · 998 Bytes
/
PocketBookUpdate.h
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
#ifndef POCKETBOOK_UPDATE_H
#define POCKETBOOK_UPDATE_H
#include <string>
#include <map>
#include <stdint.h>
enum PartitionType
{
SWUPDATE_TAR_GZ = 0x73,
ELF_IMG = 0x40,
APP_IMG = 0x65,
ROOTFS_IMG = 0x72,
A_IMG = 0x61
};
struct FWPart
{
uint32_t type;
uint32_t reserved;
uint32_t offset;
uint32_t size;
};
struct PocketBookUpdateHeader
{
char magic[0x10];
char model[0x20];
char unknownBuffer1[0x50];
char padding1[0x40];
uint32_t unknownUInt32;
char padding2[0x3C];
FWPart fwParts[0x30];
};
class PocketBookUpdate
{
char *buffer;
PocketBookUpdateHeader * header;
std::string mFilename;
std::map<PartitionType, const char*> partsNames;
std::map<std::string, FWPart> parts;
public:
PocketBookUpdate(const char *filename);
virtual ~PocketBookUpdate();
void extract(const char* outputDir);
void print();
private:
int printField(unsigned i);
int printField(unsigned offset, unsigned size, const char* name);
int printParts();
};
#endif