mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
- Make an I/O Tagged copy of the file name and properly handle failure.
svn path=/trunk/; revision=22904
This commit is contained in:
parent
d6e384ce39
commit
aa2513791b
3 changed files with 35 additions and 4 deletions
|
@ -610,6 +610,12 @@ IopCreateVpb(
|
|||
IN PDEVICE_OBJECT DeviceObject
|
||||
);
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
IopDereferenceVpb(
|
||||
IN PVPB Vpb
|
||||
);
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
IoInitFileSystemImplementation(
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#define TAG_IO TAG('I', 'o', ' ', ' ')
|
||||
#define TAG_ERROR_LOG TAG('I', 'o', 'E', 'r')
|
||||
#define TAG_EA TAG('I', 'o', 'E', 'a')
|
||||
#define TAG_IO_NAME TAG('I', 'o', 'N', 'm')
|
||||
|
||||
/* formerly located in io/work.c */
|
||||
#define TAG_IOWI TAG('I', 'O', 'W', 'I')
|
||||
|
|
|
@ -33,7 +33,7 @@ IopParseDevice(IN PVOID ParseObject,
|
|||
PDEVICE_OBJECT OriginalDeviceObject = (PDEVICE_OBJECT)ParseObject, DeviceObject;
|
||||
NTSTATUS Status;
|
||||
PFILE_OBJECT FileObject;
|
||||
PVPB Vpb;
|
||||
PVPB Vpb = NULL;
|
||||
PIRP Irp;
|
||||
PEXTENDED_IO_STACK_LOCATION StackLoc;
|
||||
IO_SECURITY_CONTEXT SecurityContext;
|
||||
|
@ -141,9 +141,6 @@ IopParseDevice(IN PVOID ParseObject,
|
|||
(PVOID*)&FileObject);
|
||||
RtlZeroMemory(FileObject, sizeof(FILE_OBJECT));
|
||||
|
||||
/* Create the name for the file object */
|
||||
RtlCreateUnicodeString(&FileObject->FileName, RemainingName->Buffer);
|
||||
|
||||
/* Set the device object and reference it */
|
||||
Status = IopReferenceDeviceObject(DeviceObject);
|
||||
FileObject->DeviceObject = DeviceObject;
|
||||
|
@ -249,6 +246,33 @@ IopParseDevice(IN PVOID ParseObject,
|
|||
StackLoc->Parameters.Create.ShareAccess = OpenPacket->ShareAccess;
|
||||
StackLoc->Parameters.Create.SecurityContext = &SecurityContext;
|
||||
|
||||
/* Check if the file object has a name */
|
||||
if (RemainingName->Length)
|
||||
{
|
||||
/* Setup the unicode string */
|
||||
FileObject->FileName.MaximumLength = RemainingName->Length;
|
||||
FileObject->FileName.Buffer = ExAllocatePoolWithTag(PagedPool,
|
||||
RemainingName->
|
||||
Length,
|
||||
TAG_IO_NAME);
|
||||
if (!FileObject->FileName.Buffer)
|
||||
{
|
||||
/* Failed to allocate the name, free the IRP */
|
||||
IoFreeIrp(Irp);
|
||||
|
||||
/* Dereference the device object and VPB */
|
||||
IopDereferenceDeviceObject(DeviceObject, FALSE);
|
||||
if (Vpb) IopDereferenceVpb(Vpb);
|
||||
|
||||
/* Clear the FO */
|
||||
FileObject->DeviceObject = NULL;
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy the name */
|
||||
RtlCopyUnicodeString(&FileObject->FileName, RemainingName);
|
||||
|
||||
/* Reference the file object and call the driver */
|
||||
ObReferenceObject(FileObject);
|
||||
OpenPacket->FileObject = FileObject;
|
||||
|
|
Loading…
Reference in a new issue