Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ StringToCoTaskMemAnsi()

static unsafe IntPtr System.Runtime.InteropServices.Marshal.StringToCoTaskMemAnsi ( string? s)
inlinestatic

Definition at line 1362 of file Marshal.cs.

1363 {
1364 if (s == null)
1365 {
1366 return IntPtr.Zero;
1367 }
1368 long num = (long)(s.Length + 1) * (long)SystemMaxDBCSCharSize;
1369 int num2 = (int)num;
1370 if (num2 != num)
1371 {
1372 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.s);
1373 }
1374 IntPtr intPtr = AllocCoTaskMem(num2);
1375 StringToAnsiString(s, (byte*)(void*)intPtr, num2);
1376 return intPtr;
1377 }
static unsafe int StringToAnsiString(string s, byte *buffer, int bufferLength, bool bestFit=false, bool throwOnUnmappableChar=false)
Definition Marshal.cs:1608
static IntPtr AllocCoTaskMem(int cb)
Definition Marshal.cs:1702
static readonly int SystemMaxDBCSCharSize
Definition Marshal.cs:19

References System.Runtime.InteropServices.Marshal.AllocCoTaskMem(), System.s, System.Runtime.InteropServices.Marshal.StringToAnsiString(), System.Runtime.InteropServices.Marshal.SystemMaxDBCSCharSize, System.ThrowHelper.ThrowArgumentOutOfRangeException(), and System.IntPtr.Zero.

Referenced by Interop.Crypt32.FindOidInfo().