forked from Dijji/XstReader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LayoutsU.cs
187 lines (166 loc) · 4.77 KB
/
LayoutsU.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
// Copyright (c) 2016, Dijji, and released under Ms-PL. This can be found in the root of this distribution.
using System;
using System.Runtime.InteropServices;
namespace XstReader
{
// xst layouts that are Unicode specific
// All layouts and names are taken from <MS-PST>
// Constants
class LayoutsU
{
public const int BTPAGEEntryBytes = 488;
}
// NDB layer
[StructLayout(LayoutKind.Sequential, Pack = 1)]
unsafe struct FileHeader2Unicode
{
public UInt64 bidUnused;
public UInt64 bidNextP;
public UInt32 dwUnique;
public fixed UInt32 rgnid[32];
public UInt64 qwUnused;
public RootUnicode root;
public UInt32 dwAlign;
public fixed Byte rgbFM[128];
public fixed Byte rgbFP[128];
public Byte bSentinel;
public EbCryptMethod bCryptMethod;
public UInt32 rgbReserved;
public UInt64 bidNextB;
public UInt32 dwCRCFull;
public UInt32 rgbReserved2;
public fixed Byte rgbReserved3[32];
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct RootUnicode
{
public UInt32 dwReserved;
public UInt64 ibFileEof;
public UInt64 ibAMapLast;
public UInt64 cbAMapFree;
public UInt64 cbPMapFree;
public BREFUnicode BREFNBT;
public BREFUnicode BREFBBT;
public Byte fAMapValid;
public Byte bReserved;
public UInt16 wReserved;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BREFUnicode
{
public UInt64 bid;
public UInt64 ib;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
unsafe struct BTPAGEUnicode
{
public fixed Byte rgentries[LayoutsU.BTPAGEEntryBytes];
public Byte cEnt;
public Byte cEntMax;
public Byte cbEnt;
public Byte cLevel;
public UInt32 dwPadding;
public PAGETRAILERUnicode pageTrailer;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct PAGETRAILERUnicode
{
public Eptype ptype;
public Eptype ptypeRepeat;
public UInt16 wSig;
public UInt32 dwCRC;
public UInt64 bid;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BTENTRYUnicode
{
public UInt64 btkey;
public BREFUnicode BREF;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BBTENTRYUnicode
{
public BREFUnicode BREF;
public UInt16 cb;
public UInt16 cRef;
public UInt32 dwPadding;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct NBTENTRYUnicode
{
public NID nid;
public UInt32 dwPad;
public UInt64 bidData;
public UInt64 bidSub;
public UInt32 nidParent;
public UInt32 dwPadding;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BLOCKTRAILERUnicode
{
public UInt16 cb;
public UInt16 wSig;
public UInt32 dwCRC;
public UInt64 bid;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct XBLOCKUnicode
{
public EbType btype;
public Byte cLevel;
public UInt16 cEnt;
public UInt32 lcbTotal;
// Marshal the following array manually
//public UInt64[] rgbid;
}
// We just use the XBLOCKUnicode structure for XXBLOCKUnicode, as it is the same
//[StructLayout(LayoutKind.Sequential, Pack = 1)]
//struct XXBLOCKUnicode
//{
// public EbType btype;
// public Byte cLevel;
// public UInt16 cEnt;
// public UInt32 lcbTotal;
// //public UInt64[] rgbid;
//}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct SLENTRYUnicode
{
public UInt64 nid;
public UInt64 bidData;
public UInt64 bidSub;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct SLBLOCKUnicode
{
public EbType btype;
public Byte cLevel;
public UInt16 cEnt;
public UInt32 dwPadding;
// Marshal the following array manually
//public SLENTRYUnicode[] rgentries;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct SIENTRYUnicode
{
public UInt64 nid;
public UInt64 bid;
}
// We just use the SLBLOCKUnicode structure for SIBLOCKUnicode, as it is the same apart from the array type
//[StructLayout(LayoutKind.Sequential, Pack = 1)]
//struct SIBLOCKUnicode
//{
// public EbType btype;
// public Byte cLevel;
// public UInt16 cEnt;
// public UInt32 dwPadding;
// public SIENTRYUnicode[] rgentries;
//}
// LTP layer
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct TCROWIDUnicode
{
public UInt32 dwRowID;
public UInt32 dwRowIndex;
}
}