MaximumLength = LengthUsed + sizeof(WCHAR);
NewTargetPath = ExAllocatePoolWithTag(NonPagedPool,
MaximumLength,
- TAG_SYMLINK_TTARGET);
+ OB_NAME_TAG);
if (!NewTargetPath) return STATUS_INSUFFICIENT_RESOURCES;
}
else
/* Setup the target name */
SymbolicLink->LinkTarget.Length = CapturedLinkTarget.Length;
- SymbolicLink->LinkTarget.MaximumLength = CapturedLinkTarget.Length +
- sizeof(WCHAR);
+ SymbolicLink->LinkTarget.MaximumLength = CapturedLinkTarget.MaximumLength;
SymbolicLink->LinkTarget.Buffer =
ExAllocatePoolWithTag(PagedPool,
CapturedLinkTarget.MaximumLength,
}
/* Copy it */
- RtlCopyMemory(SymbolicLink->LinkTarget.Buffer,
- CapturedLinkTarget.Buffer,
- CapturedLinkTarget.MaximumLength);
+ _SEH2_TRY
+ {
+ RtlCopyMemory(SymbolicLink->LinkTarget.Buffer,
+ CapturedLinkTarget.Buffer,
+ CapturedLinkTarget.MaximumLength);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ ObDereferenceObject(SymbolicLink);
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
+ }
+ _SEH2_END;
/* Initialize the remaining name, dos drive index and target object */
SymbolicLink->LinkTargetObject = NULL;
DesiredAccess,
NULL,
&hLink);
- if (NT_SUCCESS(Status))
+
+ _SEH2_TRY
{
- _SEH2_TRY
- {
- /* Return the handle to caller */
- *LinkHandle = hLink;
- }
- _SEH2_EXCEPT(ExSystemExceptionFilter())
- {
- /* Get exception code */
- Status = _SEH2_GetExceptionCode();
- }
- _SEH2_END;
+ /* Return the handle to caller */
+ *LinkHandle = hLink;
+ }
+ _SEH2_EXCEPT(ExSystemExceptionFilter())
+ {
+ /* Get exception code */
+ Status = _SEH2_GetExceptionCode();
}
+ _SEH2_END;
/* Return status to caller */
return Status;