blob: 6b432636d20ab8fe79a96c1f1922aae42c7f3e90 (
plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
/*
File: ole.h
Copyright (C) 2006 Christophe GRENIER <grenier@cgsecurity.org>
This software is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _OLE_H
#define _OLE_H
#ifdef __cplusplus
extern "C" {
#endif
#define SPECIAL_BLOCK - 3
#define END_OF_CHAIN - 2
#define UNUSED - 1
#define NO_ENTRY 0
#define STORAGE 1
#define STREAM 2
#define ROOT 5
#define SHORT_BLOCK 3
#define FAT_START 0x4c
#define OUR_BLK_SIZE 512
#define DIRS_PER_BLK 4
struct OLE_HDR
{
char magic[8]; /*0*/
char clsid[16]; /*8*/
uint16_t uMinorVersion; /*24*/
uint16_t uDllVersion; /*26*/
uint16_t uByteOrder; /*28*/
uint16_t uSectorShift; /*30*/
uint16_t uMiniSectorShift; /*32*/
uint16_t reserved; /*34*/
uint32_t reserved1; /*36*/
uint32_t csectDir; /*40 Number of sectors in directory chains for 4KB sectors */
uint32_t num_FAT_blocks; /*44*/
uint32_t root_start_block; /*48*/
uint32_t dfsignature; /*52*/
uint32_t miniSectorCutoff; /*56*/
uint32_t MiniFat_block; /*60 first sec in the mini fat chain*/
uint32_t csectMiniFat; /*64 number of sectors in the minifat */
uint32_t FAT_next_block; /*68*/
uint32_t num_extra_FAT_blocks; /*72*/
/* FAT block list starts here !! first 109 entries */
} __attribute__ ((gcc_struct, __packed__));
struct OLE_DIR
{
char name[64]; // 0
uint16_t namsiz; // 64
char type; // 66
char bflags; // 67: 0 or 1
uint32_t prev_dirent; // 68
uint32_t next_dirent; // 72
uint32_t sidChild; // 76
char clsid[16]; // 80
uint32_t userFlags; // 96
int32_t secs1; // 100
int32_t days1; // 104
int32_t secs2; // 108
int32_t days2; // 112
uint32_t start_block; // 116 starting SECT of stream
uint32_t size; // 120
int16_t reserved; // 124 must be 0
int16_t padding; // 126 must be 0
} __attribute__ ((gcc_struct, __packed__));
struct DIRECTORY
{
char name[64];
int32_t type;
int32_t level;
int32_t start_block;
int32_t size;
int32_t next;
int32_t prev;
int32_t dir;
int32_t s1;
int32_t s2;
int32_t d1;
int32_t d2;
};
#ifdef __cplusplus
} /* closing brace for extern "C" */
#endif
#endif
|