mirror of
https://github.com/reactos/reactos.git
synced 2024-10-05 08:54:40 +00:00
Reuse buffer in IopQueryNameFile, since it's temporary and the first one we allocate is already large enough. Also block out SEH in ntread/write file since it seems to crash some user mode code.
svn path=/trunk/; revision=15196
This commit is contained in:
parent
de8ae0fbd2
commit
2670be2117
|
@ -414,62 +414,57 @@ IopQueryNameFile(PVOID ObjectBody,
|
||||||
ULONG Length,
|
ULONG Length,
|
||||||
PULONG ReturnLength)
|
PULONG ReturnLength)
|
||||||
{
|
{
|
||||||
POBJECT_NAME_INFORMATION LocalInfo;
|
PVOID LocalInfo;
|
||||||
PFILE_NAME_INFORMATION FileNameInfo;
|
PFILE_OBJECT FileObject;
|
||||||
PFILE_OBJECT FileObject;
|
ULONG LocalReturnLength;
|
||||||
ULONG LocalReturnLength;
|
NTSTATUS Status;
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
DPRINT ("IopQueryNameFile() called\n");
|
DPRINT1("IopQueryNameFile() called\n");
|
||||||
|
|
||||||
FileObject = (PFILE_OBJECT)ObjectBody;
|
FileObject = (PFILE_OBJECT)ObjectBody;
|
||||||
|
|
||||||
LocalInfo = ExAllocatePool (NonPagedPool,
|
/* Allocate Buffer */
|
||||||
sizeof(OBJECT_NAME_INFORMATION) +
|
LocalInfo = ExAllocatePool(PagedPool,
|
||||||
MAX_PATH * sizeof(WCHAR));
|
sizeof(OBJECT_NAME_INFORMATION) +
|
||||||
if (LocalInfo == NULL)
|
MAX_PATH * sizeof(WCHAR));
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
if (LocalInfo == NULL) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
Status = ObQueryNameString (FileObject->DeviceObject->Vpb->RealDevice,
|
/* Query the name */
|
||||||
LocalInfo,
|
Status = ObQueryNameString(FileObject->DeviceObject,
|
||||||
MAX_PATH * sizeof(WCHAR),
|
LocalInfo,
|
||||||
&LocalReturnLength);
|
MAX_PATH * sizeof(WCHAR),
|
||||||
if (!NT_SUCCESS (Status))
|
&LocalReturnLength);
|
||||||
|
if (!NT_SUCCESS (Status))
|
||||||
{
|
{
|
||||||
ExFreePool (LocalInfo);
|
ExFreePool (LocalInfo);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
DPRINT ("Device path: %wZ\n", &LocalInfo->Name);
|
DPRINT ("Device path: %wZ\n", &LocalInfo->Name);
|
||||||
|
|
||||||
|
/* Write Device Path */
|
||||||
|
Status = RtlAppendUnicodeStringToString(&ObjectNameInfo->Name,
|
||||||
|
&((POBJECT_NAME_INFORMATION)LocalInfo)->Name);
|
||||||
|
|
||||||
Status = RtlAppendUnicodeStringToString (&ObjectNameInfo->Name,
|
/* Query the File name */
|
||||||
&LocalInfo->Name);
|
Status = IoQueryFileInformation(FileObject,
|
||||||
|
FileNameInformation,
|
||||||
ExFreePool (LocalInfo);
|
LocalReturnLength,
|
||||||
|
LocalInfo,
|
||||||
FileNameInfo = ExAllocatePool (NonPagedPool,
|
NULL);
|
||||||
MAX_PATH * sizeof(WCHAR) + sizeof(ULONG));
|
if (Status != STATUS_SUCCESS)
|
||||||
if (FileNameInfo == NULL)
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
|
|
||||||
Status = IoQueryFileInformation (FileObject,
|
|
||||||
FileNameInformation,
|
|
||||||
MAX_PATH * sizeof(WCHAR) + sizeof(ULONG),
|
|
||||||
FileNameInfo,
|
|
||||||
NULL);
|
|
||||||
if (Status != STATUS_SUCCESS)
|
|
||||||
{
|
{
|
||||||
ExFreePool (FileNameInfo);
|
ExFreePool(LocalInfo);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = RtlAppendUnicodeToString (&ObjectNameInfo->Name,
|
/* Write the Name */
|
||||||
FileNameInfo->FileName);
|
Status = RtlAppendUnicodeToString(&ObjectNameInfo->Name,
|
||||||
|
((PFILE_NAME_INFORMATION)LocalInfo)->FileName);
|
||||||
|
DPRINT ("Total path: %wZ\n", &ObjectNameInfo->Name);
|
||||||
|
|
||||||
DPRINT ("Total path: %wZ\n", &ObjectNameInfo->Name);
|
/* Free buffer and return */
|
||||||
|
ExFreePool(LocalInfo);
|
||||||
ExFreePool (FileNameInfo);
|
return Status;
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -3004,10 +2999,11 @@ NtWriteFile (IN HANDLE FileHandle,
|
||||||
{
|
{
|
||||||
_SEH_TRY
|
_SEH_TRY
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
ProbeForWrite(IoStatusBlock,
|
ProbeForWrite(IoStatusBlock,
|
||||||
sizeof(IO_STATUS_BLOCK),
|
sizeof(IO_STATUS_BLOCK),
|
||||||
sizeof(ULONG));
|
sizeof(ULONG));
|
||||||
#if 0
|
|
||||||
ProbeForRead(Buffer,
|
ProbeForRead(Buffer,
|
||||||
Length,
|
Length,
|
||||||
sizeof(ULONG));
|
sizeof(ULONG));
|
||||||
|
|
Loading…
Reference in a new issue