Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ConvertToNative()

static unsafe IntPtr System.StubHelpers.AnsiBSTRMarshaler.ConvertToNative ( int flags,
string strManaged )
inlinestaticpackage

Definition at line 7 of file AnsiBSTRMarshaler.cs.

8 {
9 if (strManaged == null)
10 {
11 return IntPtr.Zero;
12 }
13 byte[] array = null;
14 int cbLength = 0;
15 if (strManaged.Length > 0)
16 {
17 array = AnsiCharMarshaler.DoAnsiConversion(strManaged, (flags & 0xFF) != 0, flags >> 8 != 0, out cbLength);
18 }
19 uint num = (uint)cbLength;
20 IntPtr intPtr = Marshal.AllocBSTRByteLen(num);
21 if (array != null)
22 {
23 Buffer.Memmove(ref *(byte*)(void*)intPtr, ref MemoryMarshal.GetArrayDataReference(array), num);
24 }
25 return intPtr;
26 }
static IntPtr AllocBSTRByteLen(uint length)
Definition Marshal.cs:1740
static unsafe ref byte GetArrayDataReference(Array array)

References System.Runtime.InteropServices.Marshal.AllocBSTRByteLen(), System.array, System.StubHelpers.AnsiCharMarshaler.DoAnsiConversion(), System.Runtime.InteropServices.MemoryMarshal.GetArrayDataReference(), System.Buffer.Memmove(), and System.IntPtr.Zero.