21 #include "..\namesup.h"
23 #ifdef UDF_BUG_CHECK_ID
24 #undef UDF_BUG_CHECK_ID
28#define UDF_BUG_CHECK_ID UDF_FILE_UDF_INFO_DIR
30#define MEM_USDIRHASH_TAG "USDirHash"
32#define UDF_DUMP_DIRTREE
33#ifdef UDF_DUMP_DIRTREE
34#define DirPrint(x) UDFPrint(x)
36#define DirPrint(x) {;}
53#ifdef UDF_LIMIT_DIR_SIZE
62 if(!hDirNdx)
return NULL;
66 for(
k=0;
k<
j;
k++, FrameList++) {
132#ifndef UDF_LIMIT_DIR_SIZE
150 hDirNdx->FrameCount++;
153 (*_hDirNdx) = hDirNdx;
220 (*_hDirNdx) = hDirNdx;
238#if defined _X86_ && !defined UDF_LIMIT_DIR_SIZE
240#pragma warning(disable:4035)
245#if defined(_MSC_VER) && !defined(__clang__)
255#if defined(_MSC_VER) && !defined(__clang__)
282 mov
ebx,[
ebx+ecx*4] ; ...[
j]...
307#pragma warning(default:4035)
324 if(Frame >= hDirNdx->FrameCount)
327#ifdef UDF_LIMIT_DIR_SIZE
330 (*FrameLen) = hDirNdx->LastFrameCount;
335 hDirNdx->LastFrameCount;
354 Context->hDirNdx = DirInfo->Dloc->DirIndex;
356 Context->hDirNdx->FrameCount) {
437 WCHAR ShortNameBuffer[13];
440 if(!
Name->Buffer)
return 0;
493 UDFPrint((
"UDFFindNextFI OK: %x\n", prevOffset));
500#define UDFFindNextFI(a,b,c) 0
528 ExtInfo = &(
FileInfo->Dloc->DataLoc);
530 UDFPrint((
"UDF: scaning directory\n"));
571 DirPrint((
" queue repack request\n"));
572 FileInfo->Dloc->DirIndex->DelCount =
Vcb->PackDirThreshold+1;
581 UDFPrint((
" Trash at the end of Dir\n"));
590 UDFPrint((
" Unexpected end of Dir\n"));
613 DirPrint((
" err: FileEntryLoc=-1\n"));
619 FileInfo->FileIdent->fileCharacteristics :
636 DirPrint((
" FileId: filen %x, iulen %x, charact %x\n",
698#ifdef UDF_CHECK_DISK_ALLOCATION
719 UDFPrint((
" Trash at the end of Dir (2)\n"));
729 UDFPrint((
" Directory too short\n"));
737#ifndef UDF_READ_ONLY_BUILD
776 LBS =
Vcb->LBlockSize;
781 DataLocOffset =
FileInfo->Dloc->DataLoc.Offset;
812 if((
d = LBS - ((curOffset + (
l - IUl) + DataLocOffset) & (LBS-1)) ) <
sizeof(
FILE_IDENT_DESC)) {
829 if(curFileInfo && curFileInfo->
FileIdent) {
883 FileInfo->Dloc->DirIndex->DelCount = 0;
953 if(curFileInfo && curFileInfo->
FileIdent) {
970 hDirNdx->
DIFlags &= ~UDF_DI_FLAG_INIT_IN_ICB;
993 WCHAR ShortNameBuffer[13];
1018 (*Index) = ScanContext.
i;
1033 (*Index) = ScanContext.
i;
1055 (*Index) = ScanContext.
i;
1108 return FileInfo->ParentFile->Dloc->DirIndex;
1135 if(!(DlocList =
Vcb->DlocList) || !Lba)
return (-1);
1139 if(DlocList->
Lba == Lba)
1157 if(!(DlocList =
Vcb->DlocList) || !Dloc)
return (-1);
1161 if(DlocList->
Dloc == Dloc)
1179 if(!
Vcb->DlocList) {
1187 DlocList =
Vcb->DlocList;
1230 Dloc->FE_Flags &= ~UDF_FE_FLAG_UNDER_INIT;
1269#if defined UDF_DBG && !defined _CONSOLE
1270 if(fi->Dloc->CommonFcb) {
1284 Vcb->DlocList[
i].Lba = Lba;
1285 Vcb->DlocList[
i].Dloc = Dloc;
1386 Vcb->DlocList[
i].Lba = NewLba;
1400 if(!
Vcb->DlocList)
return;
1403 if(
Vcb->DlocList[
i].Dloc)
1425 while((ParFileInfo != fi) &&
1427 (ParFileInfo->
Index !=
i)) ) {
1452 while((ParFileInfo != fi) &&
1454 ((ParFileInfo->
Index !=
i) ||
1455 (ParFileInfo->
ParentFile->Dloc != Dloc))) ) {
1465 return NotFound ?
NULL : ParFileInfo;
NTSTATUS MyCloneUnicodeString(IN PUNICODE_STRING Str1, IN PUNICODE_STRING Str2)
VOID UDFNormalizeFileName(IN PUNICODE_STRING FName, IN USHORT valueCRC)
ios_base &_STLP_CALL dec(ios_base &__s)
uint32 UDFPhysLbaToPart(IN PVCB Vcb, IN uint32 PartNum, IN uint32 Addr)
uint32 __fastcall UDFGetPartNumByPhysLba(IN PVCB Vcb, IN uint32 Lba)
uint32 __fastcall UDFPartLbaToPhys(IN PVCB Vcb, IN lb_addr *Addr)
static void xor(unsigned char *dst, const unsigned char *a, const unsigned char *b, const int count)
void UDFInsertLinkedFile(PUDF_FILE_INFO fi, PUDF_FILE_INFO fi2)
LONG UDFFindDlocInMem(IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc)
OSSTATUS UDFPackDirectory__(IN PVCB Vcb, IN OUT PUDF_FILE_INFO FileInfo)
OSSTATUS UDFStoreDloc(IN PVCB Vcb, IN PUDF_FILE_INFO fi, IN uint32 Lba)
OSSTATUS UDFReleaseDloc(IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc)
PUDF_FILE_INFO UDFLocateAnyParallelFI(PUDF_FILE_INFO fi)
#define UDFFindNextFI(a, b, c)
OSSTATUS UDFRemoveDloc(IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc)
PDIR_INDEX_ITEM UDFDirIndexGetFrame(IN PDIR_INDEX_HDR hDirNdx, IN uint32 Frame, OUT uint32 *FrameLen, OUT uint_di *Index, IN uint_di Rel)
OSSTATUS UDFIndexDirectory(IN PVCB Vcb, IN OUT PUDF_FILE_INFO FileInfo)
void UDFRelocateDloc(IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc, IN uint32 NewLba)
OSSTATUS UDFAcquireDloc(IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc)
PDIR_INDEX_HDR UDFGetDirIndexByFileInfo(IN PUDF_FILE_INFO FileInfo)
OSSTATUS UDFUnlinkDloc(IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc)
OSSTATUS UDFDirIndexGrow(IN PDIR_INDEX_HDR *_hDirNdx, IN uint_di d)
void UDFDirIndexFree(PDIR_INDEX_HDR hDirNdx)
void UDFReleaseDlocList(IN PVCB Vcb)
PDIR_INDEX_ITEM UDFDirIndexScan(PUDF_DIR_SCAN_CONTEXT Context, PUDF_FILE_INFO *_FileInfo)
PDIR_INDEX_HDR UDFDirIndexAlloc(IN uint_di i)
LONG UDFFindFreeDloc(IN PVCB Vcb, IN uint32 Lba)
PUDF_FILE_INFO UDFLocateParallelFI(PUDF_FILE_INFO di, uint_di i, PUDF_FILE_INFO fi)
uint8 UDFBuildHashEntry(IN PVCB Vcb, IN PUNICODE_STRING Name, OUT PHASH_ENTRY hashes, IN uint8 Mask)
OSSTATUS UDFReTagDirectory(IN PVCB Vcb, IN OUT PUDF_FILE_INFO FileInfo)
OSSTATUS UDFFindFile(IN PVCB Vcb, IN BOOLEAN IgnoreCase, IN BOOLEAN NotDeleted, IN PUNICODE_STRING Name, IN PUDF_FILE_INFO DirInfo, IN OUT uint_di *Index)
LONG UDFFindDloc(IN PVCB Vcb, IN uint32 Lba)
BOOLEAN UDFDirIndexInitScan(IN PUDF_FILE_INFO DirInfo, OUT PUDF_DIR_SCAN_CONTEXT Context, IN uint_di Index)
void UDFFreeDloc(IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc)
OSSTATUS UDFDirIndexTrunc(IN PDIR_INDEX_HDR *_hDirNdx, IN uint_di d)
#define crc32(crc, buf, len)
struct _FILE_IDENT_DESC * PFILE_IDENT_DESC
struct _FILE_IDENT_DESC FILE_IDENT_DESC
#define TID_FILE_IDENT_DESC
#define UDFReleaseResource(Resource)
#define ValidateFileInfo(fi)
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
#define RtlCompareMemory(s1, s2, l)
NTSTATUS RtlUpcaseUnicodeString(PUNICODE_STRING dst, PUNICODE_STRING src, BOOLEAN Alloc)
#define UDFAcquireResourceExclusive(Resource, CanWait)
OSSTATUS UDFReadExtent(IN PVCB Vcb, IN PEXTENT_INFO ExtInfo, IN int64 Offset, IN SIZE_T Length, IN BOOLEAN Direct, OUT int8 *Buffer, OUT PSIZE_T ReadBytes)
uint32 UDFExtentOffsetToLba(IN PVCB Vcb, IN PEXTENT_MAP Extent, IN int64 Offset, OUT uint32 *SectorOffset, OUT PSIZE_T AvailLength, OUT uint32 *Flags, OUT uint32 *Index)
IN PDCB IN POEM_STRING IN PUNICODE_STRING IN OUT POEM_STRING ShortName
static unsigned char buff[32768]
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
#define cmp(status, error)
BOOLEAN __fastcall UDFCanNameBeA8dot3(IN PUNICODE_STRING Name)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define UDF_RESERVED_NAME_HDR
static calc_node_t * pop(void)
static void push(calc_node_t *op)
#define UDF_NODE_TYPE_NT_REQ_FCB
struct _UDF_FILE_INFO * FileInfo
uint8 FileCharacteristics
uint8 fileCharacteristics
struct _UDF_FILE_INFO * LinkedFileInfo
struct _UDF_FILE_INFO * PrevLinkedFile
struct _UDF_FILE_INFO * ParentFile
PFILE_IDENT_DESC FileIdent
struct _UDF_FILE_INFO * NextLinkedFile
uint16 partitionReferenceNum
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl ebx
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl eax
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx
#define RtlZeroMemory(Destination, Length)
#define RtlMoveMemory(Destination, Source, Length)
#define DLOC_LIST_GRANULARITY
void UDFSetUpTag(IN PVCB Vcb, IN tag *Tag, IN uint16 DataLen, IN uint32 TagLoc)
OSSTATUS UDFWriteFile__(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN int64 Offset, IN SIZE_T Length, IN BOOLEAN Direct, IN int8 *Buffer, OUT PSIZE_T WrittenBytes)
void __fastcall UDFDOSName(IN PVCB Vcb, IN OUT PUNICODE_STRING DosName, IN PUNICODE_STRING UdfName, IN BOOLEAN KeepIntact)
OSSTATUS UDFResizeFile__(IN PVCB Vcb, IN OUT PUDF_FILE_INFO FileInfo, IN int64 NewLength)
void __fastcall UDFDecompressUnicode(IN OUT PUNICODE_STRING UName, IN uint8 *CS0, IN SIZE_T Length, OUT uint16 *valueCRC)
#define UDF_DIR_INDEX_FRAME_SH
#define UDFIsDeleted(DirNdx)
__inline PDIR_INDEX_ITEM UDFDirIndex(IN PDIR_INDEX_HDR hDirNdx, IN uint_di i)
#define UDF_DIR_INDEX_FRAME
#define UDFIsAStreamDir(FI)
#define UDFGetFreeBit(arr, bit)
__inline OSSTATUS UDFReadFile__(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN int64 Offset, IN SIZE_T Length, IN BOOLEAN Direct, OUT int8 *Buffer, OUT PSIZE_T ReadBytes)
#define UDF_FE_FLAG_UNDER_INIT
Dloc is being initialized, don't touch it now.
struct _DIR_INDEX_HDR * PDIR_INDEX_HDR
struct _DIR_INDEX_ITEM * PDIR_INDEX_ITEM
#define UDF_FI_FLAG_FI_INTERNAL
Given entry represents the file used for internal FS purposes & must be invisible.
#define UDF_FE_FLAG_FE_MODIFIED
Was modified & should be flushed.
#define UDF_FI_FLAG_FI_MODIFIED
FileIdent was modified & should be flushed.
struct _DIR_INDEX_HDR DIR_INDEX_HDR
#define UDF_DATALOC_INFO_MT
struct _DIR_INDEX_ITEM DIR_INDEX_ITEM
#define UDF_DI_FLAG_INIT_IN_ICB
#define LBA_OUT_OF_EXTENT
#define UDF_FI_FLAG_KEEP_NAME
struct _UDF_DATALOC_INFO * PUDF_DATALOC_INFO
#define EXTENT_FLAG_ALLOC_SEQUENTIAL
#define STATUS_NOT_A_DIRECTORY
#define STATUS_INVALID_PARAMETER
#define STATUS_SHARING_PAUSED
#define STATUS_FILE_CORRUPT_ERROR
#define STATUS_INSUFFICIENT_RESOURCES
#define STATUS_OBJECT_NAME_NOT_FOUND
_In_ WDFCOLLECTION _In_ ULONG Index