Author: tthompson Date: Tue Jul 4 22:34:17 2017 New Revision: 75281
URL: http://svn.reactos.org/svn/reactos?rev=75281&view=rev Log: [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.
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/create.c branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/dirctl.c branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/fcb.c branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/create.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyste... ============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/create.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/create.c [iso-8859-1] Tue Jul 4 22:34:17 2017 @@ -304,7 +304,7 @@ DPRINT("Could not make a new FCB, status: %x\n", Status);
if (AbsFileName) - ExFreePool(AbsFileName); + ExFreePoolWithTag(AbsFileName, TAG_NTFS);
return Status; } @@ -572,7 +572,7 @@ // Create the file record on disk Status = NtfsCreateFileRecord(DeviceExt, FileObject, - (Stack->Flags & SL_CASE_SENSITIVE), + BooleanFlagOn(Stack->Flags, SL_CASE_SENSITIVE), BooleanFlagOn(IrpContext->Flags,IRPCONTEXT_CANWAIT)); if (!NT_SUCCESS(Status)) {
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/dirctl.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyste... ============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/dirctl.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/dirctl.c [iso-8859-1] Tue Jul 4 22:34:17 2017 @@ -138,12 +138,13 @@
// Allocate memory for the index root data I30IndexRootLength = AttributeDataLength(&IndexRootContext->Record); - I30IndexRoot = (PINDEX_ROOT_ATTRIBUTE)ExAllocatePoolWithTag(NonPagedPool, I30IndexRootLength, TAG_NTFS); + I30IndexRoot = ExAllocatePoolWithTag(NonPagedPool, I30IndexRootLength, TAG_NTFS); if (!I30IndexRoot) { DPRINT1("ERROR: Couldn't allocate memory for index root attribute!\n"); ReleaseAttributeContext(IndexRootContext); ExFreePoolWithTag(ParentFileRecord, TAG_NTFS); + return STATUS_INSUFFICIENT_RESOURCES; }
// Read the Index Root
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/fcb.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyste... ============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/fcb.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/fcb.c [iso-8859-1] Tue Jul 4 22:34:17 2017 @@ -35,8 +35,8 @@ /* FUNCTIONS ****************************************************************/
static -PWCHAR -NtfsGetNextPathElement(PWCHAR FileName) +PCWSTR +NtfsGetNextPathElement(PCWSTR FileName) { if (*FileName == L'\0') { @@ -55,7 +55,7 @@ static VOID NtfsWSubString(PWCHAR pTarget, - const PWCHAR pSource, + PCWSTR pSource, size_t pLength) { wcsncpy(pTarget, pSource, pLength); @@ -593,13 +593,13 @@ NtfsGetFCBForFile(PNTFS_VCB Vcb, PNTFS_FCB *pParentFCB, PNTFS_FCB *pFCB, - const PWSTR pFileName, + PCWSTR pFileName, BOOLEAN CaseSensitive) { NTSTATUS Status; WCHAR pathName [MAX_PATH]; WCHAR elementName [MAX_PATH]; - PWCHAR currentElement; + PCWSTR currentElement; PNTFS_FCB FCB; PNTFS_FCB parentFCB;
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyste... ============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] Tue Jul 4 22:34:17 2017 @@ -840,7 +840,7 @@ NtfsGetFCBForFile(PNTFS_VCB Vcb, PNTFS_FCB *pParentFCB, PNTFS_FCB *pFCB, - const PWSTR pFileName, + PCWSTR pFileName, BOOLEAN CaseSensitive);
NTSTATUS