PST File Format SDK v0.4
Loading...
Searching...
No Matches
entryid.h
Go to the documentation of this file.
1#ifndef PSTSDK_PST_ENTRYID_H
2#define PSTSDK_PST_ENTRYID_H
3
5#include "pstsdk/util/util.h"
6#include <cstdint>
7#include <vector>
8
9namespace pstsdk {
10
18
19#pragma pack(push, 1)
21 const uint32_t flags;
23};
24
28
37
43 const uint16_t version;
44 const uint16_t meta;
45 const byte data[];
46
47 // inline bool is_mime() const {
48 // return (meta & 0x0100);
49 // }
50
51 // TODO: 2.2.5.1 says 0x0080 (??), but
52 // https://grep.app/search?q=MAPI_ONE_OFF_UNICODE
53 inline bool is_unicode() const {
54 return (meta & 0x8000);
55 }
56
57 inline std::vector<std::string> read_strings() const {
58 std::vector<std::string> strings;
59 const char *begin = reinterpret_cast<const char *>(&data[0]);
60
61 while (strings.size() < 3) {
62 size_t length = 0;
63 if (is_unicode()) {
64 for (int i = 0; i < 256; i += 2) {
65 const uint16_t *wc = reinterpret_cast<const uint16_t *>(begin + i);
66 if (*wc == 0) {
67 length = i;
68 break;
69 }
70 }
71
72 } else {
73 length = strnlen(begin, 256);
74 }
75
76 if (length == 0)
77 break;
78
79 std::vector<pstsdk::byte> bytes(begin, begin + length);
80 strings.emplace_back(bytes_to_string(bytes));
81 begin = begin + length + (is_unicode() ? 2 : 1);
82 }
83
84 return strings;
85 }
86};
87#pragma pack(pop)
88
89} // namespace pstsdk
90
91#endif
Contains references to other bth_node allocations.
Definition heap.h:364
std::string bytes_to_string(const std::vector< byte > &bytes)
Convert an array of bytes to a std::wstring.
Definition util.h:310
Contains the definition of all in memory representations of disk structures.
Definition disk.h:19
distribution_list_entry_id_type
Definition entryid.h:11
Primitive structures defined by MS-PST and MAPI.
Definition entryid.h:29
uint8_t type
Definition entryid.h:30
byte data[]
Definition entryid.h:31
distribution_list_entry_id_type get_type()
Definition entryid.h:33
const guid provider_uid
Definition entryid.h:22
const uint32_t flags
Definition entryid.h:21
A Win32 GUID structure.
Definition primitives.h:353
One-off recipient EntryID [MS-OXCDATA] 2.2.5.1.
Definition entryid.h:42
bool is_unicode() const
Definition entryid.h:53
const uint16_t version
Definition entryid.h:43
const byte data[]
Definition entryid.h:45
const uint16_t meta
Definition entryid.h:44
std::vector< std::string > read_strings() const
Definition entryid.h:57
General utility functions and classes.