diff options
Diffstat (limited to 'Util.cs')
| -rw-r--r-- | Util.cs | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -0,0 +1,17 @@ +using System.Runtime.InteropServices; +using System.Security; + +namespace HyperBooru.PowerShell; + +internal static class Util { + internal static string ToInsecureString(this SecureString x) { + IntPtr rawString = IntPtr.Zero; + try { + rawString = Marshal.SecureStringToBSTR(x); + return Marshal.PtrToStringBSTR(rawString); + } finally { + if(rawString != IntPtr.Zero) + Marshal.FreeBSTR(rawString); + } + } +} |
