Browse Source

+ SysUnicodeStringToNtStr() helper

git-svn-id: branches/cpstrrtl@25040 -
Jonas Maebe 12 years ago
parent
commit
fd0a2ac365
1 changed files with 11 additions and 0 deletions
  1. 11 0
      rtl/nativent/sysos.inc

+ 11 - 0
rtl/nativent/sysos.inc

@@ -372,6 +372,17 @@ begin
     aNtStr.Buffer[i] := aText[i];
 end;
 
+procedure SysUnicodeStringToNtStr(var aNtStr: TNtUnicodeString; const s: UnicodeString);
+var
+  i: Integer;
+begin
+  aNtStr.Length := Length(s) * SizeOf(WideChar);
+  aNtStr.MaximumLength := aNtStr.Length;
+  aNtStr.Buffer := GetMem(aNtStr.Length);
+  if aNtStr.Length<>0 then
+    Move(s[1],aNtStr.Buffer[0],aNtStr.Length);
+end;
+
 procedure SysFreeNtStr(var aNtStr: TNtUnicodeString);
 begin
   if aNtStr.Buffer <> Nil then begin