[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:
Trevor Thompson 2017-07-04 22:34:17 +00:00 committed by Thomas Faber
parent 7e9acb7dda
commit 39a06fae0d
4 changed files with 10 additions and 9 deletions

View file

@ -304,7 +304,7 @@ NtfsOpenFile(PDEVICE_EXTENSION DeviceExt,
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 @@ NtfsCreateFile(PDEVICE_OBJECT DeviceObject,
// 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))
{

View file

@ -138,12 +138,13 @@ NtfsAddFilenameToDirectory(PDEVICE_EXTENSION DeviceExt,
// 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

View file

@ -35,8 +35,8 @@
/* FUNCTIONS ****************************************************************/
static
PWCHAR
NtfsGetNextPathElement(PWCHAR FileName)
PCWSTR
NtfsGetNextPathElement(PCWSTR FileName)
{
if (*FileName == L'\0')
{
@ -55,7 +55,7 @@ NtfsGetNextPathElement(PWCHAR FileName)
static
VOID
NtfsWSubString(PWCHAR pTarget,
const PWCHAR pSource,
PCWSTR pSource,
size_t pLength)
{
wcsncpy(pTarget, pSource, pLength);
@ -593,13 +593,13 @@ NTSTATUS
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;

View file

@ -840,7 +840,7 @@ NTSTATUS
NtfsGetFCBForFile(PNTFS_VCB Vcb,
PNTFS_FCB *pParentFCB,
PNTFS_FCB *pFCB,
const PWSTR pFileName,
PCWSTR pFileName,
BOOLEAN CaseSensitive);
NTSTATUS