-
Notifications
You must be signed in to change notification settings - Fork 424
/
ReparseBuffer.cs
718 lines (662 loc) · 25 KB
/
ReparseBuffer.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
// Copyright 2019 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.IO;
using System.Text;
namespace NtApiDotNet
{
#pragma warning disable 1591
/// <summary>
/// Reparse Tag value.
/// </summary>
public enum ReparseTag : uint
{
NONE = 0,
MOUNT_POINT = 0xA0000003,
HSM = 0xC0000004,
DRIVE_EXTENDER = 0x80000005,
HSM2 = 0x80000006,
SIS = 0x80000007,
WIM = 0x80000008,
CSV = 0x80000009,
DFS = 0x8000000A,
FILTER_MANAGER = 0x8000000B,
SYMLINK = 0xA000000C,
IIS_CACHE = 0xA0000010,
DFSR = 0x80000012,
DEDUP = 0x80000013,
APPXSTRM = 0xC0000014,
NFS = 0x80000014,
FILE_PLACEHOLDER = 0x80000015,
DFM = 0x80000016,
WOF = 0x80000017,
WCI = 0x80000018,
WCI_1 = 0x90001018,
GLOBAL_REPARSE = 0xA0000019,
CLOUD = 0x9000001A,
CLOUD_1 = 0x9000101A,
CLOUD_2 = 0x9000201A,
CLOUD_3 = 0x9000301A,
CLOUD_4 = 0x9000401A,
CLOUD_5 = 0x9000501A,
CLOUD_6 = 0x9000601A,
CLOUD_7 = 0x9000701A,
CLOUD_8 = 0x9000801A,
CLOUD_9 = 0x9000901A,
CLOUD_A = 0x9000A01A,
CLOUD_B = 0x9000B01A,
CLOUD_C = 0x9000C01A,
CLOUD_D = 0x9000D01A,
CLOUD_E = 0x9000E01A,
CLOUD_F = 0x9000F01A,
CLOUD_MASK = 0x0000F000,
APPEXECLINK = 0x8000001B,
PROJFS = 0x9000001C,
LX_SYMLINK = 0xA000001D,
STORAGE_SYNC = 0x8000001E,
WCI_TOMBSTONE = 0xA000001F,
UNHANDLED = 0x80000020,
ONEDRIVE = 0x80000021,
PROJFS_TOMBSTONE = 0xA0000022,
AF_UNIX = 0x80000023,
LX_FIFO = 0x80000024,
LX_CHR = 0x80000025,
LX_BLK = 0x80000026,
}
[Flags]
public enum ReparseBufferExFlags
{
None = 0,
GivenTagOrNone = 1,
}
#pragma warning restore 1591
/// <summary>
/// Base class for a reparse buffer.
/// </summary>
public abstract class ReparseBuffer
{
/// <summary>
/// The reparse tag in the buffer.
/// </summary>
public ReparseTag Tag { get; set; }
/// <summary>
/// Function to initialize this class by parsing the reparse buffer data (not including header).
/// </summary>
/// <param name="data_length">The length of the data to read.</param>
/// <param name="reader">The stream to read from.</param>
protected abstract void ParseBuffer(int data_length, BinaryReader reader);
/// <summary>
/// Get reparse buffer data as a byte array (not including header).
/// </summary>
/// <returns>The reparse buffer data.</returns>
protected abstract byte[] GetBuffer();
/// <summary>
/// Constructor.
/// </summary>
/// <param name="tag">The reparse tag to assign.</param>
protected ReparseBuffer(ReparseTag tag)
{
Tag = tag;
}
/// <summary>
/// Get a reparse buffer from a byte array.
/// </summary>
/// <param name="ba">The byte array to parse</param>
/// <returns>The reparse buffer.</returns>
public static ReparseBuffer FromByteArray(byte[] ba)
{
BinaryReader reader = new BinaryReader(new MemoryStream(ba), Encoding.Unicode);
ReparseTag tag = (ReparseTag)reader.ReadUInt32();
int data_length = reader.ReadUInt16();
// Reserved
reader.ReadUInt16();
long remaining_length = reader.RemainingLength();
long expected_length = data_length;
if (!NtFileUtils.IsReparseTagMicrosoft(tag))
{
expected_length += 16;
}
if (remaining_length != expected_length)
{
// Corrupted buffer. Return an opaque buffer with all the data until the end.
return new OpaqueReparseBuffer(tag, reader.ReadToEnd());
}
ReparseBuffer buffer;
switch (tag)
{
case ReparseTag.MOUNT_POINT:
buffer = new MountPointReparseBuffer();
break;
case ReparseTag.SYMLINK:
buffer = new SymlinkReparseBuffer(false);
break;
case ReparseTag.GLOBAL_REPARSE:
buffer = new SymlinkReparseBuffer(true);
break;
case ReparseTag.APPEXECLINK:
buffer = new ExecutionAliasReparseBuffer();
break;
default:
if (NtFileUtils.IsReparseTagMicrosoft(tag))
{
buffer = new OpaqueReparseBuffer(tag);
}
else
{
buffer = new GenericReparseBuffer(tag);
}
break;
}
buffer.ParseBuffer(data_length, reader);
return buffer;
}
/// <summary>
/// Get a reparse buffer from a byte array.
/// </summary>
/// <param name="ba">The byte array to parse</param>
/// <param name="opaque_buffer">True to return an opaque buffer if
/// the tag isn't known, otherwise try and parse as a generic buffer</param>
/// <returns>The reparse buffer.</returns>
[Obsolete("Opaque buffer now automatically determined, use FromByteArray without the parameter")]
public static ReparseBuffer FromByteArray(byte[] ba, bool opaque_buffer)
{
BinaryReader reader = new BinaryReader(new MemoryStream(ba), Encoding.Unicode);
ReparseTag tag = (ReparseTag)reader.ReadUInt32();
int data_length = reader.ReadUInt16();
// Reserved
reader.ReadUInt16();
if (data_length != reader.RemainingLength())
{
// Possibly corrupted. Return an opaque buffer with all the data until the end.
return new OpaqueReparseBuffer(tag, reader.ReadToEnd());
}
ReparseBuffer buffer;
switch (tag)
{
case ReparseTag.MOUNT_POINT:
buffer = new MountPointReparseBuffer();
break;
case ReparseTag.SYMLINK:
buffer = new SymlinkReparseBuffer(false);
break;
case ReparseTag.GLOBAL_REPARSE:
buffer = new SymlinkReparseBuffer(true);
break;
case ReparseTag.APPEXECLINK:
buffer = new ExecutionAliasReparseBuffer();
break;
case ReparseTag.AF_UNIX:
buffer = new OpaqueReparseBuffer(ReparseTag.AF_UNIX);
break;
default:
if (opaque_buffer || reader.RemainingLength() < 16)
{
buffer = new OpaqueReparseBuffer(tag);
}
else
{
buffer = new GenericReparseBuffer(tag);
}
break;
}
buffer.ParseBuffer(data_length, reader);
return buffer;
}
/// <summary>
/// Convert reparse buffer to a byte array in REPARSE_DATA_BUFFER format.
/// </summary>
/// <returns>The reparse buffer as a byte array.</returns>
public byte[] ToByteArray()
{
byte[] buffer = GetBuffer();
MemoryStream stm = new MemoryStream();
BinaryWriter writer = new BinaryWriter(stm);
writer.Write((uint)Tag);
if (buffer.Length > ushort.MaxValue)
{
throw new ArgumentException("Reparse buffer too large");
}
writer.Write((ushort)buffer.Length);
writer.Write((ushort)0);
if (this is GenericReparseBuffer generic)
{
writer.Write(generic.Guid.ToByteArray());
}
writer.Write(buffer);
return stm.ToArray();
}
/// <summary>
/// Convert reparse buffer to a byte array in the REPARSE_DATA_BUFFER_EX format.
/// </summary>
/// <param name="flags">Flags for the buffer.</param>
/// <param name="existing_guid">Existing GUID to match against.</param>
/// <param name="existing_tag">Existing tag to matcha against.</param>
/// <returns>The reparse buffer as a byte array.</returns>
public byte[] ToByteArray(ReparseBufferExFlags flags, ReparseTag existing_tag, Guid existing_guid)
{
MemoryStream stm = new MemoryStream();
BinaryWriter writer = new BinaryWriter(stm);
// Flags.
writer.Write((int)flags);
// Existing tag.
writer.Write((uint)existing_tag);
// Existing GUID for non-Microsoft tags.
writer.Write(existing_guid.ToByteArray());
// Reserved (64 bit)
writer.Write(0L);
// The original reparse buffer.
writer.Write(ToByteArray());
return stm.ToArray();
}
/// <summary>
/// Get if a reparse tag is a Microsoft defined one.
/// </summary>
public bool IsMicrosoft => NtFileUtils.IsReparseTagMicrosoft(Tag);
/// <summary>
/// Get if a reparse tag is a name surrogate.
/// </summary>
/// <returns>True if it's a surrogate reparse tag.</returns>
public bool IsNameSurrogate => NtFileUtils.IsReparseTagNameSurrogate(Tag);
/// <summary>
/// Get if a reparse tag is a directory.
/// </summary>
public bool IsTagDirectory => NtFileUtils.IsReparseTagDirectory(Tag);
}
/// <summary>
/// Generic GUID reparse buffer.
/// </summary>
public sealed class GenericReparseBuffer : ReparseBuffer
{
/// <summary>
/// Constructor.
/// </summary>
/// <param name="tag">The reparse tag.</param>
/// <param name="guid">The reparse GUID</param>
/// <param name="data">Additional reparse data.</param>
public GenericReparseBuffer(uint tag, Guid guid, byte[] data) : base((ReparseTag)tag)
{
Data = (byte[])data.Clone();
Guid = guid;
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="tag">The reparse tag.</param>
/// <param name="guid">The reparse GUID</param>
/// <param name="data">Additional reparse data.</param>
public GenericReparseBuffer(ReparseTag tag, Guid guid, byte[] data) : base(tag)
{
Data = (byte[])data.Clone();
Guid = guid;
}
internal GenericReparseBuffer(ReparseTag tag) : base(tag)
{
}
/// <summary>
/// The reparse GUID.
/// </summary>
public Guid Guid { get; set; }
/// <summary>
/// Additional reparse data.
/// </summary>
public byte[] Data { get; set; }
/// <summary>
/// Get reparse buffer data as a byte array (not including header).
/// </summary>
/// <returns>The reparse buffer data.</returns>
protected override byte[] GetBuffer()
{
MemoryStream stm = new MemoryStream();
BinaryWriter writer = new BinaryWriter(stm);
writer.Write(Data);
return stm.ToArray();
}
/// <summary>
/// Function to initialize this class by parsing the reparse buffer data (not including header).
/// </summary>
/// <param name="data_length">The length of the data to read.</param>
/// <param name="reader">The stream to read from.</param>
protected override void ParseBuffer(int data_length, BinaryReader reader)
{
Guid = new Guid(reader.ReadAllBytes(16));
Data = reader.ReadAllBytes(data_length);
}
}
/// <summary>
/// Reparse buffer with an opaque data blob.
/// </summary>
public sealed class OpaqueReparseBuffer : ReparseBuffer
{
/// <summary>
/// Constructor.
/// </summary>
/// <param name="tag">The reparse tag.</param>
/// <param name="data">The opaque data blob.</param>
public OpaqueReparseBuffer(ReparseTag tag, byte[] data) : base(tag)
{
Data = (byte[])data.Clone();
}
internal OpaqueReparseBuffer(ReparseTag tag) : base(tag)
{
}
/// <summary>
/// The opaque data blob.
/// </summary>
public byte[] Data { get; set; }
/// <summary>
/// Get reparse buffer data as a byte array (not including header).
/// </summary>
/// <returns>The reparse buffer data.</returns>
protected override byte[] GetBuffer()
{
return Data;
}
/// <summary>
/// Function to initialize this class by parsing the reparse buffer data (not including header).
/// </summary>
/// <param name="data_length">The length of the data to read.</param>
/// <param name="reader">The stream to read from.</param>
protected override void ParseBuffer(int data_length, BinaryReader reader)
{
Data = reader.ReadAllBytes(data_length);
}
}
/// <summary>
/// Reparse buffer for an NTFS mount point.
/// </summary>
public sealed class MountPointReparseBuffer : ReparseBuffer
{
/// <summary>
/// Constructor.
/// </summary>
/// <param name="substitution_name">Substitution name to reparse to when accessing mount point.</param>
/// <param name="print_name">Printable name for the mount point.</param>
public MountPointReparseBuffer(string substitution_name, string print_name) : base(ReparseTag.MOUNT_POINT)
{
if (string.IsNullOrEmpty(substitution_name))
{
throw new ArgumentException("substitution_name");
}
SubstitutionName = substitution_name;
PrintName = print_name ?? string.Empty;
}
internal MountPointReparseBuffer() : base(ReparseTag.MOUNT_POINT)
{
}
/// <summary>
/// Substitution name to reparse to when accessing mount point.
/// </summary>
public string SubstitutionName { get; set; }
/// <summary>
/// Printable name for the mount point.
/// </summary>
public string PrintName { get; set; }
/// <summary>
/// Function to initialize this class by parsing the reparse buffer data (not including header).
/// </summary>
/// <param name="data_length">The length of the data to read.</param>
/// <param name="reader">The stream to read from.</param>
protected override void ParseBuffer(int data_length, BinaryReader reader)
{
int subname_ofs = reader.ReadUInt16();
int subname_len = reader.ReadUInt16();
int pname_ofs = reader.ReadUInt16();
int pname_len = reader.ReadUInt16();
byte[] path_buffer = reader.ReadAllBytes(data_length - 8);
SubstitutionName = Encoding.Unicode.GetString(path_buffer, subname_ofs, subname_len);
PrintName = Encoding.Unicode.GetString(path_buffer, pname_ofs, pname_len);
}
/// <summary>
/// Get reparse buffer data as a byte array (not including header).
/// </summary>
/// <returns>The reparse buffer data.</returns>
protected override byte[] GetBuffer()
{
MemoryStream stm = new MemoryStream();
BinaryWriter writer = new BinaryWriter(stm);
byte[] subname = Encoding.Unicode.GetBytes(SubstitutionName);
byte[] pname = Encoding.Unicode.GetBytes(PrintName);
// SubstituteNameOffset
writer.Write((ushort)0);
// SubstituteNameLength
writer.Write((ushort)subname.Length);
// PrintNameOffset
writer.Write((ushort)(subname.Length + 2));
// PrintNameLength
writer.Write((ushort)pname.Length);
writer.Write(subname);
writer.Write(new byte[2]);
writer.Write(pname);
writer.Write(new byte[2]);
return stm.ToArray();
}
}
/// <summary>
/// Symlink flags.
/// </summary>
public enum SymlinkReparseBufferFlags
{
/// <summary>
/// None.
/// </summary>
None = 0,
/// <summary>
/// Substitution name is relative to the symlink.
/// </summary>
Relative = 1,
}
/// <summary>
/// Reparse buffer for an NTFS symlink.
/// </summary>
public sealed class SymlinkReparseBuffer : ReparseBuffer
{
/// <summary>
/// Constructor.
/// </summary>
/// <param name="substitution_name">Substitution name to reparse to when accessing symlink.</param>
/// <param name="print_name">Printable name for the symlink.</param>
/// <param name="flags">Symlink flags.</param>
public SymlinkReparseBuffer(string substitution_name,
string print_name, SymlinkReparseBufferFlags flags)
: this(substitution_name, print_name, flags, false)
{
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="substitution_name">Substitution name to reparse to when accessing symlink.</param>
/// <param name="print_name">Printable name for the symlink.</param>
/// <param name="flags">Symlink flags.</param>
/// <param name="global">Create a global symlink rather than a normal symlink.</param>
public SymlinkReparseBuffer(string substitution_name,
string print_name, SymlinkReparseBufferFlags flags,
bool global)
: this(global)
{
if (string.IsNullOrEmpty(substitution_name))
{
throw new ArgumentException("substitution_name");
}
if (string.IsNullOrEmpty(print_name))
{
throw new ArgumentException("print_name");
}
SubstitutionName = substitution_name;
PrintName = print_name;
Flags = flags;
}
internal SymlinkReparseBuffer(bool global)
: base(global ? ReparseTag.GLOBAL_REPARSE : ReparseTag.SYMLINK)
{
}
/// <summary>
/// Substitution name to reparse to when accessing symlink.
/// </summary>
public string SubstitutionName { get; set; }
/// <summary>
/// Printable name for the symlink.
/// </summary>
public string PrintName { get; set; }
/// <summary>
/// Symlink flags.
/// </summary>
public SymlinkReparseBufferFlags Flags { get; set; }
/// <summary>
/// Function to initialize this class by parsing the reparse buffer data (not including header).
/// </summary>
/// <param name="data_length">The length of the data to read.</param>
/// <param name="reader">The stream to read from.</param>
protected override void ParseBuffer(int data_length, BinaryReader reader)
{
int subname_ofs = reader.ReadUInt16();
int subname_len = reader.ReadUInt16();
int pname_ofs = reader.ReadUInt16();
int pname_len = reader.ReadUInt16();
Flags = (SymlinkReparseBufferFlags)reader.ReadInt32();
byte[] path_buffer = reader.ReadAllBytes(data_length - 12);
SubstitutionName = Encoding.Unicode.GetString(path_buffer, subname_ofs, subname_len);
PrintName = Encoding.Unicode.GetString(path_buffer, pname_ofs, pname_len);
}
/// <summary>
/// Get reparse buffer data as a byte array (not including header).
/// </summary>
/// <returns>The reparse buffer data.</returns>
protected override byte[] GetBuffer()
{
MemoryStream stm = new MemoryStream();
BinaryWriter writer = new BinaryWriter(stm);
byte[] subname = Encoding.Unicode.GetBytes(SubstitutionName);
byte[] pname = Encoding.Unicode.GetBytes(PrintName);
// SubstituteNameOffset
writer.Write((ushort)0);
// SubstituteNameLength
writer.Write((ushort)subname.Length);
// PrintNameOffset
writer.Write((ushort)(subname.Length + 2));
// PrintNameLength
writer.Write((ushort)pname.Length);
writer.Write((int)Flags);
writer.Write(subname);
writer.Write(new byte[2]);
writer.Write(pname);
writer.Write(new byte[2]);
return stm.ToArray();
}
}
/// <summary>
/// Application type for execution alias.
/// </summary>
public enum ExecutionAliasAppType
{
/// <summary>
/// Desktop bridge application.
/// </summary>
Desktop = 0,
/// <summary>
/// UWP type 1
/// </summary>
UWP1 = 1,
/// <summary>
/// UWP type 2
/// </summary>
UWP2 = 2,
/// <summary>
/// UWP type 3
/// </summary>
UWP3 = 3
}
/// <summary>
/// Reparse buffer for an execution alias.
/// </summary>
public class ExecutionAliasReparseBuffer : ReparseBuffer
{
/// <summary>
/// The execution alias version.
/// </summary>
public int Version { get; set; }
/// <summary>
/// The name of the application package.
/// </summary>
public string PackageName { get; set; }
/// <summary>
/// The entry point in the package.
/// </summary>
public string EntryPoint { get; set; }
/// <summary>
/// The target executable.
/// </summary>
public string Target { get; set; }
/// <summary>
/// Application type for the alias.
/// </summary>
public ExecutionAliasAppType AppType { get; set; }
/// <summary>
/// Flags, obsolete.
/// </summary>
[Obsolete("Use AppType instead")]
public int Flags
{
get => ((int)AppType).ToString()[0];
set => throw new NotImplementedException();
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="version">The execution alias version.</param>
/// <param name="package_name">The name of the application package.</param>
/// <param name="entry_point">The entry point in the package.</param>
/// <param name="target">The target executable.</param>
/// <param name="apptype">Apptype for the alias.</param>
public ExecutionAliasReparseBuffer(int version, string package_name, string entry_point, string target, ExecutionAliasAppType apptype)
: this()
{
Version = version;
PackageName = package_name;
EntryPoint = entry_point;
Target = target;
AppType = apptype;
}
internal ExecutionAliasReparseBuffer() : base(ReparseTag.APPEXECLINK)
{
}
/// <summary>
/// Get reparse buffer data as a byte array (not including header).
/// </summary>
/// <returns>The reparse buffer data.</returns>
protected override byte[] GetBuffer()
{
MemoryStream stm = new MemoryStream();
BinaryWriter writer = new BinaryWriter(stm, Encoding.Unicode);
writer.Write(Version);
writer.WriteNulTerminated(PackageName);
writer.WriteNulTerminated(EntryPoint);
writer.WriteNulTerminated(Target);
writer.WriteNulTerminated(((int)AppType).ToString());
return stm.ToArray();
}
/// <summary>
/// Function to initialize this class by parsing the reparse buffer data (not including header).
/// </summary>
/// <param name="data_length">The length of the data to read.</param>
/// <param name="reader">The stream to read from.</param>
protected override void ParseBuffer(int data_length, BinaryReader reader)
{
Version = reader.ReadInt32();
PackageName = reader.ReadNulTerminated();
EntryPoint = reader.ReadNulTerminated();
Target = reader.ReadNulTerminated();
AppType = (ExecutionAliasAppType)int.Parse(reader.ReadNulTerminated());
}
}
}