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

◆ StringToHGlobalUni()

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

Definition at line 1310 of file Marshal.cs.

1311 {
1312 if (s == null)
1313 {
1314 return IntPtr.Zero;
1315 }
1316 int num = (s.Length + 1) * 2;
1317 if (num < s.Length)
1318 {
1319 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.s);
1320 }
1321 IntPtr intPtr = AllocHGlobal((IntPtr)num);
1322 s.CopyTo(new Span<char>((void*)intPtr, s.Length));
1323 *(short*)((byte*)(void*)intPtr + (nint)s.Length * (nint)2) = 0;
1324 return intPtr;
1325 }
static IntPtr AllocHGlobal(int cb)
Definition Marshal.cs:625

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

Referenced by Microsoft.Win32.SafeHandles.SafePasswordHandle.SafePasswordHandle(), Microsoft.Win32.SafeHandles.SafeUnicodeStringHandle.SafeUnicodeStringHandle(), System.Security.Cryptography.RSAImplementation.RSACng.EncryptOrDecrypt(), System.Security.Cryptography.RSACng.EncryptOrDecrypt(), System.Net.Http.WinInetProxyHelper.GetProxyForUrl(), ReLogic.OS.Windows.NativeClipboard.SetText(), System.Security.Cryptography.RSAImplementation.RSACng.SignHash(), System.Security.Cryptography.RSACng.SignHash(), System.Runtime.InteropServices.Marshal.StringToHGlobalAuto(), System.Security.Cryptography.RSAImplementation.RSACng.TryEncryptOrDecrypt(), System.Security.Cryptography.RSACng.TryEncryptOrDecrypt(), System.Security.Cryptography.RSAImplementation.RSACng.TrySignHash(), System.Security.Cryptography.RSACng.TrySignHash(), System.Security.Cryptography.RSAImplementation.RSACng.VerifyHash(), and System.Security.Cryptography.RSACng.VerifyHash().