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

◆ StringToCoTaskMemUni()

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

Definition at line 1327 of file Marshal.cs.

1328 {
1329 if (s == null)
1330 {
1331 return IntPtr.Zero;
1332 }
1333 int num = (s.Length + 1) * 2;
1334 if (num < s.Length)
1335 {
1336 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.s);
1337 }
1338 IntPtr intPtr = AllocCoTaskMem(num);
1339 s.CopyTo(new Span<char>((void*)intPtr, s.Length));
1340 *(short*)((byte*)(void*)intPtr + (nint)s.Length * (nint)2) = 0;
1341 return intPtr;
1342 }
static IntPtr AllocCoTaskMem(int cb)
Definition Marshal.cs:1702

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

Referenced by Interop.NCrypt.DeriveKeyMaterial(), Interop.Crypt32.FindOidInfo(), System.Diagnostics.Tracing.EventPipeInternal.EventPipeProviderConfigurationNative.MarshalToNative(), and System.Runtime.InteropServices.Marshal.StringToCoTaskMemAuto().