mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[NTFS] - Add some fixes and improvements to create.c, dirctl.c and fcb.c from CR-123:
-NtfsOpenFile() - Replace an ExFreePool() with ExFreePoolWithTag(). -NtfsCreateFile() - Fix broken cast with BooleanFlagOn() macro. -NtfsAddFilenameToDirectory() - Remove an extra cast. Return an error if we fail to allocate I30IndexRoot. -NtfsGetNextPathElement(), NtfsWSubString(), NtfsGetFCBForFile() - Use PCWSTR in place of const PWCHAR or PWCHAR where it makes sense. svn path=/branches/GSoC_2016/NTFS/; revision=75281
This commit is contained in:
parent
7e9acb7dda
commit
39a06fae0d
4 changed files with 10 additions and 9 deletions
|
@ -304,7 +304,7 @@ NtfsOpenFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
DPRINT("Could not make a new FCB, status: %x\n", Status);
|
DPRINT("Could not make a new FCB, status: %x\n", Status);
|
||||||
|
|
||||||
if (AbsFileName)
|
if (AbsFileName)
|
||||||
ExFreePool(AbsFileName);
|
ExFreePoolWithTag(AbsFileName, TAG_NTFS);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -572,7 +572,7 @@ NtfsCreateFile(PDEVICE_OBJECT DeviceObject,
|
||||||
// Create the file record on disk
|
// Create the file record on disk
|
||||||
Status = NtfsCreateFileRecord(DeviceExt,
|
Status = NtfsCreateFileRecord(DeviceExt,
|
||||||
FileObject,
|
FileObject,
|
||||||
(Stack->Flags & SL_CASE_SENSITIVE),
|
BooleanFlagOn(Stack->Flags, SL_CASE_SENSITIVE),
|
||||||
BooleanFlagOn(IrpContext->Flags,IRPCONTEXT_CANWAIT));
|
BooleanFlagOn(IrpContext->Flags,IRPCONTEXT_CANWAIT));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
|
@ -138,12 +138,13 @@ NtfsAddFilenameToDirectory(PDEVICE_EXTENSION DeviceExt,
|
||||||
|
|
||||||
// Allocate memory for the index root data
|
// Allocate memory for the index root data
|
||||||
I30IndexRootLength = AttributeDataLength(&IndexRootContext->Record);
|
I30IndexRootLength = AttributeDataLength(&IndexRootContext->Record);
|
||||||
I30IndexRoot = (PINDEX_ROOT_ATTRIBUTE)ExAllocatePoolWithTag(NonPagedPool, I30IndexRootLength, TAG_NTFS);
|
I30IndexRoot = ExAllocatePoolWithTag(NonPagedPool, I30IndexRootLength, TAG_NTFS);
|
||||||
if (!I30IndexRoot)
|
if (!I30IndexRoot)
|
||||||
{
|
{
|
||||||
DPRINT1("ERROR: Couldn't allocate memory for index root attribute!\n");
|
DPRINT1("ERROR: Couldn't allocate memory for index root attribute!\n");
|
||||||
ReleaseAttributeContext(IndexRootContext);
|
ReleaseAttributeContext(IndexRootContext);
|
||||||
ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
|
ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the Index Root
|
// Read the Index Root
|
||||||
|
|
|
@ -35,8 +35,8 @@
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
static
|
static
|
||||||
PWCHAR
|
PCWSTR
|
||||||
NtfsGetNextPathElement(PWCHAR FileName)
|
NtfsGetNextPathElement(PCWSTR FileName)
|
||||||
{
|
{
|
||||||
if (*FileName == L'\0')
|
if (*FileName == L'\0')
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,7 @@ NtfsGetNextPathElement(PWCHAR FileName)
|
||||||
static
|
static
|
||||||
VOID
|
VOID
|
||||||
NtfsWSubString(PWCHAR pTarget,
|
NtfsWSubString(PWCHAR pTarget,
|
||||||
const PWCHAR pSource,
|
PCWSTR pSource,
|
||||||
size_t pLength)
|
size_t pLength)
|
||||||
{
|
{
|
||||||
wcsncpy(pTarget, pSource, pLength);
|
wcsncpy(pTarget, pSource, pLength);
|
||||||
|
@ -593,13 +593,13 @@ NTSTATUS
|
||||||
NtfsGetFCBForFile(PNTFS_VCB Vcb,
|
NtfsGetFCBForFile(PNTFS_VCB Vcb,
|
||||||
PNTFS_FCB *pParentFCB,
|
PNTFS_FCB *pParentFCB,
|
||||||
PNTFS_FCB *pFCB,
|
PNTFS_FCB *pFCB,
|
||||||
const PWSTR pFileName,
|
PCWSTR pFileName,
|
||||||
BOOLEAN CaseSensitive)
|
BOOLEAN CaseSensitive)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
WCHAR pathName [MAX_PATH];
|
WCHAR pathName [MAX_PATH];
|
||||||
WCHAR elementName [MAX_PATH];
|
WCHAR elementName [MAX_PATH];
|
||||||
PWCHAR currentElement;
|
PCWSTR currentElement;
|
||||||
PNTFS_FCB FCB;
|
PNTFS_FCB FCB;
|
||||||
PNTFS_FCB parentFCB;
|
PNTFS_FCB parentFCB;
|
||||||
|
|
||||||
|
|
|
@ -840,7 +840,7 @@ NTSTATUS
|
||||||
NtfsGetFCBForFile(PNTFS_VCB Vcb,
|
NtfsGetFCBForFile(PNTFS_VCB Vcb,
|
||||||
PNTFS_FCB *pParentFCB,
|
PNTFS_FCB *pParentFCB,
|
||||||
PNTFS_FCB *pFCB,
|
PNTFS_FCB *pFCB,
|
||||||
const PWSTR pFileName,
|
PCWSTR pFileName,
|
||||||
BOOLEAN CaseSensitive);
|
BOOLEAN CaseSensitive);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
Loading…
Reference in a new issue