comparison 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
comparison
equal deleted inserted replaced
141:fd4297884319 142:2189a6b8134e
138 typedef struct pst_index_tree { 138 typedef struct pst_index_tree {
139 uint64_t id; 139 uint64_t id;
140 uint64_t offset; 140 uint64_t offset;
141 uint64_t size; 141 uint64_t size;
142 int64_t u1; 142 int64_t u1;
143 struct pst_index_tree * next; 143 struct pst_index_tree *next;
144 } pst_index_ll; 144 } pst_index_ll;
145 145
146 146
147 typedef struct pst_index2_tree { 147 typedef struct pst_index2_tree {
148 uint64_t id2; 148 uint64_t id2;
149 pst_index_ll *id; 149 pst_index_ll *id;
150 struct pst_index2_tree * next; 150 struct pst_index2_tree *child;
151 struct pst_index2_tree *next;
151 } pst_index2_ll; 152 } pst_index2_ll;
152 153
153 154
154 typedef struct pst_desc_tree { 155 typedef struct pst_desc_tree {
155 uint64_t id; 156 uint64_t id;
156 uint64_t parent_id; 157 uint64_t parent_id;
157 pst_index_ll * list_index; 158 pst_index_ll *list_index;
158 pst_index_ll * desc; 159 pst_index_ll *desc;
159 int32_t no_child; 160 int32_t no_child;
160 struct pst_desc_tree * prev; 161 struct pst_desc_tree *prev;
161 struct pst_desc_tree * next; 162 struct pst_desc_tree *next;
162 struct pst_desc_tree * parent; 163 struct pst_desc_tree *parent;
163 struct pst_desc_tree * child; 164 struct pst_desc_tree *child;
164 struct pst_desc_tree * child_tail; 165 struct pst_desc_tree *child_tail;
165 } pst_desc_ll; 166 } pst_desc_ll;
166 167
167 168
168 typedef struct pst_item_email_subject { 169 typedef struct pst_item_email_subject {
169 int off1; 170 int off1;
171 char *subj; 172 char *subj;
172 } pst_item_email_subject; 173 } pst_item_email_subject;
173 174
174 175
175 typedef struct pst_item_email { 176 typedef struct pst_item_email {
176 FILETIME *arrival_date; 177 FILETIME *arrival_date;
177 int autoforward; // 1 = true, 0 = not set, -1 = false 178 int autoforward; // 1 = true, 0 = not set, -1 = false
178 char *body; 179 char *body;
179 char *body_charset; // null if not specified 180 int32_t body_was_unicode; // 1 = true, 0 = false
180 char *cc_address; 181 char *body_charset; // null if not specified
181 char *bcc_address; 182 char *cc_address;
182 char *common_name; 183 char *bcc_address;
183 int32_t conv_index; 184 char *common_name;
184 int conversion_prohib; // 1 = true, 0 = false 185 int32_t conv_index;
185 int delete_after_submit; // 1 = true, 0 = false 186 int conversion_prohib; // 1 = true, 0 = false
186 int delivery_report; // 1 = true, 0 = false 187 int delete_after_submit; // 1 = true, 0 = false
187 char *encrypted_body; 188 int delivery_report; // 1 = true, 0 = false
188 size_t encrypted_body_size; 189 char *encrypted_body;
189 char *encrypted_htmlbody; 190 size_t encrypted_body_size;
190 size_t encrypted_htmlbody_size; 191 char *encrypted_htmlbody;
191 int32_t flag; 192 size_t encrypted_htmlbody_size;
192 char *header; 193 int32_t flag;
193 char *htmlbody; 194 char *header;
194 int32_t importance; 195 char *htmlbody;
195 char *in_reply_to; 196 int32_t htmlbody_was_unicode; // 1 = true, 0 = false
196 int message_cc_me; // 1 = true, 0 = false 197 int32_t importance;
197 int message_recip_me; // 1 = true, 0 = false 198 char *in_reply_to;
198 int message_to_me; // 1 = true, 0 = false 199 int message_cc_me; // 1 = true, 0 = false
199 char *messageid; 200 int message_recip_me; // 1 = true, 0 = false
200 int32_t orig_sensitivity; 201 int message_to_me; // 1 = true, 0 = false
201 char *original_bcc; 202 char *messageid;
202 char *original_cc; 203 int32_t orig_sensitivity;
203 char *original_to; 204 char *original_bcc;
204 char *outlook_recipient; 205 char *original_cc;
205 char *outlook_recipient_name; 206 char *original_to;
206 char *outlook_recipient2; 207 char *outlook_recipient;
207 char *outlook_sender; 208 char *outlook_recipient_name;
208 char *outlook_sender_name; 209 char *outlook_recipient2;
209 char *outlook_sender2; 210 char *outlook_sender;
210 int32_t priority; 211 char *outlook_sender_name;
211 char *proc_subject; 212 char *outlook_sender2;
212 int read_receipt; // 1 = true, 0 = false 213 int32_t priority;
213 char *recip_access; 214 char *proc_subject;
214 char *recip_address; 215 int read_receipt; // 1 = true, 0 = false
215 char *recip2_access; 216 char *recip_access;
216 char *recip2_address; 217 char *recip_address;
217 int reply_requested; // 1 = true, 0 = false 218 char *recip2_access;
218 char *reply_to; 219 char *recip2_address;
219 char *return_path_address; 220 int reply_requested; // 1 = true, 0 = false
220 int32_t rtf_body_char_count; 221 char *reply_to;
221 int32_t rtf_body_crc; 222 char *return_path_address;
222 char *rtf_body_tag; 223 int32_t rtf_body_char_count;
223 char *rtf_compressed; 224 int32_t rtf_body_crc;
224 uint32_t rtf_compressed_size; 225 char *rtf_body_tag;
225 int rtf_in_sync; // 1 = true, 0 = doesn't exist, -1 = false 226 char *rtf_compressed;
226 int32_t rtf_ws_prefix_count; 227 uint32_t rtf_compressed_size;
227 int32_t rtf_ws_trailing_count; 228 int rtf_in_sync; // 1 = true, 0 = doesn't exist, -1 = false
228 char *sender_access; 229 int32_t rtf_ws_prefix_count;
229 char *sender_address; 230 int32_t rtf_ws_trailing_count;
230 char *sender2_access; 231 char *sender_access;
231 char *sender2_address; 232 char *sender_address;
232 int32_t sensitivity; 233 char *sender2_access;
233 FILETIME *sent_date; 234 char *sender2_address;
234 pst_entryid *sentmail_folder; 235 int32_t sensitivity;
235 char *sentto_address; 236 int32_t internet_cpid;
237 int32_t message_codepage;
238 FILETIME *sent_date;
239 pst_entryid *sentmail_folder;
240 char *sentto_address;
236 pst_item_email_subject *subject; 241 pst_item_email_subject *subject;
242 // delivery report fields
243 char *report_text;
244 int32_t report_was_unicode;
245 FILETIME *report_time;
246 int32_t ndr_reason_code;
247 int32_t ndr_diag_code;
248 char *supplementary_info;
249 int32_t ndr_status_code;
237 } pst_item_email; 250 } pst_item_email;
238 251
239 252
240 typedef struct pst_item_folder { 253 typedef struct pst_item_folder {
241 int32_t email_count; 254 int32_t email_count;
455 pst_index_ll *i_head, *i_tail; 468 pst_index_ll *i_head, *i_tail;
456 pst_desc_ll *d_head, *d_tail; 469 pst_desc_ll *d_head, *d_tail;
457 pst_x_attrib_ll *x_head; 470 pst_x_attrib_ll *x_head;
458 pst_block_recorder *block_head; 471 pst_block_recorder *block_head;
459 472
460 //set this to 0 to read 32-bit pst files (pre Outlook 2003) 473 int do_read64; // 0 is 32-bit pst file, pre Outlook 2003;
461 //set this to 1 to read 64-bit pst files (Outlook 2003 and later) 474 // 1 is 64-bit pst file, Outlook 2003 and later
462 int do_read64;
463
464 uint64_t index1; 475 uint64_t index1;
465 uint64_t index1_back; 476 uint64_t index1_back;
466 uint64_t index2; 477 uint64_t index2;
467 uint64_t index2_back; 478 uint64_t index2_back;
468 FILE * fp; // file pointer to opened PST file 479 FILE * fp; // file pointer to opened PST file
469 uint64_t size; // pst file size 480 uint64_t size; // pst file size
470 unsigned char encryption; // pst encryption setting 481 unsigned char encryption; // pst encryption setting
471 unsigned char ind_type; // pst index type 482 unsigned char ind_type; // pst index type
472 } pst_file; 483 } pst_file;
473 484
474 485
475 typedef struct pst_block_offset { 486 typedef struct pst_block_offset {
476 int16_t from; 487 int16_t from;
546 void pst_free_id (pst_index_ll *head); 557 void pst_free_id (pst_index_ll *head);
547 void pst_free_desc (pst_desc_ll *head); 558 void pst_free_desc (pst_desc_ll *head);
548 void pst_free_xattrib(pst_x_attrib_ll *x); 559 void pst_free_xattrib(pst_x_attrib_ll *x);
549 int pst_getBlockOffsetPointer(pst_file *pf, pst_index2_ll *i2_head, pst_subblocks *subblocks, uint32_t offset, pst_block_offset_pointer *p); 560 int pst_getBlockOffsetPointer(pst_file *pf, pst_index2_ll *i2_head, pst_subblocks *subblocks, uint32_t offset, pst_block_offset_pointer *p);
550 int pst_getBlockOffset(char *buf, size_t read_size, uint32_t i_offset, uint32_t offset, pst_block_offset *p); 561 int pst_getBlockOffset(char *buf, size_t read_size, uint32_t i_offset, uint32_t offset, pst_block_offset *p);
551 pst_index2_ll* pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr); 562 pst_index2_ll* pst_build_id2(pst_file *pf, pst_index_ll* list);
552 pst_index_ll* pst_getID(pst_file* pf, uint64_t id); 563 pst_index_ll* pst_getID(pst_file* pf, uint64_t id);
553 pst_index_ll* pst_getID2(pst_index2_ll * ptr, uint64_t id); 564 pst_index_ll* pst_getID2(pst_index2_ll * ptr, uint64_t id);
554 pst_desc_ll* pst_getDptr(pst_file *pf, uint64_t id); 565 pst_desc_ll* pst_getDptr(pst_file *pf, uint64_t id);
555 size_t pst_read_block_size(pst_file *pf, int64_t offset, size_t size, char **buf); 566 size_t pst_read_block_size(pst_file *pf, int64_t offset, size_t size, char **buf);
556 int pst_decrypt(uint64_t id, char *buf, size_t size, unsigned char type); 567 int pst_decrypt(uint64_t id, char *buf, size_t size, unsigned char type);