411{
418 BOOLEAN BaseAllLower, BaseAllUpper;
419 BOOLEAN ExtensionAllLower, ExtensionAllUpper;
423 ULONG CurrentCluster;
428
433
436 WCHAR ShortNameBuffer[13];
437
438 DPRINT(
"addEntry: Name='%wZ', Dir='%wZ'\n", NameU, &
ParentFcb->PathNameU);
439
442
443
448 {
450 }
453
454 NameA.Buffer = aName;
455 NameA.Length = 0;
456 NameA.MaximumLength = sizeof(aName);
457
459 DirContext.ShortNameU.Buffer = ShortNameBuffer;
461 DirContext.ShortNameU.MaximumLength =
sizeof(ShortNameBuffer);
462
464
466
467 if (!IsNameLegal || SpacesFound)
468 {
471 WCHAR ShortSearchName[13];
480
481 for (
i = 0;
i < 100;
i++)
482 {
488 {
489 break;
490 }
491 else if (MoveContext)
492 {
495 {
496 if (MoveContext->InPlace)
497 {
499 break;
500 }
501 }
502 }
503 }
505 {
508 }
510 }
511 else
512 {
513 BaseAllLower = BaseAllUpper =
TRUE;
514 ExtensionAllLower = ExtensionAllUpper =
TRUE;
517 {
519 if (
c >=
L'A' &&
c <=
L'Z')
520 {
521 if (InExtension)
522 ExtensionAllLower =
FALSE;
523 else
524 BaseAllLower =
FALSE;
525 }
526 else if (
c >=
L'a' &&
c <=
L'z')
527 {
528 if (InExtension)
529 ExtensionAllUpper =
FALSE;
530 else
531 BaseAllUpper =
FALSE;
532 }
534 {
536 break;
537 }
538
540 {
542 }
543 }
544
545 if ((!BaseAllLower && !BaseAllUpper) ||
546 (!ExtensionAllLower && !ExtensionAllUpper))
547 {
549 }
550
553 }
554 aName[NameA.Length] = 0;
555 DPRINT(
"'%s', '%wZ', needTilde=%u, needLong=%u\n",
556 aName, &
DirContext.LongNameU, needTilde, needLong);
558 for (
i = 0;
i < 8 && aName[
i] && aName[
i] !=
'.';
i++)
559 {
561 }
563 {
565 for (
j = 0;
j < 3 && aName[
i];
j++,
i++)
566 {
568 }
569 }
570 if (
DirContext.DirEntry.Fat.Filename[0] == 0xe5)
571 {
573 }
574
575 if (needLong)
576 {
579 DirContext.LongNameU.MaximumLength =
sizeof(LongNameBuffer);
583 }
584 else
585 {
586 nbSlots = 1;
587 if (BaseAllLower && !BaseAllUpper)
588 {
590 }
591 if (ExtensionAllLower && !ExtensionAllUpper)
592 {
594 }
595 }
596
598
599
602 {
604 }
605
612
613 if (MoveContext !=
NULL)
614 {
615 DirContext.DirEntry.Fat.CreationDate = MoveContext->CreationDate;
617 DirContext.DirEntry.Fat.FileSize = MoveContext->FileSize;
618 }
619
620 if (needLong)
621 {
622
623 for (pSlots[0].alias_checksum = 0,
i = 0;
i < 11;
i++)
624 {
626 | ((pSlots[0].alias_checksum & 0xfe) >> 1))
628 }
629
630 for (
i = nbSlots - 2;
i >= 0;
i--)
631 {
632 DPRINT(
"construct slot %d\n",
i);
633 pSlots[
i].
attr = 0xf;
635 {
636 pSlots[
i].
id = (
unsigned char)(nbSlots -
i - 1);
637 }
638 else
639 {
640 pSlots[
i].
id = (
unsigned char)(nbSlots -
i - 1 + 0x40);
641 }
646 }
647 }
648
650 {
653 }
656 {
657
658 if (MoveContext ==
NULL)
659 {
660 CurrentCluster = 0;
663 {
666 {
668 }
670 }
671
672 if (DeviceExt->FatInfo.FatType ==
FAT32)
673 {
675 }
676 }
677 else
678 {
679 CurrentCluster = MoveContext->FirstCluster;
680 }
681
682 if (DeviceExt->FatInfo.FatType ==
FAT32)
683 {
684 DirContext.DirEntry.Fat.FirstClusterHigh = (
unsigned short)(CurrentCluster >> 16);
685 }
687 }
688 else if (MoveContext !=
NULL)
689 {
690 CurrentCluster = MoveContext->FirstCluster;
691
692 if (DeviceExt->FatInfo.FatType ==
FAT32)
693 {
694 DirContext.DirEntry.Fat.FirstClusterHigh = (
unsigned short)(CurrentCluster >> 16);
695 }
697 }
698
699
701
706 {
707
709 {
711 }
713 {
716 }
718
719 if (nbSlots > 1)
720 {
722 }
724 }
725 else
726 {
727
728 size = DeviceExt->FatInfo.BytesPerCluster -
732 {
734 }
736 {
739 }
746 {
748 }
750 {
753 }
756 {
758 }
760 }
763
764 if (MoveContext !=
NULL)
765 {
766
768 }
769 else
770 {
772 }
774 {
777 }
778
779 DPRINT(
"new : entry=%11.11s\n", (*Fcb)->entry.Fat.Filename);
781
783 {
786 {
789 }
790
793 {
795 }
797 {
800 }
802
803 if (MoveContext ==
NULL)
804 {
805 RtlZeroMemory(pFatEntry, DeviceExt->FatInfo.BytesPerCluster);
806
811 }
812
816 {
819 }
822 }
826}
NTSYSAPI VOID NTAPI RtlGenerate8dot3Name(_In_ PCUNICODE_STRING Name, _In_ BOOLEAN AllowExtendedCharacters, _Inout_ PGENERATE_NAME_CONTEXT Context, _Inout_ PUNICODE_STRING Name8dot3)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
#define FILE_DIRECTORY_FILE
VOID NTAPI CcSetDirtyPinnedData(IN PVOID BcbVoid, IN OPTIONAL PLARGE_INTEGER Lsn)
_In_ PFCB _In_ LONGLONG FileOffset
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT DirContext
BOOLEAN vfatFindDirSpace(IN PDEVICE_EXTENSION DeviceExt, IN PVFATFCB pDirFcb, IN ULONG nbSlots, OUT PULONG start)
NTSTATUS vfatFCBInitializeCacheFromVolume(PVCB vcb, PVFATFCB fcb)
#define NT_SUCCESS(StatCode)
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
#define FCB_CACHE_INITIALIZED
BOOLEAN FsdSystemTimeToDosDateTime(PDEVICE_EXTENSION DeviceExt, PLARGE_INTEGER SystemTime, PUSHORT pDosDate, PUSHORT pDosTime)
NTSTATUS FAT32UpdateFreeClustersCount(PDEVICE_EXTENSION DeviceExt)
NTSTATUS NextCluster(PDEVICE_EXTENSION DeviceExt, ULONG FirstCluster, PULONG CurrentCluster, BOOLEAN Extend)
#define ExAllocatePoolWithTag(hernya, size, tag)
NTSTATUS RtlUpcaseUnicodeString(PUNICODE_STRING dst, PUNICODE_STRING src, BOOLEAN Alloc)
#define KeQuerySystemTime(t)
#define BooleanFlagOn(F, SF)
IN PDCB IN POEM_STRING IN PUNICODE_STRING IN OUT POEM_STRING ShortName
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
BOOLEAN NTAPI RtlIsNameLegalDOS8Dot3(_In_ PUNICODE_STRING Name, _Inout_opt_ POEM_STRING OemName, _Inout_opt_ PBOOLEAN NameContainsSpaces)
#define EXCEPTION_EXECUTE_HANDLER
#define ExFreePoolWithTag(_P, _T)
#define FILE_ATTRIBUTE_DIRECTORY
VOID NTAPI CcUnpinData(IN PVOID Bcb)
BOOLEAN NTAPI CcPinRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *Bcb, OUT PVOID *Buffer)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_YIELD(__stmt)
unsigned char ShortName[11]
unsigned short FirstCluster
unsigned short FirstClusterHigh
UNICODE_STRING ShortNameU
PDEVICE_EXTENSION DeviceExt
unsigned char alias_checksum
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
struct _FATDirEntry FAT_DIR_ENTRY
#define VFAT_CASE_LOWER_EXT
#define LONGNAME_MAX_LENGTH
#define VFAT_CASE_LOWER_BASE
NTSTATUS vfatUpdateFCB(PDEVICE_EXTENSION pVCB, PVFATFCB Fcb, PVFAT_DIRENTRY_CONTEXT DirContext, PVFATFCB ParentFcb)
BOOLEAN vfatFCBIsRoot(PVFATFCB FCB)
NTSTATUS vfatMakeFCBFromDirEntry(PVCB vcb, PVFATFCB directoryFCB, PVFAT_DIRENTRY_CONTEXT DirContext, PVFATFCB *fileFCB)