Mercurial > libpst
annotate src/libpst.h @ 142:2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
if the conversion fails, leave the data in utf-8.
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 23 Feb 2009 20:40:51 -0800 |
parents | 5e4d6faada34 |
children | fdc58ad2c758 |
rev | line source |
---|---|
16 | 1 /*** |
2 * libpst.h | |
3 * Part of LibPST project | |
4 * Written by David Smith | |
46 | 5 * dave.s@earthcorp.com |
16 | 6 */ |
7 // LibPST - Library for Accessing Outlook .pst files | |
8 // Dave Smith - davesmith@users.sourceforge.net | |
9 | |
10 #ifndef LIBPST_H | |
11 #define LIBPST_H | |
12 | |
132
5e4d6faada34
fix from Fridrich Strba for parallel make
Carl Byington <carl@five-ten-sg.com>
parents:
130
diff
changeset
|
13 #include "common.h" |
130
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
14 |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
15 |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
16 // switch to maximal packing for all structures in the libpst interface |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
17 // this is reverted at the end of this file |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
18 #ifdef _MSC_VER |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
19 #pragma pack(push, 1) |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
20 #endif |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
21 #if defined(__GNUC__) || defined (__SUNPRO_C) || defined(__SUNPRO_CC) |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
22 #pragma pack(1) |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
23 #endif |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
24 |
16 | 25 |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
26 #define PST_TYPE_NOTE 1 |
16 | 27 #define PST_TYPE_APPOINTMENT 8 |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
28 #define PST_TYPE_CONTACT 9 |
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
29 #define PST_TYPE_JOURNAL 10 |
16 | 30 #define PST_TYPE_STICKYNOTE 11 |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
31 #define PST_TYPE_TASK 12 |
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
32 #define PST_TYPE_OTHER 13 |
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
33 #define PST_TYPE_REPORT 14 |
16 | 34 |
35 // defines whether decryption is done on this bit of data | |
36 #define PST_NO_ENC 0 | |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
37 #define PST_ENC 1 |
16 | 38 |
39 // defines types of possible encryption | |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
40 #define PST_NO_ENCRYPT 0 |
16 | 41 #define PST_COMP_ENCRYPT 1 |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
42 #define PST_ENCRYPT 2 |
16 | 43 |
44 // defines different types of mappings | |
46 | 45 #define PST_MAP_ATTRIB (uint32_t)1 |
46 #define PST_MAP_HEADER (uint32_t)2 | |
16 | 47 |
48 // define my custom email attributes. | |
49 #define PST_ATTRIB_HEADER -1 | |
50 | |
51 // defines types of free/busy values for appointment->showas | |
52 #define PST_FREEBUSY_FREE 0 | |
53 #define PST_FREEBUSY_TENTATIVE 1 | |
54 #define PST_FREEBUSY_BUSY 2 | |
55 #define PST_FREEBUSY_OUT_OF_OFFICE 3 | |
56 | |
57 // defines labels for appointment->label | |
46 | 58 #define PST_APP_LABEL_NONE 0 // None |
16 | 59 #define PST_APP_LABEL_IMPORTANT 1 // Important |
46 | 60 #define PST_APP_LABEL_BUSINESS 2 // Business |
61 #define PST_APP_LABEL_PERSONAL 3 // Personal | |
62 #define PST_APP_LABEL_VACATION 4 // Vacation | |
16 | 63 #define PST_APP_LABEL_MUST_ATTEND 5 // Must Attend |
64 #define PST_APP_LABEL_TRAVEL_REQ 6 // Travel Required | |
65 #define PST_APP_LABEL_NEEDS_PREP 7 // Needs Preparation | |
46 | 66 #define PST_APP_LABEL_BIRTHDAY 8 // Birthday |
16 | 67 #define PST_APP_LABEL_ANNIVERSARY 9 // Anniversary |
68 #define PST_APP_LABEL_PHONE_CALL 10// Phone Call | |
69 | |
50 | 70 // define type of reccuring event |
71 #define PST_APP_RECUR_NONE 0 | |
72 #define PST_APP_RECUR_DAILY 1 | |
73 #define PST_APP_RECUR_WEEKLY 2 | |
74 #define PST_APP_RECUR_MONTHLY 3 | |
75 #define PST_APP_RECUR_YEARLY 4 | |
76 | |
49 | 77 |
46 | 78 typedef struct pst_misc_6_struct { |
49 | 79 int32_t i1; |
80 int32_t i2; | |
81 int32_t i3; | |
82 int32_t i4; | |
83 int32_t i5; | |
84 int32_t i6; | |
16 | 85 } pst_misc_6; |
86 | |
49 | 87 |
46 | 88 typedef struct pst_entryid_struct { |
49 | 89 int32_t u1; |
90 char entryid[16]; | |
91 uint32_t id; | |
16 | 92 } pst_entryid; |
93 | |
49 | 94 |
46 | 95 typedef struct pst_desc_struct32 { |
49 | 96 uint32_t d_id; |
97 uint32_t desc_id; | |
98 uint32_t list_id; | |
99 uint32_t parent_id; | |
43 | 100 } pst_desc32; |
16 | 101 |
49 | 102 |
46 | 103 typedef struct pst_desc_structn { |
49 | 104 uint64_t d_id; |
105 uint64_t desc_id; | |
106 uint64_t list_id; | |
107 uint32_t parent_id; // not 64 bit ?? | |
108 uint32_t u1; // padding | |
43 | 109 } pst_descn; |
110 | |
49 | 111 |
46 | 112 typedef struct pst_index_struct32 { |
49 | 113 uint32_t id; |
114 uint32_t offset; | |
115 uint16_t size; | |
116 int16_t u1; | |
43 | 117 } pst_index32; |
118 | |
49 | 119 |
46 | 120 typedef struct pst_index_struct { |
49 | 121 uint64_t id; |
122 uint64_t offset; | |
123 uint16_t size; | |
124 int16_t u0; | |
125 int32_t u1; | |
16 | 126 } pst_index; |
127 | |
49 | 128 |
46 | 129 typedef struct pst_index_tree32 { |
49 | 130 uint32_t id; |
131 uint32_t offset; | |
132 uint32_t size; | |
133 int32_t u1; | |
134 struct pst_index_tree * next; | |
43 | 135 } pst_index_ll32; |
136 | |
49 | 137 |
46 | 138 typedef struct pst_index_tree { |
49 | 139 uint64_t id; |
140 uint64_t offset; | |
141 uint64_t size; | |
142 int64_t u1; | |
142
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
143 struct pst_index_tree *next; |
16 | 144 } pst_index_ll; |
145 | |
49 | 146 |
46 | 147 typedef struct pst_index2_tree { |
49 | 148 uint64_t id2; |
149 pst_index_ll *id; | |
142
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
150 struct pst_index2_tree *child; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
151 struct pst_index2_tree *next; |
16 | 152 } pst_index2_ll; |
153 | |
49 | 154 |
46 | 155 typedef struct pst_desc_tree { |
49 | 156 uint64_t id; |
101
1fc33da23175
fix for orphan children when building descriptor tree, avoid writing uninitialized data to debug log file
Carl Byington <carl@five-ten-sg.com>
parents:
94
diff
changeset
|
157 uint64_t parent_id; |
142
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
158 pst_index_ll *list_index; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
159 pst_index_ll *desc; |
49 | 160 int32_t no_child; |
142
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
161 struct pst_desc_tree *prev; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
162 struct pst_desc_tree *next; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
163 struct pst_desc_tree *parent; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
164 struct pst_desc_tree *child; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
165 struct pst_desc_tree *child_tail; |
16 | 166 } pst_desc_ll; |
167 | |
49 | 168 |
46 | 169 typedef struct pst_item_email_subject { |
49 | 170 int off1; |
171 int off2; | |
172 char *subj; | |
16 | 173 } pst_item_email_subject; |
174 | |
49 | 175 |
46 | 176 typedef struct pst_item_email { |
142
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
177 FILETIME *arrival_date; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
178 int autoforward; // 1 = true, 0 = not set, -1 = false |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
179 char *body; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
180 int32_t body_was_unicode; // 1 = true, 0 = false |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
181 char *body_charset; // null if not specified |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
182 char *cc_address; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
183 char *bcc_address; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
184 char *common_name; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
185 int32_t conv_index; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
186 int conversion_prohib; // 1 = true, 0 = false |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
187 int delete_after_submit; // 1 = true, 0 = false |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
188 int delivery_report; // 1 = true, 0 = false |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
189 char *encrypted_body; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
190 size_t encrypted_body_size; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
191 char *encrypted_htmlbody; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
192 size_t encrypted_htmlbody_size; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
193 int32_t flag; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
194 char *header; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
195 char *htmlbody; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
196 int32_t htmlbody_was_unicode; // 1 = true, 0 = false |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
197 int32_t importance; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
198 char *in_reply_to; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
199 int message_cc_me; // 1 = true, 0 = false |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
200 int message_recip_me; // 1 = true, 0 = false |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
201 int message_to_me; // 1 = true, 0 = false |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
202 char *messageid; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
203 int32_t orig_sensitivity; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
204 char *original_bcc; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
205 char *original_cc; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
206 char *original_to; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
207 char *outlook_recipient; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
208 char *outlook_recipient_name; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
209 char *outlook_recipient2; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
210 char *outlook_sender; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
211 char *outlook_sender_name; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
212 char *outlook_sender2; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
213 int32_t priority; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
214 char *proc_subject; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
215 int read_receipt; // 1 = true, 0 = false |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
216 char *recip_access; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
217 char *recip_address; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
218 char *recip2_access; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
219 char *recip2_address; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
220 int reply_requested; // 1 = true, 0 = false |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
221 char *reply_to; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
222 char *return_path_address; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
223 int32_t rtf_body_char_count; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
224 int32_t rtf_body_crc; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
225 char *rtf_body_tag; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
226 char *rtf_compressed; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
227 uint32_t rtf_compressed_size; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
228 int rtf_in_sync; // 1 = true, 0 = doesn't exist, -1 = false |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
229 int32_t rtf_ws_prefix_count; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
230 int32_t rtf_ws_trailing_count; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
231 char *sender_access; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
232 char *sender_address; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
233 char *sender2_access; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
234 char *sender2_address; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
235 int32_t sensitivity; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
236 int32_t internet_cpid; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
237 int32_t message_codepage; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
238 FILETIME *sent_date; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
239 pst_entryid *sentmail_folder; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
240 char *sentto_address; |
49 | 241 pst_item_email_subject *subject; |
142
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
242 // delivery report fields |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
243 char *report_text; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
244 int32_t report_was_unicode; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
245 FILETIME *report_time; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
246 int32_t ndr_reason_code; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
247 int32_t ndr_diag_code; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
248 char *supplementary_info; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
249 int32_t ndr_status_code; |
16 | 250 } pst_item_email; |
251 | |
49 | 252 |
46 | 253 typedef struct pst_item_folder { |
49 | 254 int32_t email_count; |
255 int32_t unseen_email_count; | |
256 int32_t assoc_count; | |
257 int subfolder; // 1 = true, 0 = false | |
16 | 258 } pst_item_folder; |
259 | |
49 | 260 |
46 | 261 typedef struct pst_item_message_store { |
51 | 262 pst_entryid *top_of_personal_folder; // 0x35e0 |
263 pst_entryid *default_outbox_folder; // 0x35e2 | |
264 pst_entryid *deleted_items_folder; // 0x35e3 | |
265 pst_entryid *sent_items_folder; // 0x35e4 | |
266 pst_entryid *user_views_folder; // 0x35e5 | |
267 pst_entryid *common_view_folder; // 0x35e6 | |
268 pst_entryid *search_root_folder; // 0x35e7 | |
269 pst_entryid *top_of_folder; // 0x7c07 | |
270 int32_t valid_mask; // 0x35df // what folders the message store contains | |
271 int32_t pwd_chksum; // 0x76ff | |
16 | 272 } pst_item_message_store; |
273 | |
49 | 274 |
46 | 275 typedef struct pst_item_contact { |
49 | 276 char *access_method; |
277 char *account_name; | |
278 char *address1; | |
279 char *address1a; | |
280 char *address1_desc; | |
281 char *address1_transport; | |
282 char *address2; | |
283 char *address2a; | |
284 char *address2_desc; | |
285 char *address2_transport; | |
286 char *address3; | |
287 char *address3a; | |
288 char *address3_desc; | |
289 char *address3_transport; | |
290 char *assistant_name; | |
291 char *assistant_phone; | |
292 char *billing_information; | |
293 FILETIME *birthday; | |
51 | 294 char *business_address; // 0x801b |
49 | 295 char *business_city; |
296 char *business_country; | |
297 char *business_fax; | |
298 char *business_homepage; | |
299 char *business_phone; | |
300 char *business_phone2; | |
301 char *business_po_box; | |
302 char *business_postal_code; | |
303 char *business_state; | |
304 char *business_street; | |
305 char *callback_phone; | |
306 char *car_phone; | |
307 char *company_main_phone; | |
308 char *company_name; | |
309 char *computer_name; | |
310 char *customer_id; | |
311 char *def_postal_address; | |
312 char *department; | |
313 char *display_name_prefix; | |
314 char *first_name; | |
315 char *followup; | |
316 char *free_busy_address; | |
317 char *ftp_site; | |
318 char *fullname; | |
51 | 319 int16_t gender; |
49 | 320 char *gov_id; |
321 char *hobbies; | |
51 | 322 char *home_address; // 0x801a |
49 | 323 char *home_city; |
324 char *home_country; | |
325 char *home_fax; | |
326 char *home_phone; | |
327 char *home_phone2; | |
328 char *home_po_box; | |
329 char *home_postal_code; | |
330 char *home_state; | |
331 char *home_street; | |
332 char *initials; | |
333 char *isdn_phone; | |
334 char *job_title; | |
335 char *keyword; | |
336 char *language; | |
337 char *location; | |
51 | 338 int mail_permission; // 1 = true, 0 = false |
49 | 339 char *manager_name; |
340 char *middle_name; | |
341 char *mileage; | |
342 char *mobile_phone; | |
343 char *nickname; | |
344 char *office_loc; | |
345 char *org_id; | |
51 | 346 char *other_address; // 0x801c |
49 | 347 char *other_city; |
348 char *other_country; | |
349 char *other_phone; | |
350 char *other_po_box; | |
351 char *other_postal_code; | |
352 char *other_state; | |
353 char *other_street; | |
354 char *pager_phone; | |
355 char *personal_homepage; | |
356 char *pref_name; | |
357 char *primary_fax; | |
358 char *primary_phone; | |
359 char *profession; | |
360 char *radio_phone; | |
51 | 361 int rich_text; // 1 = true, 0 = false |
49 | 362 char *spouse_name; |
363 char *suffix; | |
364 char *surname; | |
365 char *telex; | |
366 char *transmittable_display_name; | |
367 char *ttytdd_phone; | |
368 FILETIME *wedding_anniversary; | |
51 | 369 char *work_address_street; // 0x8045 |
370 char *work_address_city; // 0x8046 | |
371 char *work_address_state; // 0x8047 | |
372 char *work_address_postalcode; // 0x8048 | |
373 char *work_address_country; // 0x8049 | |
374 char *work_address_postofficebox; // 0x804a | |
16 | 375 } pst_item_contact; |
376 | |
49 | 377 |
46 | 378 typedef struct pst_item_attach { |
49 | 379 char *filename1; |
380 char *filename2; | |
381 char *mimetype; | |
382 char *data; | |
383 size_t size; | |
384 uint64_t id2_val; | |
385 uint64_t id_val; // calculated from id2_val during creation of record | |
386 int32_t method; | |
387 int32_t position; | |
388 int32_t sequence; | |
389 struct pst_item_attach *next; | |
16 | 390 } pst_item_attach; |
391 | |
49 | 392 |
46 | 393 typedef struct pst_item_extra_field { |
49 | 394 char *field_name; |
395 char *value; | |
396 struct pst_item_extra_field *next; | |
16 | 397 } pst_item_extra_field; |
398 | |
49 | 399 |
46 | 400 typedef struct pst_item_journal { |
49 | 401 FILETIME *end; |
402 FILETIME *start; | |
403 char *type; | |
16 | 404 } pst_item_journal; |
405 | |
49 | 406 |
46 | 407 typedef struct pst_item_appointment { |
49 | 408 FILETIME *end; |
50 | 409 char *location; |
410 int alarm; // 1 = true, 0 = false | |
49 | 411 FILETIME *reminder; |
50 | 412 int32_t alarm_minutes; |
413 char *alarm_filename; | |
49 | 414 FILETIME *start; |
50 | 415 char *timezonestring; |
416 int32_t showas; | |
417 int32_t label; | |
418 int all_day; // 1 = true, 0 = false | |
419 char *recurrence; | |
420 int32_t recurrence_type; | |
421 FILETIME *recurrence_start; | |
422 FILETIME *recurrence_end; | |
16 | 423 } pst_item_appointment; |
424 | |
49 | 425 |
46 | 426 typedef struct pst_item { |
49 | 427 struct pst_item_email *email; // data reffering to email |
428 struct pst_item_folder *folder; // data reffering to folder | |
429 struct pst_item_contact *contact; // data reffering to contact | |
430 struct pst_item_attach *attach; // linked list of attachments | |
431 struct pst_item_message_store *message_store; // data referring to the message store | |
432 struct pst_item_extra_field *extra_fields; // linked list of extra headers and such | |
433 struct pst_item_journal *journal; // data reffering to a journal entry | |
434 struct pst_item_appointment *appointment; // data reffering to a calendar entry | |
435 int type; | |
436 char *ascii_type; | |
437 char *file_as; | |
438 char *comment; | |
439 int32_t message_size; | |
440 char *outlook_version; | |
441 char *record_key; // probably 16 bytes long. | |
442 size_t record_key_size; | |
443 int response_requested; // 1 = true, 0 = false | |
444 FILETIME *create_date; | |
445 FILETIME *modify_date; | |
446 int private_member; // 1 = true, 0 = false | |
16 | 447 } pst_item; |
448 | |
49 | 449 |
46 | 450 typedef struct pst_x_attrib_ll { |
49 | 451 uint32_t type; |
452 uint32_t mytype; | |
453 uint32_t map; | |
454 void *data; | |
455 struct pst_x_attrib_ll *next; | |
16 | 456 } pst_x_attrib_ll; |
457 | |
49 | 458 |
52 | 459 typedef struct pst_block_recorder { |
460 struct pst_block_recorder *next; | |
125
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
461 int64_t offset; |
52 | 462 size_t size; |
463 int readcount; | |
464 } pst_block_recorder; | |
465 | |
466 | |
46 | 467 typedef struct pst_file { |
49 | 468 pst_index_ll *i_head, *i_tail; |
52 | 469 pst_desc_ll *d_head, *d_tail; |
49 | 470 pst_x_attrib_ll *x_head; |
52 | 471 pst_block_recorder *block_head; |
46 | 472 |
142
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
473 int do_read64; // 0 is 32-bit pst file, pre Outlook 2003; |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
474 // 1 is 64-bit pst file, Outlook 2003 and later |
49 | 475 uint64_t index1; |
476 uint64_t index1_back; | |
477 uint64_t index2; | |
478 uint64_t index2_back; | |
142
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
479 FILE * fp; // file pointer to opened PST file |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
480 uint64_t size; // pst file size |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
481 unsigned char encryption; // pst encryption setting |
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
482 unsigned char ind_type; // pst index type |
16 | 483 } pst_file; |
484 | |
49 | 485 |
46 | 486 typedef struct pst_block_offset { |
49 | 487 int16_t from; |
488 int16_t to; | |
16 | 489 } pst_block_offset; |
490 | |
49 | 491 |
46 | 492 typedef struct pst_block_offset_pointer { |
52 | 493 char *from; |
494 char *to; | |
495 int needfree; | |
35 | 496 } pst_block_offset_pointer; |
497 | |
49 | 498 |
499 typedef struct pst_num_item { | |
52 | 500 uint32_t id; // not an id1 or id2, this is actually some sort of type code |
501 char *data; | |
502 uint32_t type; | |
503 size_t size; | |
504 char *extra; | |
49 | 505 } pst_num_item; |
506 | |
16 | 507 |
46 | 508 typedef struct pst_num_array { |
49 | 509 int32_t count_item; |
510 int32_t orig_count; | |
511 int32_t count_array; | |
512 struct pst_num_item ** items; | |
513 struct pst_num_array *next; | |
16 | 514 } pst_num_array; |
515 | |
49 | 516 |
517 typedef struct pst_holder { | |
94
997cf1373f9e
fix base64 encoding that could create long lines
Carl Byington <carl@five-ten-sg.com>
parents:
90
diff
changeset
|
518 char **buf; |
997cf1373f9e
fix base64 encoding that could create long lines
Carl Byington <carl@five-ten-sg.com>
parents:
90
diff
changeset
|
519 FILE *fp; |
997cf1373f9e
fix base64 encoding that could create long lines
Carl Byington <carl@five-ten-sg.com>
parents:
90
diff
changeset
|
520 int base64; |
49 | 521 } pst_holder; |
522 | |
523 | |
524 typedef struct pst_subblock { | |
52 | 525 char *buf; |
526 size_t read_size; | |
527 size_t i_offset; | |
49 | 528 } pst_subblock; |
529 | |
530 | |
531 typedef struct pst_subblocks { | |
532 size_t subblock_count; | |
533 pst_subblock *subs; | |
534 } pst_subblocks; | |
535 | |
16 | 536 |
537 // prototypes | |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
52
diff
changeset
|
538 int pst_open(pst_file *pf, char *name); |
46 | 539 int pst_close(pst_file *pf); |
540 pst_desc_ll * pst_getTopOfFolders(pst_file *pf, pst_item *root); | |
52 | 541 size_t pst_attach_to_mem(pst_file *pf, pst_item_attach *attach, char **b); |
46 | 542 size_t pst_attach_to_file(pst_file *pf, pst_item_attach *attach, FILE* fp); |
543 size_t pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE* fp); | |
544 int pst_load_index (pst_file *pf); | |
545 pst_desc_ll* pst_getNextDptr(pst_desc_ll* d); | |
546 int pst_load_extended_attributes(pst_file *pf); | |
16 | 547 |
125
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
548 int pst_build_id_ptr(pst_file *pf, int64_t offset, int32_t depth, uint64_t linku1, uint64_t start_val, uint64_t end_val); |
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
549 int pst_build_desc_ptr(pst_file *pf, int64_t offset, int32_t depth, uint64_t linku1, uint64_t start_val, uint64_t end_val); |
46 | 550 pst_item* pst_getItem(pst_file *pf, pst_desc_ll *d_ptr); |
551 pst_item* pst_parse_item (pst_file *pf, pst_desc_ll *d_ptr); | |
48 | 552 pst_num_array* pst_parse_block(pst_file *pf, uint64_t block_id, pst_index2_ll *i2_head, pst_num_array *na_head); |
46 | 553 int pst_process(pst_num_array *list, pst_item *item, pst_item_attach *attach); |
554 void pst_free_list(pst_num_array *list); | |
555 void pst_freeItem(pst_item *item); | |
556 void pst_free_id2(pst_index2_ll * head); | |
557 void pst_free_id (pst_index_ll *head); | |
558 void pst_free_desc (pst_desc_ll *head); | |
559 void pst_free_xattrib(pst_x_attrib_ll *x); | |
49 | 560 int pst_getBlockOffsetPointer(pst_file *pf, pst_index2_ll *i2_head, pst_subblocks *subblocks, uint32_t offset, pst_block_offset_pointer *p); |
52 | 561 int pst_getBlockOffset(char *buf, size_t read_size, uint32_t i_offset, uint32_t offset, pst_block_offset *p); |
142
2189a6b8134e
improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode.
Carl Byington <carl@five-ten-sg.com>
parents:
132
diff
changeset
|
562 pst_index2_ll* pst_build_id2(pst_file *pf, pst_index_ll* list); |
46 | 563 pst_index_ll* pst_getID(pst_file* pf, uint64_t id); |
564 pst_index_ll* pst_getID2(pst_index2_ll * ptr, uint64_t id); | |
565 pst_desc_ll* pst_getDptr(pst_file *pf, uint64_t id); | |
125
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
566 size_t pst_read_block_size(pst_file *pf, int64_t offset, size_t size, char **buf); |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
567 int pst_decrypt(uint64_t id, char *buf, size_t size, unsigned char type); |
46 | 568 uint64_t pst_getIntAt(pst_file *pf, char *buf); |
125
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
569 uint64_t pst_getIntAtPos(pst_file *pf, int64_t pos); |
23a36ac0514d
recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
Carl Byington <carl@five-ten-sg.com>
parents:
123
diff
changeset
|
570 size_t pst_getAtPos(pst_file *pf, int64_t pos, void* buf, size_t size); |
52 | 571 size_t pst_ff_getIDblock_dec(pst_file *pf, uint64_t id, char **b); |
572 size_t pst_ff_getIDblock(pst_file *pf, uint64_t id, char** b); | |
573 size_t pst_ff_getID2block(pst_file *pf, uint64_t id2, pst_index2_ll *id2_head, char** buf); | |
49 | 574 size_t pst_ff_getID2data(pst_file *pf, pst_index_ll *ptr, pst_holder *h); |
575 size_t pst_ff_compile_ID(pst_file *pf, uint64_t id, pst_holder *h, size_t size); | |
16 | 576 |
46 | 577 int pst_strincmp(char *a, char *b, size_t x); |
578 int pst_stricmp(char *a, char *b); | |
579 size_t pst_fwrite(const void*ptr, size_t size, size_t nmemb, FILE*stream); | |
47 | 580 char * pst_wide_to_single(char *wt, size_t size); |
43 | 581 |
46 | 582 char * pst_rfc2426_escape(char *str); |
583 int pst_chr_count(char *str, char x); | |
584 char * pst_rfc2425_datetime_format(FILETIME *ft); | |
585 char * pst_rfc2445_datetime_format(FILETIME *ft); | |
43 | 586 |
51 | 587 void pst_printDptr(pst_file *pf, pst_desc_ll *ptr); |
588 void pst_printIDptr(pst_file* pf); | |
589 void pst_printID2ptr(pst_index2_ll *ptr); | |
16 | 590 |
130
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
591 |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
592 // switch from maximal packing back to default packing |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
593 // undo the packing from the beginning of this file |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
594 #ifdef _MSC_VER |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
595 #pragma pack(pop) |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
596 #endif |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
597 #if defined(__GNUC__) || defined (__SUNPRO_C) || defined(__SUNPRO_CC) |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
598 #pragma pack() |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
599 #endif |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
600 |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
601 |
e35fd42bac05
more cleanup of include files
Carl Byington <carl@five-ten-sg.com>
parents:
128
diff
changeset
|
602 |
16 | 603 #endif // defined LIBPST_H |