-
Notifications
You must be signed in to change notification settings - Fork 0
/
RKImage.h
76 lines (72 loc) · 2.03 KB
/
RKImage.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef RKIMAGE_HEADER
#define RKIMAGE_HEADER
#include "DefineHeader.h"
#include "RKBoot.h"
#define IMAGE_RESERVED_SIZE 61
#pragma pack(1)
typedef struct {
UINT uiTag;
USHORT usSize;
DWORD dwVersion;
DWORD dwMergeVersion;
STRUCT_RKTIME stReleaseTime;
ENUM_RKDEVICE_TYPE emSupportChip;
DWORD dwBootOffset;
DWORD dwBootSize;
DWORD dwFWOffset;
DWORD dwFWSize;
BYTE reserved[IMAGE_RESERVED_SIZE];
} STRUCT_RKIMAGE_HEAD, *PSTRUCT_RKIMAGE_HEAD;
#pragma pack()
class CRKImage {
public:
UINT GetVersion();
property<CRKImage, UINT, READ_ONLY> Version;
UINT GetMergeVersion();
property<CRKImage, UINT, READ_ONLY> MergeVersion;
STRUCT_RKTIME GetReleaseTime();
property<CRKImage, STRUCT_RKTIME, READ_ONLY> ReleaseTime;
ENUM_RKDEVICE_TYPE GetSupportDevice();
property<CRKImage, ENUM_RKDEVICE_TYPE, READ_ONLY> SupportDevice;
ENUM_OS_TYPE GetOsType();
property<CRKImage, ENUM_OS_TYPE, READ_ONLY> OsType;
unsigned short GetBackupSize();
property<CRKImage, unsigned short, READ_ONLY> BackupSize;
UINT GetBootOffset();
property<CRKImage, UINT, READ_ONLY> BootOffset;
UINT GetBootSize();
property<CRKImage, UINT, READ_ONLY> BootSize;
UINT GetFWOffset();
property<CRKImage, UINT, READ_ONLY> FWOffset;
long long GetFWSize();
property<CRKImage, long long, READ_ONLY> FWSize;
bool GetSignFlag();
property<CRKImage, bool, READ_ONLY> SignFlag;
CRKBoot *m_bootObject;
bool SaveBootFile(string filename);
bool SaveFWFile(string filename);
bool GetData(long long dwOffset, DWORD dwSize, PBYTE lpBuffer);
void GetReservedData(PBYTE &lpData, USHORT &usSize);
int GetMd5Data(PBYTE &lpMd5, PBYTE &lpSignMd5);
long long GetImageSize();
CRKImage(string filename, bool &bCheck);
~CRKImage();
protected:
private:
DWORD m_version;
DWORD m_mergeVersion;
STRUCT_RKTIME m_releaseTime;
ENUM_RKDEVICE_TYPE m_supportDevice;
DWORD m_bootOffset;
DWORD m_bootSize;
DWORD m_fwOffset;
long long m_fwSize;
BYTE m_md5[32];
BYTE m_signMd5[256];
BYTE m_reserved[IMAGE_RESERVED_SIZE];
bool m_bSignFlag;
int m_signMd5Size;
FILE *m_pFile;
long long m_fileSize;
};
#endif