Offset.u.LowPart = (StartIndex * sizeof(FATX_DIR_ENTRY) / PAGE_SIZE) * PAGE_SIZE;
_SEH2_TRY
{
- CcPinRead(pFcb->parentFcb->FileObject, &Offset, sizeof(FATX_DIR_ENTRY), PIN_WAIT, &Context, (PVOID*)&pDirEntry);
+ CcPinRead(pFcb->parentFcb->FileObject, &Offset, PAGE_SIZE, PIN_WAIT, &Context, (PVOID*)&pDirEntry);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
RtlUnicodeStringToOemString(&NameA, FileName, FALSE);
pDirEntry->FilenameLength = (unsigned char)NameA.Length;
- CcSetDirtyPinnedData(Context, NULL);
- CcUnpinData(Context);
-
/* Update FCB */
DirContext.ShortNameU.Length = 0;
DirContext.ShortNameU.MaximumLength = 0;
DirContext.ShortNameU.Buffer = NULL;
DirContext.LongNameU = *FileName;
DirContext.DirEntry.FatX = *pDirEntry;
+
+ CcSetDirtyPinnedData(Context, NULL);
+ CcUnpinData(Context);
+
Status = vfatUpdateFCB(DeviceExt, pFcb, &DirContext, pFcb->parentFcb);
if (NT_SUCCESS(Status))
{
{
/* We're modifying an existing FCB - likely rename/move */
Status = vfatUpdateFCB(DeviceExt, *Fcb, &DirContext, ParentFcb);
- (*Fcb)->dirIndex = DirContext.DirIndex;
- (*Fcb)->startIndex = DirContext.StartIndex;
}
else
{
/* We're modifying an existing FCB - likely rename/move */
/* FIXME: check status */
vfatUpdateFCB(DeviceExt, *Fcb, &DirContext, ParentFcb);
- (*Fcb)->dirIndex = DirContext.DirIndex;
- (*Fcb)->startIndex = DirContext.StartIndex;
}
else
{
Offset.u.LowPart = (i * sizeof(FAT_DIR_ENTRY) / PAGE_SIZE) * PAGE_SIZE;
_SEH2_TRY
{
- CcPinRead(pFcb->parentFcb->FileObject, &Offset, sizeof(FAT_DIR_ENTRY), PIN_WAIT, &Context, (PVOID*)&pDirEntry);
+ CcPinRead(pFcb->parentFcb->FileObject, &Offset, PAGE_SIZE, PIN_WAIT, &Context, (PVOID*)&pDirEntry);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
(PDIR_ENTRY)&pDirEntry[i % (PAGE_SIZE / sizeof(FAT_DIR_ENTRY))]);
}
}
- if (Context)
- {
- CcSetDirtyPinnedData(Context, NULL);
- CcUnpinData(Context);
- }
- /* In case of moving, don't delete data */
+ /* In case of moving, save properties */
if (MoveContext != NULL)
{
pDirEntry = &pDirEntry[pFcb->dirIndex % (PAGE_SIZE / sizeof(FAT_DIR_ENTRY))];
MoveContext->CreationTime = pDirEntry->CreationTime;
MoveContext->CreationDate = pDirEntry->CreationDate;
}
- else
+
+ if (Context)
+ {
+ CcSetDirtyPinnedData(Context, NULL);
+ CcUnpinData(Context);
+ }
+
+ /* In case of moving, don't delete data */
+ if (MoveContext == NULL)
{
while (CurrentCluster && CurrentCluster != 0xffffffff)
{
Offset.u.LowPart = (StartIndex * sizeof(FATX_DIR_ENTRY) / PAGE_SIZE) * PAGE_SIZE;
_SEH2_TRY
{
- CcPinRead(pFcb->parentFcb->FileObject, &Offset, sizeof(FATX_DIR_ENTRY), PIN_WAIT, &Context, (PVOID*)&pDirEntry);
+ CcPinRead(pFcb->parentFcb->FileObject, &Offset, PAGE_SIZE, PIN_WAIT, &Context, (PVOID*)&pDirEntry);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
pDirEntry->FilenameLength = 0xe5;
CurrentCluster = vfatDirEntryGetFirstCluster(DeviceExt,
(PDIR_ENTRY)pDirEntry);
- CcSetDirtyPinnedData(Context, NULL);
- CcUnpinData(Context);
- /* In case of moving, don't delete data */
+ /* In case of moving, save properties */
if (MoveContext != NULL)
{
MoveContext->FirstCluster = CurrentCluster;
MoveContext->CreationTime = pDirEntry->CreationTime;
MoveContext->CreationDate = pDirEntry->CreationDate;
}
- else
+
+ CcSetDirtyPinnedData(Context, NULL);
+ CcUnpinData(Context);
+
+ /* In case of moving, don't delete data */
+ if (MoveContext == NULL)
{
while (CurrentCluster && CurrentCluster != 0xffffffff)
{