-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathBNLookupTableEntry.cs
More file actions
64 lines (54 loc) · 1.31 KB
/
Copy pathBNLookupTableEntry.cs
File metadata and controls
64 lines (54 loc) · 1.31 KB
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
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
namespace BinaryNinja
{
[StructLayout(LayoutKind.Sequential)]
public unsafe struct BNLookupTableEntry
{
/// <summary>
/// int64_t* fromValues
/// </summary>
internal IntPtr fromValues;
/// <summary>
/// uint64_t fromCount
/// </summary>
internal ulong fromCount;
/// <summary>
/// int64_t toValue
/// </summary>
internal long toValue;
}
public sealed class LookupTableEntry : INativeWrapperEx<BNLookupTableEntry>
{
public long[] FromValues { get; set; } = Array.Empty<long>();
public long ToValue { get; set; } = 0;
public LookupTableEntry()
{
}
internal static LookupTableEntry FromNative(BNLookupTableEntry native)
{
return new LookupTableEntry()
{
FromValues = UnsafeUtils.ReadNumberArray<long>(
native.fromValues ,
native.fromCount
) ,
ToValue = native.toValue
};
}
public BNLookupTableEntry ToNativeEx(ScopedAllocator allocator)
{
return new BNLookupTableEntry()
{
fromValues = (
0 == this.FromValues.Length ? IntPtr.Zero :
allocator.AllocIntegerArray<long>(this.FromValues)
),
fromCount = (ulong)this.FromValues.Length,
toValue = this.ToValue
};
}
}
}