On Fri, 15 Apr 2005 02:31:18 -0400
Alex Ionescu <ionucu(a)videotron.ca> wrote:
arty(a)svn.reactos.com wrote:
+NTSTATUS NTAPI AppendUnicodeString(PUNICODE_STRING ResultFirst,
+ PUNICODE_STRING Second,
+ BOOL Deallocate) {
+ NTSTATUS Status;
+ UNICODE_STRING Ustr = *ResultFirst;
+ PWSTR new_string = ExAllocatePoolWithTag
+ (PagedPool,
+ (ResultFirst->Length + Second->Length + sizeof(WCHAR)), TAG_STRING);
+ if( !new_string ) {
+ return STATUS_NO_MEMORY;
+ }
+ memcpy( new_string, ResultFirst->Buffer, ResultFirst->Length );
+ memcpy( new_string + ResultFirst->Length / sizeof(WCHAR),
+ Second->Buffer, Second->Length );
+ if( Deallocate ) RtlFreeUnicodeString(ResultFirst);
+ ResultFirst->Length = Ustr.Length + Second->Length;
+ ResultFirst->MaximumLength = ResultFirst->Length;
+ new_string[ResultFirst->Length / sizeof(WCHAR)] = 0;
+ Status = RtlCreateUnicodeString(ResultFirst,new_string) ?
+ STATUS_SUCCESS : STATUS_NO_MEMORY;
+ ExFreePool(new_string);
+ return Status;
+}
What's wrong with
RtlAppendUnicodeStringToString ?
You still have to reallocate the string yourself. This is more compact
and improves abstraction.
--
Here's a simple experiment. Stand on a train track between two locomotives
which are pushing on you with equal force in opposite directions. You will
exhibit no net motion. None the less, you may soon begin to notice that
something important is happening.
-- Robert Stirniman