annotate FILE-FORMAT @ 11:bf12a9d4524c

more code cleanup
author carl
date Fri, 17 Feb 2006 22:48:32 -0800
parents 6b1b602514db
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6b1b602514db Initial revision
carl
parents:
diff changeset
1 File format for Outlook pst files
6b1b602514db Initial revision
carl
parents:
diff changeset
2 =================================
6b1b602514db Initial revision
carl
parents:
diff changeset
3
6b1b602514db Initial revision
carl
parents:
diff changeset
4 Basically, we work on two indexes. One index associates an ID with each item, and the second index associates a second ID with the original ID. I see no real purpose for this yet.
6b1b602514db Initial revision
carl
parents:
diff changeset
5
6b1b602514db Initial revision
carl
parents:
diff changeset
6 0x00 - Signature [4 bytes] (0x4E444221)
6b1b602514db Initial revision
carl
parents:
diff changeset
7 0xA8 - File Size [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
8 0xC4 - Pointer to Index of all Items in File, associating the first ID [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
9 0xBC - Pointer to Index of controlling Items in File [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
10
6b1b602514db Initial revision
carl
parents:
diff changeset
11 First All Items Index: - constists of a table of offsets pointing to the table of items.
6b1b602514db Initial revision
carl
parents:
diff changeset
12 ======================
6b1b602514db Initial revision
carl
parents:
diff changeset
13 repeating:
6b1b602514db Initial revision
carl
parents:
diff changeset
14 0x0 - First id in this table [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
15 0x04 - Unknown [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
16 0x08 - Offset of table [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
17
6b1b602514db Initial revision
carl
parents:
diff changeset
18 until "First id in this table" is zero
6b1b602514db Initial revision
carl
parents:
diff changeset
19
6b1b602514db Initial revision
carl
parents:
diff changeset
20 Table Of Items: - Pointed to by above records.
6b1b602514db Initial revision
carl
parents:
diff changeset
21 ===============
6b1b602514db Initial revision
carl
parents:
diff changeset
22 repeating:
6b1b602514db Initial revision
carl
parents:
diff changeset
23 0x0 - Id1 of this item [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
24 0x04 - Offset of this item [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
25 0x08 - Size of data stored there [2 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
26 0x0A - Unknown [2 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
27
6b1b602514db Initial revision
carl
parents:
diff changeset
28 until "Id1 of this item" is zero. When this is reached, you return to the above table and read the next record
6b1b602514db Initial revision
carl
parents:
diff changeset
29
6b1b602514db Initial revision
carl
parents:
diff changeset
30 Second All Items Index: - Contains the descriptors for emails, and other items
6b1b602514db Initial revision
carl
parents:
diff changeset
31 =======================
6b1b602514db Initial revision
carl
parents:
diff changeset
32 repeating:
6b1b602514db Initial revision
carl
parents:
diff changeset
33 0x0 - First id2 of this table [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
34 0x04 - Unknown [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
35 0x08 - Offset of table [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
36
6b1b602514db Initial revision
carl
parents:
diff changeset
37 until "First id2 of this table" is zero
6b1b602514db Initial revision
carl
parents:
diff changeset
38
6b1b602514db Initial revision
carl
parents:
diff changeset
39 Second Table of Items: - Pointed to by above records
6b1b602514db Initial revision
carl
parents:
diff changeset
40 ======================
6b1b602514db Initial revision
carl
parents:
diff changeset
41 repeats 0x1F times
6b1b602514db Initial revision
carl
parents:
diff changeset
42 0x0 - Id2 of this item [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
43 0x04 - Id1 of the descriptor item [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
44 0x08 - Id1 of the associated list [4 bytes] (this contains a list of id1 and id2 that are to with this controlling item)
6b1b602514db Initial revision
carl
parents:
diff changeset
45 0x0C - Id2 of parent [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
46
6b1b602514db Initial revision
carl
parents:
diff changeset
47
6b1b602514db Initial revision
carl
parents:
diff changeset
48 Associated List: - pointed to by the above record. Contains associations between id1 and id2 for the items controlled by the record
6b1b602514db Initial revision
carl
parents:
diff changeset
49 ================
6b1b602514db Initial revision
carl
parents:
diff changeset
50 0x0 - Constant [2 bytes] (0x0002)
6b1b602514db Initial revision
carl
parents:
diff changeset
51 0x02 - Count [2 bytes] (the number of items that are about to follow)
6b1b602514db Initial revision
carl
parents:
diff changeset
52
6b1b602514db Initial revision
carl
parents:
diff changeset
53 repeating
6b1b602514db Initial revision
carl
parents:
diff changeset
54 0x0 - Id2 of record [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
55 0x04 - Id of record [4 bytes] - This is an association between the two
6b1b602514db Initial revision
carl
parents:
diff changeset
56 0x08 - Unknown [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
57 until you have reached the "Count"
6b1b602514db Initial revision
carl
parents:
diff changeset
58
6b1b602514db Initial revision
carl
parents:
diff changeset
59
6b1b602514db Initial revision
carl
parents:
diff changeset
60 Descriptor Item: - Referenced from "Second Table of Items" - contains information about the item (email, contact...)
6b1b602514db Initial revision
carl
parents:
diff changeset
61 ================
6b1b602514db Initial revision
carl
parents:
diff changeset
62 0x0 - Block Offset to Block Index [2 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
63 0x02 - Constant [2 bytes] (0xBCEC)
6b1b602514db Initial revision
carl
parents:
diff changeset
64 0x04 - Index Pos of Section1 [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
65
6b1b602514db Initial revision
carl
parents:
diff changeset
66 NOTE: An index pos can be shifted left 4 times [ i_pos << 4 ] to get an index offset (ie, an offset from the start of the block index)
6b1b602514db Initial revision
carl
parents:
diff changeset
67
6b1b602514db Initial revision
carl
parents:
diff changeset
68
6b1b602514db Initial revision
carl
parents:
diff changeset
69 Block Index: - contains offsets to points in the current block
6b1b602514db Initial revision
carl
parents:
diff changeset
70 ============
6b1b602514db Initial revision
carl
parents:
diff changeset
71 0x0 - Count of offsets minus one. [2 bytes] (In effect, each offset must be taken with the following one so that the start and end of the referenced item can be established. Therefore there is one extra to show the end of the last item.)
6b1b602514db Initial revision
carl
parents:
diff changeset
72
6b1b602514db Initial revision
carl
parents:
diff changeset
73 repeating
6b1b602514db Initial revision
carl
parents:
diff changeset
74 0x0 - Block Offset [2 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
75 until you have one extra than the "Count"
6b1b602514db Initial revision
carl
parents:
diff changeset
76
6b1b602514db Initial revision
carl
parents:
diff changeset
77
6b1b602514db Initial revision
carl
parents:
diff changeset
78 Section1: - Referenced from "Descriptor Item" - contains not much
6b1b602514db Initial revision
carl
parents:
diff changeset
79 =========
6b1b602514db Initial revision
carl
parents:
diff changeset
80 0x0 - Constant? [4 bytes] (0x0602B5)
6b1b602514db Initial revision
carl
parents:
diff changeset
81 0x04 - Index Pos of Descriptor fields [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
82
6b1b602514db Initial revision
carl
parents:
diff changeset
83
6b1b602514db Initial revision
carl
parents:
diff changeset
84 Descriptor Fields: - Contain the information needed to access the details of the email
6b1b602514db Initial revision
carl
parents:
diff changeset
85 ==================
6b1b602514db Initial revision
carl
parents:
diff changeset
86 repeats
6b1b602514db Initial revision
carl
parents:
diff changeset
87 0x0 - Item type [2 bytes] (subject, from, to ...)
6b1b602514db Initial revision
carl
parents:
diff changeset
88 0x02 - Reference type [2 bytes] (how to interpret the value)
6b1b602514db Initial revision
carl
parents:
diff changeset
89 0x04 - Value [4 bytes]
6b1b602514db Initial revision
carl
parents:
diff changeset
90 until the alloted size of the record has been read. (The following Block Offset from the Index has been reached)
6b1b602514db Initial revision
carl
parents:
diff changeset
91
6b1b602514db Initial revision
carl
parents:
diff changeset
92 Reference Types: - I don't know if I have interpreted this field correctly. It might have a completely different purpose
6b1b602514db Initial revision
carl
parents:
diff changeset
93 ===============
6b1b602514db Initial revision
carl
parents:
diff changeset
94 0x0002 -
6b1b602514db Initial revision
carl
parents:
diff changeset
95 0x0003 - Value following is a value in it's own right
6b1b602514db Initial revision
carl
parents:
diff changeset
96 0x000B -
6b1b602514db Initial revision
carl
parents:
diff changeset
97 0x001E - (STRING) Value following is a Index Position (must be shifted left 4 times)
6b1b602514db Initial revision
carl
parents:
diff changeset
98 0x0040 - (DATE) " " " " "
6b1b602514db Initial revision
carl
parents:
diff changeset
99 0x0048 -
6b1b602514db Initial revision
carl
parents:
diff changeset
100 0x0102 - (STRUCTURE) " " " " "
6b1b602514db Initial revision
carl
parents:
diff changeset
101 0x1003 -
6b1b602514db Initial revision
carl
parents:
diff changeset
102 0x101E - (ARRAY OF STRING)
6b1b602514db Initial revision
carl
parents:
diff changeset
103 0x1102 -
6b1b602514db Initial revision
carl
parents:
diff changeset
104
6b1b602514db Initial revision
carl
parents:
diff changeset
105 Value:
6b1b602514db Initial revision
carl
parents:
diff changeset
106 ======
6b1b602514db Initial revision
carl
parents:
diff changeset
107 When the value is of type Index Position, you can left shift the value 4 times to get an offset into the Block Index. Some descriptor types can have Id2 values. This is recognised by using a bitwise AND with the number. ie val & 0x0000000F. if the result is 0xF, it is likely to be a Id2 reference.
6b1b602514db Initial revision
carl
parents:
diff changeset
108
6b1b602514db Initial revision
carl
parents:
diff changeset
109
6b1b602514db Initial revision
carl
parents:
diff changeset
110 Descriptor Types: - Types that are in "Descriptor Fields"
6b1b602514db Initial revision
carl
parents:
diff changeset
111 =================
6b1b602514db Initial revision
carl
parents:
diff changeset
112
6b1b602514db Initial revision
carl
parents:
diff changeset
113 All Values are Hex
6b1b602514db Initial revision
carl
parents:
diff changeset
114
6b1b602514db Initial revision
carl
parents:
diff changeset
115 Note: it appears that some types can have a IPOS value or a ID2 value depending on the size of the field in question. It is safer to check every field than for me to say what the "usually" contain. Absolute values though, are generally going to be constant.
6b1b602514db Initial revision
carl
parents:
diff changeset
116
6b1b602514db Initial revision
carl
parents:
diff changeset
117 Type Ref Type Value Desc
6b1b602514db Initial revision
carl
parents:
diff changeset
118 ---- -------- ----- ----
6b1b602514db Initial revision
carl
parents:
diff changeset
119 001A [REF] IPM Context. What type of message is this
6b1b602514db Initial revision
carl
parents:
diff changeset
120 0037 001E [REF] Email Subject. The referenced item is of type "Subject Type"
6b1b602514db Initial revision
carl
parents:
diff changeset
121 0039 [REF] Date. This is likely to be the arrival date
6b1b602514db Initial revision
carl
parents:
diff changeset
122 003B [REF] Outlook Address of Sender
6b1b602514db Initial revision
carl
parents:
diff changeset
123 003F [REF] Outlook structure describing the recipient
6b1b602514db Initial revision
carl
parents:
diff changeset
124 0040 [REF] Name of the Outlook recipient structure
6b1b602514db Initial revision
carl
parents:
diff changeset
125 0041 [REF] Outlook structure describing the sender
6b1b602514db Initial revision
carl
parents:
diff changeset
126 0042 [REF] Name of the Outlook sender structure
6b1b602514db Initial revision
carl
parents:
diff changeset
127 0043 [REF] Another structure describing the recipient
6b1b602514db Initial revision
carl
parents:
diff changeset
128 0044 [REF] Name of the second recipient structure
6b1b602514db Initial revision
carl
parents:
diff changeset
129 004F [REF] Reply-To Outlook Structure
6b1b602514db Initial revision
carl
parents:
diff changeset
130 0050 [REF] Name of the Reply-To structure
6b1b602514db Initial revision
carl
parents:
diff changeset
131 0051 [REF] Outlook Name of recipient
6b1b602514db Initial revision
carl
parents:
diff changeset
132 0052 [REF] Second Outlook name of recipient
6b1b602514db Initial revision
carl
parents:
diff changeset
133 0064 [REF] Sender's Address access method (SMTP, EX)
6b1b602514db Initial revision
carl
parents:
diff changeset
134 0065 [REF] Sender's Address
6b1b602514db Initial revision
carl
parents:
diff changeset
135 0070 [REF] Processed Subject (with Fwd:, Re, ... removed)
6b1b602514db Initial revision
carl
parents:
diff changeset
136 0071 [REF] Date. Another date
6b1b602514db Initial revision
carl
parents:
diff changeset
137 0075 [REF] Recipient Address Access Method (SMTP, EX)
6b1b602514db Initial revision
carl
parents:
diff changeset
138 0076 [REF] Recipient's Address
6b1b602514db Initial revision
carl
parents:
diff changeset
139 0077 [REF] Second Recipient Access Method (SMTP, EX)
6b1b602514db Initial revision
carl
parents:
diff changeset
140 0078 [REF] Second Recipient Address
6b1b602514db Initial revision
carl
parents:
diff changeset
141 007D 001E [REF] Email Header. This is the header that was attached to the email
6b1b602514db Initial revision
carl
parents:
diff changeset
142 0C19 [REF] Second sender struct
6b1b602514db Initial revision
carl
parents:
diff changeset
143 0C1A [REF] Name of second sender struct
6b1b602514db Initial revision
carl
parents:
diff changeset
144 0C1D [REF] Second outlook name of sender
6b1b602514db Initial revision
carl
parents:
diff changeset
145 0C1E [REF] Second sender access method (SMTP, EX)
6b1b602514db Initial revision
carl
parents:
diff changeset
146 0C1F [REF] Second Sender Address
6b1b602514db Initial revision
carl
parents:
diff changeset
147 0E03 [REF] CC Address?
6b1b602514db Initial revision
carl
parents:
diff changeset
148 0E04 [REF] SentTo Address
6b1b602514db Initial revision
carl
parents:
diff changeset
149 0E06 [REF] Date.
6b1b602514db Initial revision
carl
parents:
diff changeset
150 0E07 [REF] Flag - contains IsSeen value
6b1b602514db Initial revision
carl
parents:
diff changeset
151 0FF9 [REF] binary record header
6b1b602514db Initial revision
carl
parents:
diff changeset
152 1000 001E [REF] Plain Text Email Body. Does not exist if the email doesn't have a plain text version
6b1b602514db Initial revision
carl
parents:
diff changeset
153 1013 001E [REF] HTML Email Body. Does not exist if the email doesn't have a HTML version
6b1b602514db Initial revision
carl
parents:
diff changeset
154 1035 [REF] Message ID
6b1b602514db Initial revision
carl
parents:
diff changeset
155 1042 [REF] In-Reply-To or Parent's Message ID
6b1b602514db Initial revision
carl
parents:
diff changeset
156 1046 [REF] Return Path
6b1b602514db Initial revision
carl
parents:
diff changeset
157 3001 [REF] Folder Name? I have seen this value used for the contacts record aswell
6b1b602514db Initial revision
carl
parents:
diff changeset
158 3007 [REF] Date.
6b1b602514db Initial revision
carl
parents:
diff changeset
159 3008 [REF] Date.
6b1b602514db Initial revision
carl
parents:
diff changeset
160 300B [REF] binary record header
6b1b602514db Initial revision
carl
parents:
diff changeset
161 35E0 [REF] binary record found in first item. Contains the reference to "Top of Personal Folder" item
6b1b602514db Initial revision
carl
parents:
diff changeset
162 35E3 [REF] binary record with a reference to "Deleted Items" item
6b1b602514db Initial revision
carl
parents:
diff changeset
163 35E7 [REF] binary record with a refernece to "Search Root" item
6b1b602514db Initial revision
carl
parents:
diff changeset
164 3602 [REF] the number of emails stored in a folder
6b1b602514db Initial revision
carl
parents:
diff changeset
165 3603 [REF] the number of unread emails in a folder
6b1b602514db Initial revision
carl
parents:
diff changeset
166 3613 [REF] the folder content description
6b1b602514db Initial revision
carl
parents:
diff changeset
167 8000- Contain extra bits of information that have been taken from the email's header. I call them extra lines
6b1b602514db Initial revision
carl
parents:
diff changeset
168
6b1b602514db Initial revision
carl
parents:
diff changeset
169 Key:
6b1b602514db Initial revision
carl
parents:
diff changeset
170 [REF] = Can be either Index Position, or an Id2 Reference