Skip to content

Commit 4b88696

Browse files
committed
Added allocating unicode string from a string.
1 parent 337ec0d commit 4b88696

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

NtApiDotNet/UnicodeString.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@ public UnicodeStringAllocated() : this(MaxStringLength)
182182
{
183183
}
184184

185+
public UnicodeStringAllocated(string str)
186+
{
187+
String.Length = (ushort)(str.Length * 2);
188+
String.MaximumLength = (ushort)(String.Length + 2);
189+
String.Buffer = Marshal.StringToHGlobalUni(str);
190+
}
191+
185192
public const int MaxStringLength = ushort.MaxValue - 1;
186193

187194
public override string ToString()

0 commit comments

Comments
 (0)