mirror of
https://github.com/reactos/reactos.git
synced 2024-09-02 16:48:36 +00:00
[FORMATING] Replace Tabs with spaces to uniform the code.
svn path=/trunk/; revision=22890
This commit is contained in:
parent
ad50c49167
commit
b8990f331f
|
@ -79,13 +79,13 @@ CdfsCreateFCB(PCWSTR FileName)
|
||||||
{
|
{
|
||||||
wcscpy(Fcb->PathName, FileName);
|
wcscpy(Fcb->PathName, FileName);
|
||||||
if (wcsrchr(Fcb->PathName, '\\') != 0)
|
if (wcsrchr(Fcb->PathName, '\\') != 0)
|
||||||
{
|
{
|
||||||
Fcb->ObjectName = wcsrchr(Fcb->PathName, '\\');
|
Fcb->ObjectName = wcsrchr(Fcb->PathName, '\\');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Fcb->ObjectName = Fcb->PathName;
|
Fcb->ObjectName = Fcb->PathName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExInitializeResourceLite(&Fcb->MainResource);
|
ExInitializeResourceLite(&Fcb->MainResource);
|
||||||
|
@ -119,14 +119,14 @@ CdfsFCBIsRoot(PFCB Fcb)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdfsGrabFCB(PDEVICE_EXTENSION Vcb,
|
CdfsGrabFCB(PDEVICE_EXTENSION Vcb,
|
||||||
PFCB Fcb)
|
PFCB Fcb)
|
||||||
{
|
{
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
|
|
||||||
DPRINT("grabbing FCB at %x: %S, refCount:%d\n",
|
DPRINT("grabbing FCB at %x: %S, refCount:%d\n",
|
||||||
Fcb,
|
Fcb,
|
||||||
Fcb->PathName,
|
Fcb->PathName,
|
||||||
Fcb->RefCount);
|
Fcb->RefCount);
|
||||||
|
|
||||||
KeAcquireSpinLock(&Vcb->FcbListLock, &oldIrql);
|
KeAcquireSpinLock(&Vcb->FcbListLock, &oldIrql);
|
||||||
Fcb->RefCount++;
|
Fcb->RefCount++;
|
||||||
|
@ -136,14 +136,14 @@ CdfsGrabFCB(PDEVICE_EXTENSION Vcb,
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdfsReleaseFCB(PDEVICE_EXTENSION Vcb,
|
CdfsReleaseFCB(PDEVICE_EXTENSION Vcb,
|
||||||
PFCB Fcb)
|
PFCB Fcb)
|
||||||
{
|
{
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
|
|
||||||
DPRINT("releasing FCB at %x: %S, refCount:%d\n",
|
DPRINT("releasing FCB at %x: %S, refCount:%d\n",
|
||||||
Fcb,
|
Fcb,
|
||||||
Fcb->PathName,
|
Fcb->PathName,
|
||||||
Fcb->RefCount);
|
Fcb->RefCount);
|
||||||
|
|
||||||
KeAcquireSpinLock(&Vcb->FcbListLock, &oldIrql);
|
KeAcquireSpinLock(&Vcb->FcbListLock, &oldIrql);
|
||||||
Fcb->RefCount--;
|
Fcb->RefCount--;
|
||||||
|
@ -158,7 +158,7 @@ CdfsReleaseFCB(PDEVICE_EXTENSION Vcb,
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdfsAddFCBToTable(PDEVICE_EXTENSION Vcb,
|
CdfsAddFCBToTable(PDEVICE_EXTENSION Vcb,
|
||||||
PFCB Fcb)
|
PFCB Fcb)
|
||||||
{
|
{
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ CdfsAddFCBToTable(PDEVICE_EXTENSION Vcb,
|
||||||
|
|
||||||
PFCB
|
PFCB
|
||||||
CdfsGrabFCBFromTable(PDEVICE_EXTENSION Vcb,
|
CdfsGrabFCBFromTable(PDEVICE_EXTENSION Vcb,
|
||||||
PUNICODE_STRING FileName)
|
PUNICODE_STRING FileName)
|
||||||
{
|
{
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
PFCB Fcb;
|
PFCB Fcb;
|
||||||
|
@ -195,11 +195,11 @@ CdfsGrabFCBFromTable(PDEVICE_EXTENSION Vcb,
|
||||||
|
|
||||||
DPRINT("Comparing '%wZ' and '%S'\n", FileName, Fcb->PathName);
|
DPRINT("Comparing '%wZ' and '%S'\n", FileName, Fcb->PathName);
|
||||||
if (_wcsicmp(FileName->Buffer, Fcb->PathName) == 0)
|
if (_wcsicmp(FileName->Buffer, Fcb->PathName) == 0)
|
||||||
{
|
{
|
||||||
Fcb->RefCount++;
|
Fcb->RefCount++;
|
||||||
KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql);
|
KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql);
|
||||||
return(Fcb);
|
return(Fcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME: need to compare against short name in FCB here
|
//FIXME: need to compare against short name in FCB here
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ CdfsGrabFCBFromTable(PDEVICE_EXTENSION Vcb,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdfsFCBInitializeCache(PVCB Vcb,
|
CdfsFCBInitializeCache(PVCB Vcb,
|
||||||
PFCB Fcb)
|
PFCB Fcb)
|
||||||
{
|
{
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -227,7 +227,7 @@ CdfsFCBInitializeCache(PVCB Vcb,
|
||||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
}
|
}
|
||||||
RtlZeroMemory(newCCB,
|
RtlZeroMemory(newCCB,
|
||||||
sizeof(CCB));
|
sizeof(CCB));
|
||||||
|
|
||||||
FileObject->SectionObjectPointer = &Fcb->SectionObjectPointers;
|
FileObject->SectionObjectPointer = &Fcb->SectionObjectPointers;
|
||||||
FileObject->FsContext = Fcb;
|
FileObject->FsContext = Fcb;
|
||||||
|
@ -238,7 +238,7 @@ CdfsFCBInitializeCache(PVCB Vcb,
|
||||||
|
|
||||||
#ifdef USE_ROS_AND_FS
|
#ifdef USE_ROS_AND_FS
|
||||||
Status = CcRosInitializeFileCache(FileObject,
|
Status = CcRosInitializeFileCache(FileObject,
|
||||||
PAGE_SIZE);
|
PAGE_SIZE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("CcRosInitializeFileCache failed\n");
|
DbgPrint("CcRosInitializeFileCache failed\n");
|
||||||
|
@ -248,9 +248,9 @@ CdfsFCBInitializeCache(PVCB Vcb,
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
CcInitializeCacheMap(FileObject,
|
CcInitializeCacheMap(FileObject,
|
||||||
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ObDereferenceObject(FileObject);
|
ObDereferenceObject(FileObject);
|
||||||
|
@ -294,7 +294,7 @@ CdfsOpenRootFCB(PDEVICE_EXTENSION Vcb)
|
||||||
RtlInitUnicodeString(&FileName, L"\\");
|
RtlInitUnicodeString(&FileName, L"\\");
|
||||||
|
|
||||||
Fcb = CdfsGrabFCBFromTable(Vcb,
|
Fcb = CdfsGrabFCBFromTable(Vcb,
|
||||||
&FileName);
|
&FileName);
|
||||||
if (Fcb == NULL)
|
if (Fcb == NULL)
|
||||||
{
|
{
|
||||||
Fcb = CdfsMakeRootFCB(Vcb);
|
Fcb = CdfsMakeRootFCB(Vcb);
|
||||||
|
@ -306,8 +306,8 @@ CdfsOpenRootFCB(PDEVICE_EXTENSION Vcb)
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
CdfsGetDirEntryName(PDEVICE_EXTENSION DeviceExt,
|
CdfsGetDirEntryName(PDEVICE_EXTENSION DeviceExt,
|
||||||
PDIR_RECORD Record,
|
PDIR_RECORD Record,
|
||||||
PWSTR Name)
|
PWSTR Name)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Retrieves the file name from a directory record.
|
* FUNCTION: Retrieves the file name from a directory record.
|
||||||
*/
|
*/
|
||||||
|
@ -323,19 +323,19 @@ CdfsGetDirEntryName(PDEVICE_EXTENSION DeviceExt,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (DeviceExt->CdInfo.JolietLevel == 0)
|
if (DeviceExt->CdInfo.JolietLevel == 0)
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
for (i = 0; i < Record->FileIdLength && Record->FileId[i] != ';'; i++)
|
for (i = 0; i < Record->FileIdLength && Record->FileId[i] != ';'; i++)
|
||||||
Name[i] = (WCHAR)Record->FileId[i];
|
Name[i] = (WCHAR)Record->FileId[i];
|
||||||
Name[i] = 0;
|
Name[i] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CdfsSwapString(Name,
|
CdfsSwapString(Name,
|
||||||
Record->FileId,
|
Record->FileId,
|
||||||
Record->FileIdLength);
|
Record->FileIdLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Name '%S'\n", Name);
|
DPRINT("Name '%S'\n", Name);
|
||||||
|
@ -344,13 +344,13 @@ CdfsGetDirEntryName(PDEVICE_EXTENSION DeviceExt,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdfsMakeFCBFromDirEntry(PVCB Vcb,
|
CdfsMakeFCBFromDirEntry(PVCB Vcb,
|
||||||
PFCB DirectoryFCB,
|
PFCB DirectoryFCB,
|
||||||
PWSTR LongName,
|
PWSTR LongName,
|
||||||
PWSTR ShortName,
|
PWSTR ShortName,
|
||||||
PDIR_RECORD Record,
|
PDIR_RECORD Record,
|
||||||
ULONG DirectorySector,
|
ULONG DirectorySector,
|
||||||
ULONG DirectoryOffset,
|
ULONG DirectoryOffset,
|
||||||
PFCB * fileFCB)
|
PFCB * fileFCB)
|
||||||
{
|
{
|
||||||
WCHAR pathName[MAX_PATH];
|
WCHAR pathName[MAX_PATH];
|
||||||
PFCB rcFCB;
|
PFCB rcFCB;
|
||||||
|
@ -412,8 +412,8 @@ CdfsMakeFCBFromDirEntry(PVCB Vcb,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
|
CdfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
|
||||||
PFCB Fcb,
|
PFCB Fcb,
|
||||||
PFILE_OBJECT FileObject)
|
PFILE_OBJECT FileObject)
|
||||||
{
|
{
|
||||||
PCCB newCCB;
|
PCCB newCCB;
|
||||||
|
|
||||||
|
@ -435,18 +435,18 @@ CdfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
|
||||||
#ifdef USE_ROS_CC_AND_FS
|
#ifdef USE_ROS_CC_AND_FS
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
Status = CcRosInitializeFileCache(FileObject,
|
Status = CcRosInitializeFileCache(FileObject,
|
||||||
PAGE_SIZE);
|
PAGE_SIZE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("CcRosInitializeFileCache failed\n");
|
DbgPrint("CcRosInitializeFileCache failed\n");
|
||||||
KEBUGCHECK(0);
|
KEBUGCHECK(0);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
CcInitializeCacheMap(FileObject,
|
CcInitializeCacheMap(FileObject,
|
||||||
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
#endif
|
#endif
|
||||||
Fcb->Flags |= FCB_CACHE_INITIALIZED;
|
Fcb->Flags |= FCB_CACHE_INITIALIZED;
|
||||||
}
|
}
|
||||||
|
@ -459,9 +459,9 @@ CdfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
PFCB DirectoryFcb,
|
PFCB DirectoryFcb,
|
||||||
PUNICODE_STRING FileToFind,
|
PUNICODE_STRING FileToFind,
|
||||||
PFCB *FoundFCB)
|
PFCB *FoundFCB)
|
||||||
{
|
{
|
||||||
UNICODE_STRING TempName;
|
UNICODE_STRING TempName;
|
||||||
WCHAR Name[256];
|
WCHAR Name[256];
|
||||||
|
@ -487,9 +487,9 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
ASSERT(FileToFind);
|
ASSERT(FileToFind);
|
||||||
|
|
||||||
DPRINT("CdfsDirFindFile(VCB:%p, dirFCB:%p, File:%wZ)\n",
|
DPRINT("CdfsDirFindFile(VCB:%p, dirFCB:%p, File:%wZ)\n",
|
||||||
DeviceExt,
|
DeviceExt,
|
||||||
DirectoryFcb,
|
DirectoryFcb,
|
||||||
FileToFind);
|
FileToFind);
|
||||||
DPRINT("Dir Path:%S\n", DirectoryFcb->PathName);
|
DPRINT("Dir Path:%S\n", DirectoryFcb->PathName);
|
||||||
|
|
||||||
/* default to '.' if no filename specified */
|
/* default to '.' if no filename specified */
|
||||||
|
@ -503,11 +503,11 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
StreamOffset.QuadPart = (LONGLONG)DirectoryFcb->Entry.ExtentLocationL * (LONGLONG)BLOCKSIZE;
|
StreamOffset.QuadPart = (LONGLONG)DirectoryFcb->Entry.ExtentLocationL * (LONGLONG)BLOCKSIZE;
|
||||||
|
|
||||||
if (!CcMapData(DeviceExt->StreamFileObject,
|
if (!CcMapData(DeviceExt->StreamFileObject,
|
||||||
&StreamOffset,
|
&StreamOffset,
|
||||||
BLOCKSIZE,
|
BLOCKSIZE,
|
||||||
TRUE,
|
TRUE,
|
||||||
&Context,
|
&Context,
|
||||||
&Block))
|
&Block))
|
||||||
{
|
{
|
||||||
DPRINT("CcMapData() failed\n");
|
DPRINT("CcMapData() failed\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
@ -519,13 +519,13 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
while(TRUE)
|
while(TRUE)
|
||||||
{
|
{
|
||||||
if (Record->RecordLength == 0)
|
if (Record->RecordLength == 0)
|
||||||
{
|
{
|
||||||
DPRINT("RecordLength == 0 Stopped!\n");
|
DPRINT("RecordLength == 0 Stopped!\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("RecordLength %u ExtAttrRecordLength %u NameLength %u\n",
|
DPRINT("RecordLength %u ExtAttrRecordLength %u NameLength %u\n",
|
||||||
Record->RecordLength, Record->ExtAttrRecordLength, Record->FileIdLength);
|
Record->RecordLength, Record->ExtAttrRecordLength, Record->FileIdLength);
|
||||||
|
|
||||||
CdfsGetDirEntryName(DeviceExt, Record, Name);
|
CdfsGetDirEntryName(DeviceExt, Record, Name);
|
||||||
DPRINT ("Name '%S'\n", Name);
|
DPRINT ("Name '%S'\n", Name);
|
||||||
|
@ -539,66 +539,66 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
memset(ShortNameBuffer, 0, 26);
|
memset(ShortNameBuffer, 0, 26);
|
||||||
|
|
||||||
if ((RtlIsNameLegalDOS8Dot3(&LongName, NULL, &HasSpaces) == FALSE) ||
|
if ((RtlIsNameLegalDOS8Dot3(&LongName, NULL, &HasSpaces) == FALSE) ||
|
||||||
(HasSpaces == TRUE))
|
(HasSpaces == TRUE))
|
||||||
{
|
{
|
||||||
/* Build short name */
|
/* Build short name */
|
||||||
RtlGenerate8dot3Name(&LongName,
|
RtlGenerate8dot3Name(&LongName,
|
||||||
FALSE,
|
FALSE,
|
||||||
&NameContext,
|
&NameContext,
|
||||||
&ShortName);
|
&ShortName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* copy short name */
|
/* copy short name */
|
||||||
RtlUpcaseUnicodeString(&ShortName,
|
RtlUpcaseUnicodeString(&ShortName,
|
||||||
&LongName,
|
&LongName,
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("ShortName '%wZ'\n", &ShortName);
|
DPRINT("ShortName '%wZ'\n", &ShortName);
|
||||||
|
|
||||||
if (FsRtlIsNameInExpression(FileToFind, &LongName, TRUE, NULL) ||
|
if (FsRtlIsNameInExpression(FileToFind, &LongName, TRUE, NULL) ||
|
||||||
FsRtlIsNameInExpression(FileToFind, &ShortName, TRUE, NULL))
|
FsRtlIsNameInExpression(FileToFind, &ShortName, TRUE, NULL))
|
||||||
{
|
{
|
||||||
DPRINT("Match found, %S\n", Name);
|
DPRINT("Match found, %S\n", Name);
|
||||||
Status = CdfsMakeFCBFromDirEntry(DeviceExt,
|
Status = CdfsMakeFCBFromDirEntry(DeviceExt,
|
||||||
DirectoryFcb,
|
DirectoryFcb,
|
||||||
Name,
|
Name,
|
||||||
ShortNameBuffer,
|
ShortNameBuffer,
|
||||||
Record,
|
Record,
|
||||||
DirectoryFcb->Entry.ExtentLocationL,
|
DirectoryFcb->Entry.ExtentLocationL,
|
||||||
Offset,
|
Offset,
|
||||||
FoundFCB);
|
FoundFCB);
|
||||||
|
|
||||||
CcUnpinData(Context);
|
CcUnpinData(Context);
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset += Record->RecordLength;
|
Offset += Record->RecordLength;
|
||||||
BlockOffset += Record->RecordLength;
|
BlockOffset += Record->RecordLength;
|
||||||
Record = (PDIR_RECORD)((ULONG_PTR)Block + BlockOffset);
|
Record = (PDIR_RECORD)((ULONG_PTR)Block + BlockOffset);
|
||||||
if (BlockOffset >= BLOCKSIZE || Record->RecordLength == 0)
|
if (BlockOffset >= BLOCKSIZE || Record->RecordLength == 0)
|
||||||
{
|
{
|
||||||
DPRINT("Map next sector\n");
|
DPRINT("Map next sector\n");
|
||||||
CcUnpinData(Context);
|
CcUnpinData(Context);
|
||||||
StreamOffset.QuadPart += BLOCKSIZE;
|
StreamOffset.QuadPart += BLOCKSIZE;
|
||||||
Offset = ROUND_UP(Offset, BLOCKSIZE);
|
Offset = ROUND_UP(Offset, BLOCKSIZE);
|
||||||
BlockOffset = 0;
|
BlockOffset = 0;
|
||||||
|
|
||||||
if (!CcMapData(DeviceExt->StreamFileObject,
|
if (!CcMapData(DeviceExt->StreamFileObject,
|
||||||
&StreamOffset,
|
&StreamOffset,
|
||||||
BLOCKSIZE, TRUE,
|
BLOCKSIZE, TRUE,
|
||||||
&Context, &Block))
|
&Context, &Block))
|
||||||
{
|
{
|
||||||
DPRINT("CcMapData() failed\n");
|
DPRINT("CcMapData() failed\n");
|
||||||
return(STATUS_UNSUCCESSFUL);
|
return(STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
Record = (PDIR_RECORD)((ULONG_PTR)Block + BlockOffset);
|
Record = (PDIR_RECORD)((ULONG_PTR)Block + BlockOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Offset >= DirSize)
|
if (Offset >= DirSize)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CcUnpinData(Context);
|
CcUnpinData(Context);
|
||||||
|
@ -609,9 +609,9 @@ CdfsDirFindFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdfsGetFCBForFile(PDEVICE_EXTENSION Vcb,
|
CdfsGetFCBForFile(PDEVICE_EXTENSION Vcb,
|
||||||
PFCB *pParentFCB,
|
PFCB *pParentFCB,
|
||||||
PFCB *pFCB,
|
PFCB *pFCB,
|
||||||
PUNICODE_STRING FileName)
|
PUNICODE_STRING FileName)
|
||||||
{
|
{
|
||||||
UNICODE_STRING PathName;
|
UNICODE_STRING PathName;
|
||||||
UNICODE_STRING ElementName;
|
UNICODE_STRING ElementName;
|
||||||
|
@ -623,10 +623,10 @@ CdfsGetFCBForFile(PDEVICE_EXTENSION Vcb,
|
||||||
PFCB parentFCB;
|
PFCB parentFCB;
|
||||||
|
|
||||||
DPRINT("CdfsGetFCBForFile(%x, %x, %x, '%wZ')\n",
|
DPRINT("CdfsGetFCBForFile(%x, %x, %x, '%wZ')\n",
|
||||||
Vcb,
|
Vcb,
|
||||||
pParentFCB,
|
pParentFCB,
|
||||||
pFCB,
|
pFCB,
|
||||||
FileName);
|
FileName);
|
||||||
|
|
||||||
/* Trivial case, open of the root directory on volume */
|
/* Trivial case, open of the root directory on volume */
|
||||||
if (FileName->Buffer[0] == L'\0' || wcscmp(FileName->Buffer, L"\\") == 0)
|
if (FileName->Buffer[0] == L'\0' || wcscmp(FileName->Buffer, L"\\") == 0)
|
||||||
|
@ -652,79 +652,79 @@ CdfsGetFCBForFile(PDEVICE_EXTENSION Vcb,
|
||||||
{
|
{
|
||||||
/* Skip blank directory levels */
|
/* Skip blank directory levels */
|
||||||
if ((CdfsGetNextPathElement(currentElement) - currentElement) == 0)
|
if ((CdfsGetNextPathElement(currentElement) - currentElement) == 0)
|
||||||
{
|
{
|
||||||
currentElement++;
|
currentElement++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Parsing, currentElement:%S\n", currentElement);
|
DPRINT("Parsing, currentElement:%S\n", currentElement);
|
||||||
DPRINT(" parentFCB:%x FCB:%x\n", parentFCB, FCB);
|
DPRINT(" parentFCB:%x FCB:%x\n", parentFCB, FCB);
|
||||||
|
|
||||||
/* Descend to next directory level */
|
/* Descend to next directory level */
|
||||||
if (parentFCB)
|
if (parentFCB)
|
||||||
{
|
{
|
||||||
CdfsReleaseFCB(Vcb, parentFCB);
|
CdfsReleaseFCB(Vcb, parentFCB);
|
||||||
parentFCB = NULL;
|
parentFCB = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fail if element in FCB is not a directory */
|
/* fail if element in FCB is not a directory */
|
||||||
if (!CdfsFCBIsDirectory(FCB))
|
if (!CdfsFCBIsDirectory(FCB))
|
||||||
{
|
{
|
||||||
DPRINT("Element in requested path is not a directory\n");
|
DPRINT("Element in requested path is not a directory\n");
|
||||||
|
|
||||||
CdfsReleaseFCB(Vcb, FCB);
|
CdfsReleaseFCB(Vcb, FCB);
|
||||||
FCB = 0;
|
FCB = 0;
|
||||||
*pParentFCB = NULL;
|
*pParentFCB = NULL;
|
||||||
*pFCB = NULL;
|
*pFCB = NULL;
|
||||||
|
|
||||||
return(STATUS_OBJECT_PATH_NOT_FOUND);
|
return(STATUS_OBJECT_PATH_NOT_FOUND);
|
||||||
}
|
}
|
||||||
parentFCB = FCB;
|
parentFCB = FCB;
|
||||||
|
|
||||||
/* Extract next directory level into dirName */
|
/* Extract next directory level into dirName */
|
||||||
CdfsWSubString(pathName,
|
CdfsWSubString(pathName,
|
||||||
FileName->Buffer,
|
FileName->Buffer,
|
||||||
CdfsGetNextPathElement(currentElement) - FileName->Buffer);
|
CdfsGetNextPathElement(currentElement) - FileName->Buffer);
|
||||||
DPRINT(" pathName:%S\n", pathName);
|
DPRINT(" pathName:%S\n", pathName);
|
||||||
|
|
||||||
RtlInitUnicodeString(&PathName, pathName);
|
RtlInitUnicodeString(&PathName, pathName);
|
||||||
|
|
||||||
FCB = CdfsGrabFCBFromTable(Vcb, &PathName);
|
FCB = CdfsGrabFCBFromTable(Vcb, &PathName);
|
||||||
if (FCB == NULL)
|
if (FCB == NULL)
|
||||||
{
|
{
|
||||||
CdfsWSubString(elementName,
|
CdfsWSubString(elementName,
|
||||||
currentElement,
|
currentElement,
|
||||||
CdfsGetNextPathElement(currentElement) - currentElement);
|
CdfsGetNextPathElement(currentElement) - currentElement);
|
||||||
DPRINT(" elementName:%S\n", elementName);
|
DPRINT(" elementName:%S\n", elementName);
|
||||||
|
|
||||||
RtlInitUnicodeString(&ElementName, elementName);
|
RtlInitUnicodeString(&ElementName, elementName);
|
||||||
Status = CdfsDirFindFile(Vcb,
|
Status = CdfsDirFindFile(Vcb,
|
||||||
parentFCB,
|
parentFCB,
|
||||||
&ElementName,
|
&ElementName,
|
||||||
&FCB);
|
&FCB);
|
||||||
if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
|
if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
|
||||||
{
|
{
|
||||||
*pParentFCB = parentFCB;
|
*pParentFCB = parentFCB;
|
||||||
*pFCB = NULL;
|
*pFCB = NULL;
|
||||||
currentElement = CdfsGetNextPathElement(currentElement);
|
currentElement = CdfsGetNextPathElement(currentElement);
|
||||||
if (*currentElement == L'\0' || CdfsGetNextPathElement(currentElement + 1) == 0)
|
if (*currentElement == L'\0' || CdfsGetNextPathElement(currentElement + 1) == 0)
|
||||||
{
|
{
|
||||||
return(STATUS_OBJECT_NAME_NOT_FOUND);
|
return(STATUS_OBJECT_NAME_NOT_FOUND);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return(STATUS_OBJECT_PATH_NOT_FOUND);
|
return(STATUS_OBJECT_PATH_NOT_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!NT_SUCCESS(Status))
|
else if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
CdfsReleaseFCB(Vcb, parentFCB);
|
CdfsReleaseFCB(Vcb, parentFCB);
|
||||||
*pParentFCB = NULL;
|
*pParentFCB = NULL;
|
||||||
*pFCB = NULL;
|
*pFCB = NULL;
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentElement = CdfsGetNextPathElement(currentElement);
|
currentElement = CdfsGetNextPathElement(currentElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue