File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -1685,13 +1685,16 @@ func (s NTStatus) Error() string {
1685
1685
// do not use NTUnicodeString, and instead UTF16PtrFromString should be used for
1686
1686
// the more common *uint16 string type.
1687
1687
func NewNTUnicodeString (s string ) (* NTUnicodeString , error ) {
1688
- var u NTUnicodeString
1689
- s16 , err := UTF16PtrFromString (s )
1688
+ s16 , err := UTF16FromString (s )
1690
1689
if err != nil {
1691
1690
return nil , err
1692
1691
}
1693
- RtlInitUnicodeString (& u , s16 )
1694
- return & u , nil
1692
+ n := uint16 (len (s16 ) * 2 )
1693
+ return & NTUnicodeString {
1694
+ Length : n - 2 , // subtract 2 bytes for the NULL terminator
1695
+ MaximumLength : n ,
1696
+ Buffer : & s16 [0 ],
1697
+ }, nil
1695
1698
}
1696
1699
1697
1700
// Slice returns a uint16 slice that aliases the data in the NTUnicodeString.
You can’t perform that action at this time.
0 commit comments