+ if (Dest->Length != 0)
+ {
+ ProbeForRead(Dest->Buffer,
+ Dest->Length,
+ sizeof(WCHAR));
+
+ /* Allocate space for the buffer */
+ Buffer = ExAllocatePoolWithTag(PagedPool,
+ Dest->Length + sizeof(WCHAR),
+ TAG('U', 'S', 'T', 'R'));
+ if (Buffer == NULL)
+ {
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ _SEH_LEAVE;
+ }
+
+ /* Copy it */
+ RtlCopyMemory(Buffer, Dest->Buffer, Dest->Length);
+ Buffer[Dest->Length / sizeof(WCHAR)] = UNICODE_NULL;
+
+ /* Set it as the buffer */
+ Dest->Buffer = Buffer;
+ }
+ else
+ {
+ /* sanitize structure */
+ Dest->Length = 0;
+ Dest->MaximumLength = 0;
+ Dest->Buffer = NULL;
+ }
+ }
+ else
+ {
+ /* sanitize structure */
+ Dest->Length = 0;
+ Dest->MaximumLength = 0;