26#if defined(__GNUC__) || defined (__SUNPRO_C) || defined(__SUNPRO_CC)
31#define PST_TYPE_NOTE 1
32#define PST_TYPE_SCHEDULE 2
33#define PST_TYPE_APPOINTMENT 8
34#define PST_TYPE_CONTACT 9
35#define PST_TYPE_JOURNAL 10
36#define PST_TYPE_STICKYNOTE 11
37#define PST_TYPE_TASK 12
38#define PST_TYPE_OTHER 13
39#define PST_TYPE_REPORT 14
40#define PST_TYPE_MAX 15
43#define PST_NO_ENCRYPT 0
44#define PST_COMP_ENCRYPT 1
48#define PST_MAP_ATTRIB (uint32_t)1
49#define PST_MAP_HEADER (uint32_t)2
52#define PST_ATTRIB_HEADER -1
55#define PST_FREEBUSY_FREE 0
56#define PST_FREEBUSY_TENTATIVE 1
57#define PST_FREEBUSY_BUSY 2
58#define PST_FREEBUSY_OUT_OF_OFFICE 3
61#define PST_APP_LABEL_NONE 0
62#define PST_APP_LABEL_IMPORTANT 1
63#define PST_APP_LABEL_BUSINESS 2
64#define PST_APP_LABEL_PERSONAL 3
65#define PST_APP_LABEL_VACATION 4
66#define PST_APP_LABEL_MUST_ATTEND 5
67#define PST_APP_LABEL_TRAVEL_REQ 6
68#define PST_APP_LABEL_NEEDS_PREP 7
69#define PST_APP_LABEL_BIRTHDAY 8
70#define PST_APP_LABEL_ANNIVERSARY 9
71#define PST_APP_LABEL_PHONE_CALL 10
74#define PST_APP_RECUR_NONE 0
75#define PST_APP_RECUR_DAILY 1
76#define PST_APP_RECUR_WEEKLY 2
77#define PST_APP_RECUR_MONTHLY 3
78#define PST_APP_RECUR_YEARLY 4
81#define PST_ATTACH_NONE 0
82#define PST_ATTACH_BY_VALUE 1
83#define PST_ATTACH_BY_REF 2
84#define PST_ATTACH_BY_REF_RESOLV 3
85#define PST_ATTACH_BY_REF_ONLY 4
86#define PST_ATTACH_EMBEDDED 5
87#define PST_ATTACH_OLE 6
90#define PST_FLAG_READ 0x01
91#define PST_FLAG_UNMODIFIED 0x02
92#define PST_FLAG_SUBMIT 0x04
93#define PST_FLAG_UNSENT 0x08
94#define PST_FLAG_HAS_ATTACHMENT 0x10
95#define PST_FLAG_FROM_ME 0x20
96#define PST_FLAG_ASSOCIATED 0x40
97#define PST_FLAG_RESEND 0x80
98#define PST_FLAG_RN_PENDING 0x100
99#define PST_FLAG_NRN_PENDING 0x200
1067size_t pst_fwrite(
const void* ptr,
size_t size,
size_t nmemb, FILE* stream);
1165#if defined(__GNUC__) || defined (__SUNPRO_C) || defined(__SUNPRO_CC)
char * pst_rfc2445_datetime_format_now(int buflen, char *result)
Convert the current time rfc2445 date/time format 19531015T231000Z.
void pst_convert_utf8_null(pst_item *item, pst_string *str)
Convert str to utf8 if possible; null strings are preserved.
const char * pst_default_charset(pst_item *item, int buflen, char *result)
Get the default character set for this item.
void pst_free_recurrence(pst_recurrence *r)
Free a recurrence structure.
void pst_convert_utf8(pst_item *item, pst_string *str)
Convert str to utf8 if possible; null strings are converted into empty strings.
char * pst_rfc2445_datetime_format(const FILETIME *ft, int buflen, char *result)
Convert a FILETIME into rfc2445 date/time format 19531015T231000Z.
size_t pst_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
fwrite with checking for null pointer.
size_t pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE *fp)
Write a binary attachment base64 encoded to a file.
int pst_stricmp(char *a, char *b)
compare strings case-insensitive.
void pst_rfc2047(pst_item *item, pst_string *str, int needs_quote)
Convert str to rfc2047 encoding of str, possibly enclosed in quotes if it contains spaces.
int pst_load_index(pst_file *pf)
Load the index entries from the pst file.
pst_item * pst_parse_item(pst_file *pf, pst_desc_tree *d_ptr, pst_id2_tree *m_head)
Assemble a mapi object from a descriptor pointer.
int pst_close(pst_file *pf)
Close a pst file.
pst_desc_tree * pst_getNextDptr(pst_desc_tree *d)
Walk the descriptor tree.
int pst_load_extended_attributes(pst_file *pf)
Load the extended attribute mapping table from the pst file.
int pst_open(pst_file *pf, const char *name, const char *charset)
Open a pst file.
size_t pst_attach_to_file(pst_file *pf, pst_item_attach *attach, FILE *fp)
Write a binary attachment to a file.
pst_binary pst_attach_to_mem(pst_file *pf, pst_item_attach *attach)
Assemble the binary attachment into a single buffer.
void pst_rfc2231(pst_string *str)
Convert str to rfc2231 encoding of str.
size_t pst_ff_getIDblock_dec(pst_file *pf, uint64_t i_id, char **buf)
Get an ID block from the file using pst_ff_getIDblock() and decrypt if necessary.
pst_recurrence * pst_convert_recurrence(pst_item_appointment *appt)
Decode raw recurrence data into a better structure.
char * pst_rfc2426_escape(char *str, char **result, size_t *resultlen)
Add any necessary escape characters for rfc2426 vcard format.
pst_index_ll * pst_getID(pst_file *pf, uint64_t i_id)
Lookup the i_id in the index linked list, and return a pointer to the element.
void pst_freeItem(pst_item *item)
Free the item returned by pst_parse_item().
int pst_reopen(pst_file *pf)
Reopen the pst file after a fork.
pst_desc_tree * pst_getTopOfFolders(pst_file *pf, const pst_item *root)
Get the top of folders descriptor tree.
char * pst_rfc2425_datetime_format(const FILETIME *ft, int buflen, char *result)
Convert a FILETIME into rfc2425 date/time format 1953-10-15T23:10:00Z which is the same as one of the...
a simple wrapper for binary blobs
this is only used for internal debugging
struct pst_block_recorder * next
struct pst_desc_tree * next
struct pst_desc_tree * child
pst_index_ll * assoc_tree
struct pst_desc_tree * prev
struct pst_desc_tree * child_tail
struct pst_desc_tree * parent
char * cwd
original cwd when the file was opened
uint64_t index1
file offset of the first b-tree node in the index tree
uint64_t index2
file offset of the first b-tree node in the descriptor tree
uint64_t index1_back
back pointer value in the first b-tree node in the index tree
pst_index_ll * i_table
the array of index structures
unsigned char ind_type
index type or file type
uint64_t size
size of the pst file
pst_block_recorder * block_head
the head of the block recorder, a debug artifact used to detect cases where we might read the same bl...
uint64_t index2_back
back pointer value in the first b-tree node in the descriptor tree
pst_desc_tree * d_head
the head and tail of the top level of the descriptor tree
FILE * fp
file pointer to opened PST file
pst_x_attrib_ll * x_head
the head of the extended attributes linked list
char * fname
original file name when the file was opened
const char * charset
default character set for items without one
struct pst_id2_tree * child
struct pst_id2_tree * next
This contains the appointment related mapi elements.
pst_string location
mapi element 0x8208 PR_OUTLOOK_EVENT_LOCATION
pst_string recurrence_description
mapi element 0x8232 recurrence description
int32_t label
mapi element 0x8214
int32_t alarm_minutes
mapi element 0x8501 PR_OUTLOOK_COMMON_REMINDER_MINUTES_BEFORE
pst_string alarm_filename
mapi element 0x851f
int all_day
mapi element 0x8215 PR_OUTLOOK_EVENT_ALL_DAY
FILETIME * end
mapi element 0x820e PR_OUTLOOK_EVENT_START_END
int is_recurring
mapi element 0x8223 PR_OUTLOOK_EVENT_IS_RECURRING
int32_t showas
mapi element 0x8205 PR_OUTLOOK_EVENT_SHOW_TIME_AS
pst_string timezonestring
mapi element 0x8234
FILETIME * reminder
mapi element 0x8560
int32_t recurrence_type
mapi element 0x8231
FILETIME * recurrence_start
mapi element 0x8235 PR_OUTLOOK_EVENT_RECURRENCE_START
FILETIME * recurrence_end
mapi element 0x8236 PR_OUTLOOK_EVENT_RECURRENCE_END
FILETIME * start
mapi element 0x820d PR_OUTLOOK_EVENT_START_DATE
pst_binary recurrence_data
mapi element 0x8216 recurrence data
int alarm
mapi element 0x8503 PR_OUTLOOK_COMMON_REMINDER_SET
This contains the attachment related mapi elements.
pst_id2_tree * id2_head
id2 tree needed to resolve attachments by reference
uint64_t i_id
calculated from id2_val during creation of record
struct pst_item_attach * next
uint64_t id2_val
only used if the attachment is by reference, in which case this is the id2 reference
pst_string filename2
mapi element 0x3707 PR_ATTACH_LONG_FILENAME
int32_t method
mapi element 0x3705 PR_ATTACH_METHOD
int32_t position
mapi element 0x370b PR_RENDERING_POSITION
pst_string filename1
mapi element 0x3704 PR_ATTACH_FILENAME
pst_string mimetype
mapi element 0x370e PR_ATTACH_MIME_TAG
int32_t sequence
mapi element 0x3710 PR_ATTACH_MIME_SEQUENCE
pst_binary data
mapi element 0x3701 PR_ATTACH_DATA_OBJ
pst_string content_id
mapi element 0x3712 PR_ATTACH_CONTENT_ID
This contains the email related mapi elements.
pst_string messageid
mapi element 0x1035
pst_string outlook_sender2
mapi element 0x0c1d PR_SENDER_SEARCH_KEY
pst_string processed_subject
mapi element 0x0070 PR_CONVERSATION_TOPIC
pst_string outlook_search_key
mapi element 0x300b PR_SEARCH_KEY
int conversion_prohibited
mapi element 0x3a03 PR_CONVERSION_PROHIBITED
pst_string sender_access
mapi element 0x0064 PR_SENT_REPRESENTING_ADDRTYPE
int read_receipt
mapi element 0x0029 PR_READ_RECEIPT_REQUESTED
pst_string sentto_address
mapi element 0x0e04 PR_DISPLAY_TO
int32_t sensitivity
mapi element 0x0036 PR_SENSITIVITY
pst_string rtf_body_tag
mapi element 0x1008 PR_RTF_SYNC_BODY_TAG, the first couple of lines of RTF body so that after modific...
FILETIME * report_time
mapi element 0x0032 PR_REPORT_TIME, delivery report time
pst_binary encrypted_body
mapi element 0x6f04
pst_string sender2_access
mapi element 0x0c1e PR_SENDER_ADDRTYPE
int rtf_in_sync
mapi element 0x0e1f PR_RTF_IN_SYNC, True means that the rtf version is same as text body.
pst_binary encrypted_htmlbody
mapi element 0x6f02
int32_t original_sensitivity
mapi element 0x002e PR_ORIGINAL_SENSITIVITY
pst_string return_path_address
mapi element 0x1046, this seems to be the message-id of the rfc822 mail that is being returned
pst_string outlook_received_name1
mapi element 0x0040 PR_RECEIVED_BY_NAME
int32_t ndr_diag_code
mapi element 0x0c05 PR_NDR_DIAG_CODE
int32_t rtf_body_crc
mapi element 0x1006 PR_RTF_SYNC_BODY_CRC
pst_string outlook_normalized_subject
mapi element 0x0e1d PR_NORMALIZED_SUBJECT
pst_string in_reply_to
mapi element 0x1042
int delete_after_submit
mapi element 0x0e01 PR_DELETE_AFTER_SUBMIT
int32_t ndr_status_code
mapi element 0x0c20 PR_NDR_STATUS_CODE
int message_to_me
mapi element 0x0057 PR_MESSAGE_TO_ME, this user is listed explicitly in the TO address
int delivery_report
mapi element 0x0023 PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED
int autoforward
mapi element 0x0002 PR_ALTERNATE_RECIPIENT_ALLOWED
int message_cc_me
mapi element 0x0058 PR_MESSAGE_CC_ME, this user is listed explicitly in the CC address
pst_string original_cc
mapi element 0x0073 PR_ORIGINAL_DISPLAY_CC
pst_string sender_address
mapi element 0x0065 PR_SENT_REPRESENTING_EMAIL_ADDRESS
pst_string recip2_address
mapi element 0x0078 PR_RCVD_REPRESENTING_EMAIL_ADDRESS
pst_string outlook_recipient_name
mapi element 0x0044 PR_RCVD_REPRESENTING_NAME
int32_t ndr_reason_code
mapi element 0x0c04 PR_NDR_REASON_CODE
pst_string original_to
mapi element 0x0074 PR_ORIGINAL_DISPLAY_TO
pst_string bcc_address
mapi element 0x0e02 PR_DISPLAY_BCC
pst_binary rtf_compressed
mapi element 0x1009 PR_RTF_COMPRESSED, the compressed rtf body data.
pst_string outlook_sender_name2
mapi element 0x0c1a PR_SENDER_NAME
pst_string sender2_address
mapi element 0x0c1f PR_SENDER_EMAIL_ADDRESS
pst_string outlook_recipient2
mapi element 0x0052 PR_RCVD_REPRESENTING_SEARCH_KEY
pst_string htmlbody
mapi element 0x1013
int32_t importance
mapi element 0x0017 PR_IMPORTANCE
pst_string report_text
mapi element 0x1001 PR_REPORT_TEXT, delivery report dsn body
FILETIME * arrival_date
mapi element 0x0e06 PR_MESSAGE_DELIVERY_TIME
int32_t rtf_body_char_count
mapi element 0x1007 PR_RTF_SYNC_BODY_COUNT, a count of the significant characters in the rtf body.
pst_string header
mapi element 0x007d PR_TRANSPORT_MESSAGE_HEADERS
pst_string supplementary_info
mapi element 0x0c1b PR_SUPPLEMENTARY_INFO
pst_entryid * sentmail_folder
mapi element 0x0e0a PR_SENTMAIL_ENTRYID
int32_t priority
mapi element 0x0026 PR_PRIORITY
pst_string recip2_access
mapi element 0x0077 PR_RCVD_REPRESENTING_ADDRTYPE
int32_t rtf_ws_prefix_count
mapi element 0x1010 PR_RTF_SYNC_PREFIX_COUNT, a count of the ignored characters before the first sign...
pst_string reply_to
mapi element 0x0050 PR_REPLY_RECIPIENT_NAMES
pst_string original_bcc
mapi element 0x0072 PR_ORIGINAL_DISPLAY_BCC
pst_string recip_address
mapi element 0x0076 PR_RECEIVED_BY_EMAIL_ADDRESS
pst_string outlook_sender_name
mapi element 0x0042 PR_SENT_REPRESENTING_NAME
pst_string outlook_recipient
mapi element 0x0051 PR_RECEIVED_BY_SEARCH_KEY
pst_binary conversation_index
mapi element 0x0071 PR_CONVERSATION_INDEX
FILETIME * sent_date
mapi element 0x0039 PR_CLIENT_SUBMIT_TIME
pst_string cc_address
mapi element 0x0e03 PR_DISPLAY_CC
int reply_requested
mapi element 0x0c17 PR_REPLY_REQUESTED
pst_string outlook_sender
mapi element 0x003b PR_SENT_REPRESENTING_SEARCH_KEY
pst_string recip_access
mapi element 0x0075 PR_RECEIVED_BY_ADDRTYPE
int32_t rtf_ws_trailing_count
mapi element 0x1011 PR_RTF_SYNC_TRAILING_COUNT, a count of the ignored characters after the last sign...
int message_recip_me
mapi element 0x0059 PR_MESSAGE_RECIP_ME, this user appears in TO, CC or BCC address list
This contains the folder related mapi elements.
int subfolder
mapi element 0x360a PR_SUBFOLDERS
int32_t unseen_item_count
mapi element 0x3603 PR_CONTENT_UNREAD
int32_t assoc_count
mapi element 0x3617 PR_ASSOC_CONTENT_COUNT Associated content are items that are attached to this fol...
int32_t item_count
mapi element 0x3602 PR_CONTENT_COUNT
This contains the journal related mapi elements.
pst_string description
mapi element 0x8712
pst_string type
mapi element 0x8700
FILETIME * end
mapi element 0x8708
FILETIME * start
mapi element 0x8706
This contains the message store related mapi elements.
int32_t valid_mask
mapi element 0x35df, bit mask of folders in this message store
pst_entryid * search_root_folder
mapi element 0x35e7
pst_entryid * default_outbox_folder
mapi element 0x35e2
pst_entryid * top_of_folder
mapi element 0x7c07
pst_entryid * common_view_folder
mapi element 0x35e6
pst_entryid * sent_items_folder
mapi element 0x35e4
pst_entryid * user_views_folder
mapi element 0x35e5
pst_entryid * deleted_items_folder
mapi element 0x35e3
int32_t pwd_chksum
mapi element 0x76ff
pst_entryid * top_of_personal_folder
mapi element 0x35e0
This contains the common mapi elements, and pointers to structures for each major mapi item type.
int response_requested
mapi element 0x0063 PR_RESPONSE_REQUESTED
int32_t message_size
mapi element 0x0e08 PR_MESSAGE_SIZE
FILETIME * modify_date
mapi element 0x3008 PR_LAST_MODIFICATION_TIME
pst_binary record_key
mapi element 0x0ff9 PR_RECORD_KEY
FILETIME * create_date
mapi element 0x3007 PR_CREATION_TIME
int32_t internet_cpid
mapi element 0x3fde PR_INTERNET_CPID
pst_item_folder * folder
folder mapi elements
pst_item_contact * contact
contact mapi elements
pst_string comment
mapi element 0x3004 PR_COMMENT
int32_t message_codepage
mapi element 0x3ffd PR_MESSAGE_CODEPAGE
int type
derived from mapi elements 0x001a PR_MESSAGE_CLASS or 0x3613 PR_CONTAINER_CLASS
pst_item_message_store * message_store
message store mapi elements
pst_item_attach * attach
linked list of attachments
pst_item_appointment * appointment
calendar mapi elements
pst_item_extra_field * extra_fields
linked list of extra headers and such
char * ascii_type
mapi element 0x001a PR_MESSAGE_CLASS or 0x3613 PR_CONTAINER_CLASS
struct pst_file * pf
pointer to the pst_file
pst_binary predecessor_change
mapi element 0x65e3 PR_PREDECESSOR_CHANGE_LIST
pst_string file_as
mapi element 0x3001 PR_DISPLAY_NAME
int32_t flags
mapi element 0x0e07 PR_MESSAGE_FLAGS
int private_member
mapi element 0x002b PR_RECIPIENT_REASSIGNMENT_PROHIBITED
pst_item_journal * journal
journal mapi elements
pst_string body_charset
derived from extra_fields["content-type"] if it contains a charset= subfield
pst_string subject
mapi element 0x0037 PR_SUBJECT
uint64_t block_id
block id that can be used to generate uid
pst_string body
mapi element 0x1000 PR_BODY
pst_item_email * email
email mapi elements
pst_string outlook_version
mapi element 0x8554 PR_OUTLOOK_VERSION
This contains the recurrence data separated into fields.
uint32_t interval
recurrence interval in terms of the recurrence type
uint32_t termination
type of termination of the recurrence
uint32_t count
number of occurrences, even if recurrence terminates based on date
uint32_t position
occurrence of day for 2nd Tuesday of month, in which case position is 2
uint32_t dayofmonth
day of month for monthly and yearly recurrences
uint32_t signature
0x30043004
uint32_t parm1
must be contiguous, not an array to make Python interface easier
uint32_t bydaymask
bit mask of days of the week
uint32_t monthofyear
month of year for yearly recurrences
uint32_t sub_type
implies number of recurrence parameters
The string is either utf8 encoded, or it is in the code page specified by the containing mapi object.
Linked list of extended attributes.
void * data
data target of the mapping, either uint32_t or string
uint32_t map
key for the mapping
struct pst_x_attrib_ll * next
link to next item in the list