mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 08:25:53 +00:00
[fastfat_new]
- Add two names to an FCB - a short name, and a long name. - Start implementing FatSetFcbNames, currently deals with short names only. - Implement Fati8dot3ToString, with most of the code actually #if0ed, because FullFAT already does this conversion. svn path=/trunk/; revision=43343
This commit is contained in:
parent
415b1f1591
commit
d64568f5ff
|
@ -71,9 +71,9 @@ FatCreateRootDcb(IN PFAT_IRP_CONTEXT IrpContext,
|
|||
Dcb->FullFileName.Length = 1 * sizeof(WCHAR);
|
||||
Dcb->FullFileName.MaximumLength = 2 * sizeof(WCHAR);
|
||||
|
||||
Dcb->FileName.Name.Ansi.Buffer = "\\";
|
||||
Dcb->FileName.Name.Ansi.Length = 1;
|
||||
Dcb->FileName.Name.Ansi.MaximumLength = 2 * sizeof(CHAR);
|
||||
Dcb->ShortName.Name.Ansi.Buffer = "\\";
|
||||
Dcb->ShortName.Name.Ansi.Length = 1;
|
||||
Dcb->ShortName.Name.Ansi.MaximumLength = 2 * sizeof(CHAR);
|
||||
|
||||
/* Fill dirent attribute byte copy */
|
||||
Dcb->DirentFatFlags = FILE_ATTRIBUTE_DIRECTORY;
|
||||
|
|
|
@ -306,8 +306,14 @@ FatSetFullNameInFcb(PFCB Fcb,
|
|||
|
||||
VOID NTAPI
|
||||
FatSetFcbNames(IN PFAT_IRP_CONTEXT IrpContext,
|
||||
IN PUNICODE_STRING Lfn,
|
||||
IN PFCB Fcb);
|
||||
|
||||
VOID NTAPI
|
||||
Fati8dot3ToString(IN PCHAR FileName,
|
||||
IN BOOLEAN DownCase,
|
||||
OUT POEM_STRING OutString);
|
||||
|
||||
/* ------------------------------------------------------------ rw.c */
|
||||
|
||||
NTSTATUS NTAPI
|
||||
|
|
|
@ -269,10 +269,11 @@ typedef struct _FCB
|
|||
/* Mcb mapping Vbo->Lbo */
|
||||
LARGE_MCB Mcb;
|
||||
ULONG FirstCluster;
|
||||
/* Links into FCB Trie */
|
||||
FCB_NAME_LINK FileName;
|
||||
/* Links into FCB Tree */
|
||||
FCB_NAME_LINK ShortName;
|
||||
FCB_NAME_LINK LongName;
|
||||
/* Buffer for the short name */
|
||||
WCHAR ShortNameBuffer[0xc];
|
||||
CHAR ShortNameBuffer[0xc];
|
||||
/* Full file name */
|
||||
UNICODE_STRING FullFileName;
|
||||
/* Long name with exact case */
|
||||
|
|
|
@ -150,7 +150,7 @@ FatCreateFcb(IN PFAT_IRP_CONTEXT IrpContext,
|
|||
Fcb->FatHandle = FileHandle;
|
||||
|
||||
/* Set names */
|
||||
FatSetFcbNames(IrpContext, Fcb);
|
||||
FatSetFcbNames(IrpContext, NULL, Fcb);
|
||||
|
||||
return Fcb;
|
||||
}
|
||||
|
@ -247,10 +247,125 @@ FatSetFullNameInFcb(PFCB Fcb,
|
|||
VOID
|
||||
NTAPI
|
||||
FatSetFcbNames(IN PFAT_IRP_CONTEXT IrpContext,
|
||||
IN PUNICODE_STRING Lfn,
|
||||
IN PFCB Fcb)
|
||||
{
|
||||
// Set the short name first
|
||||
UNIMPLEMENTED;
|
||||
FF_DIRENT DirEnt;
|
||||
FF_ERROR Err;
|
||||
POEM_STRING ShortName;
|
||||
|
||||
/* Get the dir entry */
|
||||
Err = FF_GetEntry(Fcb->Vcb->Ioman,
|
||||
Fcb->FatHandle->DirEntry,
|
||||
Fcb->FatHandle->DirCluster,
|
||||
&DirEnt);
|
||||
|
||||
if (Err != FF_ERR_NONE)
|
||||
{
|
||||
DPRINT1("Error %d getting dirent of a file\n", Err);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize short name string */
|
||||
ShortName = &Fcb->ShortName.Name.Ansi;
|
||||
ShortName->Buffer = Fcb->ShortNameBuffer;
|
||||
ShortName->Length = 0;
|
||||
ShortName->MaximumLength = sizeof(Fcb->ShortNameBuffer);
|
||||
|
||||
/* Convert dirent to the proper string */
|
||||
Fati8dot3ToString(DirEnt.FileName, FALSE, ShortName);
|
||||
|
||||
// Unicode name
|
||||
|
||||
// Add names to the splay tree
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
Fati8dot3ToString(IN PCHAR FileName,
|
||||
IN BOOLEAN DownCase,
|
||||
OUT POEM_STRING OutString)
|
||||
{
|
||||
#if 0
|
||||
ULONG BaseLen, ExtLen;
|
||||
CHAR *cString = OutString->Buffer;
|
||||
ULONG i;
|
||||
|
||||
/* Calc base and ext lens */
|
||||
for (BaseLen = 8; BaseLen > 0; BaseLen--)
|
||||
{
|
||||
if (FileName[BaseLen - 1] != ' ') break;
|
||||
}
|
||||
|
||||
for (ExtLen = 3; ExtLen > 0; ExtLen--)
|
||||
{
|
||||
if (FileName[8 + ExtLen - 1] != ' ') break;
|
||||
}
|
||||
|
||||
/* Process base name */
|
||||
if (BaseLen)
|
||||
{
|
||||
RtlCopyMemory(cString, FileName, BaseLen);
|
||||
|
||||
/* Substitute the e5 thing */
|
||||
if (cString[0] == 0x05) cString[0] = 0xe5;
|
||||
|
||||
/* Downcase if asked to */
|
||||
if (DownCase)
|
||||
{
|
||||
/* Do it manually */
|
||||
for (i = 0; i < BaseLen; i++)
|
||||
{
|
||||
if (cString[i] >= 'A' &&
|
||||
cString[i] <= 'Z')
|
||||
{
|
||||
/* Lowercase it */
|
||||
cString[i] += 'a' - 'A';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Process extension */
|
||||
if (ExtLen)
|
||||
{
|
||||
/* Add the dot */
|
||||
cString[BaseLen] = '.';
|
||||
BaseLen++;
|
||||
|
||||
/* Copy the extension */
|
||||
for (i = 0; i < ExtLen; i++)
|
||||
{
|
||||
cString[BaseLen + i] = FileName[8 + i];
|
||||
}
|
||||
|
||||
/* Lowercase the extension if asked to */
|
||||
if (DownCase)
|
||||
{
|
||||
/* Do it manually */
|
||||
for (i = BaseLen; i < BaseLen + ExtLen; i++)
|
||||
{
|
||||
if (cString[i] >= 'A' &&
|
||||
cString[i] <= 'Z')
|
||||
{
|
||||
/* Lowercase it */
|
||||
cString[i] += 'a' - 'A';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the length */
|
||||
OutString->Length = BaseLen + ExtLen;
|
||||
#else
|
||||
RtlCopyMemory(OutString->Buffer, FileName, 11);
|
||||
OutString->Length = strlen(FileName);
|
||||
ASSERT(OutString->Length <= 12);
|
||||
#endif
|
||||
|
||||
DPRINT1("'%s', len %d\n", OutString->Buffer, OutString->Length);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue