19#define UDF_BUG_CHECK_ID UDF_FILE_UDF_INFO
23 {1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1,
24 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1,
25 1,0,1,0, 0,0,0,0, 0,0,1,1, 1,0,0,1,
26 0,0,0,0, 0,0,0,0, 0,0,1,1, 1,1,1,1,
27 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
28 0,0,0,0, 0,0,0,0, 0,0,0,1, 1,1,0,0,
29 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
30 0,0,0,0, 0,0,0,0, 0,0,0,1, 1,1,0,1,
32 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
33 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
34 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
35 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
36 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
37 1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
38 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
39 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};
44#define DOS_CRC_MODULUS 41
45#define hexChar crcChar
46static const char crcChar[] =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ#_~-@";
52 0x0000U, 0x1021U, 0x2042U, 0x3063U, 0x4084U, 0x50a5U, 0x60c6U, 0x70e7U,
53 0x8108U, 0x9129U, 0xa14aU, 0xb16bU, 0xc18cU, 0xd1adU, 0xe1ceU, 0xf1efU,
54 0x1231U, 0x0210U, 0x3273U, 0x2252U, 0x52b5U, 0x4294U, 0x72f7U, 0x62d6U,
55 0x9339U, 0x8318U, 0xb37bU, 0xa35aU, 0xd3bdU, 0xc39cU, 0xf3ffU, 0xe3deU,
56 0x2462U, 0x3443U, 0x0420U, 0x1401U, 0x64e6U, 0x74c7U, 0x44a4U, 0x5485U,
57 0xa56aU, 0xb54bU, 0x8528U, 0x9509U, 0xe5eeU, 0xf5cfU, 0xc5acU, 0xd58dU,
58 0x3653U, 0x2672U, 0x1611U, 0x0630U, 0x76d7U, 0x66f6U, 0x5695U, 0x46b4U,
59 0xb75bU, 0xa77aU, 0x9719U, 0x8738U, 0xf7dfU, 0xe7feU, 0xd79dU, 0xc7bcU,
60 0x48c4U, 0x58e5U, 0x6886U, 0x78a7U, 0x0840U, 0x1861U, 0x2802U, 0x3823U,
61 0xc9ccU, 0xd9edU, 0xe98eU, 0xf9afU, 0x8948U, 0x9969U, 0xa90aU, 0xb92bU,
62 0x5af5U, 0x4ad4U, 0x7ab7U, 0x6a96U, 0x1a71U, 0x0a50U, 0x3a33U, 0x2a12U,
63 0xdbfdU, 0xcbdcU, 0xfbbfU, 0xeb9eU, 0x9b79U, 0x8b58U, 0xbb3bU, 0xab1aU,
64 0x6ca6U, 0x7c87U, 0x4ce4U, 0x5cc5U, 0x2c22U, 0x3c03U, 0x0c60U, 0x1c41U,
65 0xedaeU, 0xfd8fU, 0xcdecU, 0xddcdU, 0xad2aU, 0xbd0bU, 0x8d68U, 0x9d49U,
66 0x7e97U, 0x6eb6U, 0x5ed5U, 0x4ef4U, 0x3e13U, 0x2e32U, 0x1e51U, 0x0e70U,
67 0xff9fU, 0xefbeU, 0xdfddU, 0xcffcU, 0xbf1bU, 0xaf3aU, 0x9f59U, 0x8f78U,
68 0x9188U, 0x81a9U, 0xb1caU, 0xa1ebU, 0xd10cU, 0xc12dU, 0xf14eU, 0xe16fU,
69 0x1080U, 0x00a1U, 0x30c2U, 0x20e3U, 0x5004U, 0x4025U, 0x7046U, 0x6067U,
70 0x83b9U, 0x9398U, 0xa3fbU, 0xb3daU, 0xc33dU, 0xd31cU, 0xe37fU, 0xf35eU,
71 0x02b1U, 0x1290U, 0x22f3U, 0x32d2U, 0x4235U, 0x5214U, 0x6277U, 0x7256U,
72 0xb5eaU, 0xa5cbU, 0x95a8U, 0x8589U, 0xf56eU, 0xe54fU, 0xd52cU, 0xc50dU,
73 0x34e2U, 0x24c3U, 0x14a0U, 0x0481U, 0x7466U, 0x6447U, 0x5424U, 0x4405U,
74 0xa7dbU, 0xb7faU, 0x8799U, 0x97b8U, 0xe75fU, 0xf77eU, 0xc71dU, 0xd73cU,
75 0x26d3U, 0x36f2U, 0x0691U, 0x16b0U, 0x6657U, 0x7676U, 0x4615U, 0x5634U,
76 0xd94cU, 0xc96dU, 0xf90eU, 0xe92fU, 0x99c8U, 0x89e9U, 0xb98aU, 0xa9abU,
77 0x5844U, 0x4865U, 0x7806U, 0x6827U, 0x18c0U, 0x08e1U, 0x3882U, 0x28a3U,
78 0xcb7dU, 0xdb5cU, 0xeb3fU, 0xfb1eU, 0x8bf9U, 0x9bd8U, 0xabbbU, 0xbb9aU,
79 0x4a75U, 0x5a54U, 0x6a37U, 0x7a16U, 0x0af1U, 0x1ad0U, 0x2ab3U, 0x3a92U,
80 0xfd2eU, 0xed0fU, 0xdd6cU, 0xcd4dU, 0xbdaaU, 0xad8bU, 0x9de8U, 0x8dc9U,
81 0x7c26U, 0x6c07U, 0x5c64U, 0x4c45U, 0x3ca2U, 0x2c83U, 0x1ce0U, 0x0cc1U,
82 0xef1fU, 0xff3eU, 0xcf5dU, 0xdf7cU, 0xaf9bU, 0xbfbaU, 0x8fd9U, 0x9ff8U,
83 0x6e17U, 0x7e36U, 0x4e55U, 0x5e74U, 0x2e93U, 0x3eb2U, 0x0ed1U, 0x1ef0U
87 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
88 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
89 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
90 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
91 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
92 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
93 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
94 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
95 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
96 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
97 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
98 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
99 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
100 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
101 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
102 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
103 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
104 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
105 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
106 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
107 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
108 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
109 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
110 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
111 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
112 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
113 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
114 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
115 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
116 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
117 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
118 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
119 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
120 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
121 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
122 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
123 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
124 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
125 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
126 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
127 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
128 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
129 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
130 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
131 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
132 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
133 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
134 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
135 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
136 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
137 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
183 if(!
Length)
goto return_empty_str;
189 if(!
buff)
goto return_empty_str;
190 UName->Buffer =
buff;
193 while (byteIndex <
Length) {
199 unicodeIndex = byteIndex-1;
205 if(!
buff)
goto return_empty_str;
206 UName->Buffer =
buff;
209 while (byteIndex <
Length) {
211 *
buff = ((*_CS0) << 8) | (*(_CS0+1));
222 UName->Buffer =
NULL;
223 UName->MaximumLength =
228 UName->MaximumLength = (UName->Length = (((
uint16)unicodeIndex)*
sizeof(
WCHAR))) +
sizeof(
WCHAR);
229 UName->Buffer[unicodeIndex] = 0;
252 len = (UName->Length) /
sizeof(
WCHAR);
255 Buff = UName->Buffer;
256 for(
i=0;
i<
len;
i++, Buff++) {
257 if((*Buff) & 0xff00) {
271 Buff = UName->Buffer;
274 while (unicodeIndex <
len) {
276 *CS0 = (
uint8)((*Buff) >> 8);
278 *CS0 = (
uint8)(*Buff);
285 while (unicodeIndex <
len) {
286 *CS0 = (
uint8)(*Buff);
317 Icb->extLocation.logicalBlockNum,
321 UDFPrint((
" Not a FileEntry (lbn=%x, tag=%x)\n", Icb->extLocation.logicalBlockNum, FileEntry->descTag.tagIdent));
327#if !defined (_X86_) || !defined (_MSC_VER)
343 while(*
string !=
'\0' && !found) {
360#pragma warning(disable:4035)
375#if defined (_X86_) && defined (_MSC_VER)
441 switch(
Vcb->CurrentUDFRev) {
472 PWCHAR udfName = UdfName->Buffer;
475 uint32 index, dosIndex = 0, extIndex = 0, lastPeriodIndex;
490 if (dosIndex==0 || hasExt) {
495 lastPeriodIndex = udfLen - 1;
496 while(lastPeriodIndex >=0 &&
501 while(lastPeriodIndex >= 0 &&
505 if (lastPeriodIndex !=
index)
509 if (lastPeriodIndex >= 0) hasExt =
TRUE;
527 while(
index+1 < udfLen &&
546 if (!writingExt && hasExt && (dosIndex ==
DOS_NAME_LEN ||
547 index == lastPeriodIndex)) {
551 index = lastPeriodIndex;
557 if (dosIndex >4) dosIndex = 4;
562 dosName[dosIndex+1] =
hexChar[(valueCRC & 0x0f00) >> 8];
563 dosName[dosIndex+2] =
hexChar[(valueCRC & 0x00f0) >> 4];
564 dosName[dosIndex+3] =
hexChar[(valueCRC & 0x000f)];
590 PWCHAR udfName = UdfName->Buffer;
593 uint32 index, dosIndex = 0, extIndex = 0, lastPeriodIndex;
608 if (dosIndex==0 || hasExt) {
613 lastPeriodIndex = udfLen - 1;
614 while(lastPeriodIndex >=0 &&
619 while(lastPeriodIndex >= 0 &&
623 if (lastPeriodIndex !=
index)
627 if (lastPeriodIndex >= 0) hasExt =
TRUE;
645 while(
index+1 < udfLen &&
664 if (!writingExt && hasExt && (dosIndex ==
DOS_NAME_LEN ||
665 index == lastPeriodIndex)) {
669 index = lastPeriodIndex;
675 if (dosIndex >4) dosIndex = 4;
678 dosName[dosIndex] =
hexChar[(valueCRC & 0xf000) >> 12];
679 dosName[dosIndex+1] =
hexChar[(valueCRC & 0x0f00) >> 8];
680 dosName[dosIndex+2] =
hexChar[(valueCRC & 0x00f0) >> 4];
681 dosName[dosIndex+3] =
hexChar[(valueCRC & 0x000f)];
707 PWCHAR udfName = UdfName->Buffer;
725 #define DOS_CRC_LEN 4
726 #define DOS_CRC_MODULUS 41
739 while (
index-- > 0) {
740 if (udfName[
index] ==
'.')
743 if ((
index < 0) || isParent) {
750 extLen = udfLen -
index - 1;
754 while (++index < udfLen && bytesLeft > 0) {
773 if (charLen > bytesLeft)
785 while (
index +1 <udfLen &&
794 bytesLeft -= charLen;
802 if (
index < udfLen || extLen == 0)
811 while (index < nameLen && bytesLeft > 0) {
829 if (charLen > bytesLeft)
842 while (
index +1 <nameLen &&
847 if (
index >= nameLen)
854 bytesLeft -= charLen;
866 if (overlayBytes < 0) {
872 overlayBytes = (bytesLeft + charLen >
DOS_CRC_LEN)?1 :0;
873 crcIndex = dosIndex - 1;
904 if (overlayBytes > 0)
905 dosName[dosIndex++] =
'_';
907 dosName[dosIndex++] =
'#';
908 dosName[dosIndex++] =
911 dosName[dosIndex++] =
914 dosName[dosIndex++] =
crcChar[valueCRC];
920 dosName[dosIndex++] =
'.';
930#ifndef UDF_READ_ONLY_BUILD
946 AdPrint((
"UDF: SetTag Loc=%x(%x), tagIdent=%x\n", TagLoc,
Tag->tagLocation,
Tag->tagIdent));
948 if(DataLen) DataLen -=
sizeof(
tag);
956 Tag->tagLocation = TagLoc;
958 Tag->descCRCLength = DataLen;
960 Tag->tagChecksum = 0;
963 Tag->tagChecksum += (
i!=4) ? (*tb) : 0;
1012 FileInfo->Dloc->FELoc = _FEExtInfo;
1024 FileEntry->
uid =
Vcb->DefaultUID;
1025 FileEntry->
gid =
Vcb->DefaultGID;
1074 (
tag*)fe, &(FExtInfo->Offset), AExtInfo);
1075 if(!(FExtInfo->Mapping)) {
1076 if(!(FExtInfo->Offset))
1086 FExtInfo->Length = fe->informationLength;
1090 UDFPrint((
" FExtInfo->Length %x\n", FExtInfo->Length));
1092 FExtInfo->Modified =
FALSE;
1144 FileId->
icb = *FileEntryIcb;
1152#ifndef UDF_READ_ONLY_BUILD
1171 Ident =
FileInfo->Dloc->FileEntry->tagIdent;
1201 AdPrint((
"UDFSetFileSizeInDirNdx: %I64x\n", *ASize));
1203 AdPrint((
"UDFSetFileSizeInDirNdx: sync\n"));
1210 Ident =
FileInfo->Dloc->FileEntry->tagIdent;
1244 Ident =
FileInfo->Dloc->FileEntry->tagIdent;
1272#ifndef UDF_READ_ONLY_BUILD
1287 Ident =
FileInfo->Dloc->FileEntry->tagIdent;
1290 if(
FileInfo->Dloc->AllocLoc.Length) {
1300 if(
FileInfo->Dloc->AllocLoc.Length) {
1325 Ident =
FileInfo->Dloc->FileEntry->tagIdent;
1366 Ident =
FileInfo->Dloc->FileEntry->tagIdent;
1382#ifdef UDF_CHECK_UTIL
1399 Ident =
FileInfo->Dloc->FileEntry->tagIdent;
1430 Ident =
FileInfo->Dloc->FileEntry->tagIdent;
1440#ifndef UDF_READ_ONLY_BUILD
1449 Vcb->NextUniqueId++;
1451 Vcb->NextUniqueId += 16;
1452 return Vcb->NextUniqueId;
1472 Ident =
FileInfo->Dloc->FileEntry->tagIdent;
1497 Ident = FileEntry->tagIdent;
1518#ifndef UDF_READ_ONLY_BUILD
1575 UDFPrint((
"UDF: Entity Id Domain:\n"));
1578 UDFPrint((
"Effective Revision: %x\n",
Vcb->CurrentUDFRev));
1597#ifndef UDF_READ_ONLY_BUILD
1631 (*WrittenBytes) = 0;
1633 AdPrint((
"UDFWriteFile__ FE %x, FileInfo %x, ExtInfo %x, Mapping %x\n",
1638 if(t <= Dloc->DataLoc.Length) {
1645 ExtPrint((
" DataLoc Offs %x, Len %I64x\n",
1649 ExtPrint((
" WAlloc-Not-Rec: %I64x <= %I64x (%I64x - %I64x)\n",
1655 ExtPrint((
" w2k-compat -> rebuild allocs\n"));
1658 if((
ULONG)((elen+
Vcb->LBlockSize-1) >>
Vcb->LBlockSizeBits) != (
ULONG)((
t+
Vcb->LBlockSize-1) >>
Vcb->LBlockSizeBits)) {
1659 ExtPrint((
" LBS boundary crossed -> rebuild allocs\n"));
1689 WasInIcb ?
"In-Icb" :
"",
1690 Vcb->LowFreeSpace ?
"LowSpace" :
""));
1695 AdPrint((
" preallocated space for Dir\n"));
1706 ExtPrint((
" DataLoc Offs %x, Len %I64x\n",
1727 AdPrint((
" restore alloc\n"));
1730 FileInfo->Dloc->DataLoc.Flags &= ~EXTENT_FLAG_CUT_PREALLOCATED;
1736 ExtPrint((
" write old in-icd data\n"));
1783 AdPrint((
"UDFUnlinkFile__:\n"));
1808#if defined UDF_DBG || defined PRINT_ALWAYS
1846 if(DirNdx && FreeSpace) {
1851 DirNdx->
FI_Flags &= ~UDF_FI_FLAG_SYS_ATTR;
1858 if(FreeSpace && lc) {
1859 ((
icbtag*)(Dloc->
FileEntry+1))->parentICBLocation.logicalBlockNum = 0;
1860 ((
icbtag*)(Dloc->
FileEntry+1))->parentICBLocation.partitionReferenceNum = 0;
1865 if(FreeSpace && !lc) {
1892 SFileInfo = SDirInfo;
1924 FileInfo->ParentFile->Dloc->FE_Flags &= ~UDF_FE_FLAG_HAS_SDIR;
1939 FileInfo->Dloc->FE_Flags &= ~UDF_FE_FLAG_FE_MODIFIED;
1956 hCurDirNdx = DirInfo->Dloc->DirIndex;
1972 goto err_del_stream;
1974 goto skip_del_stream;
2041 AdPrint((
" FILE_DELETED on open\n"));
2044 if((
FileInfo->ParentFile != DirInfo) &&
2074 AdPrint((
" FILE_DELETED on open (2)\n"));
2106 goto init_tree_entry;
2113 if(!
FileInfo->Dloc->AllocLoc.Mapping) {
2119 if(!(
FileInfo->Dloc->AllocLoc.Mapping))
2142 DirNdx->
FI_Flags &= ~UDF_FI_FLAG_LINKED;
2166#ifndef UDF_READ_ONLY_BUILD
2167 if((
FileInfo->Dloc->DirIndex->DelCount >
Vcb->PackDirThreshold) &&
2215 goto init_tree_entry;
2230 if(!
FileInfo->Dloc->AllocLoc.Mapping) {
2257#ifndef UDF_READ_ONLY_BUILD
2258 if((
FileInfo->Dloc->DirIndex->DelCount >
Vcb->PackDirThreshold) &&
2300 UDFPrint((
"UDF: not all references are closed\n"));
2302 UDFPrint((
"UDF: OpenCount = %x, RefCount = %x, LinkRefCount = %x\n",
2307 UDFPrint((
"Operating System still has references to this file\n"));
2325 UDFPrint((
"Cleanup Mod: %s%s%s%s%s%s\n",
2344 Parallel = (ParFileInfo !=
NULL);
2361 UDFPrint((
"UDF: Found not cleaned up reference.\n"));
2362 UDFPrint((
" Skipping cleanup (1)\n"));
2384 ParFileInfo :
FileInfo->PrevLinkedFile;
2393 UDFPrint((
"UDF: Found not cleaned up reference (SDir).\n"));
2399 Dloc->
SDirInfo->ParentFile = ParFileInfo;
2415 Parallel ? ParFileInfo :
NULL;
2427#ifndef UDF_TRACK_ONDISK_ALLOCATION
2452#ifdef UDF_TRACK_ONDISK_ALLOCATION
2466#ifdef UDF_TRACK_ONDISK_ALLOCATION
2522 FileInfo->ParentFile->Dloc->FE_Flags &= ~UDF_FE_FLAG_HAS_DEL_SDIR;
2555 if(!Parallel &&
FileInfo->FileIdent)
2569#ifndef UDF_READ_ONLY_BUILD
2608 ASSERT(DirInfo->Dloc->FELoc.Mapping[0].extLocation);
2627 goto CreateBothFound;
2650 DirNdx->
FI_Flags &= ~UDF_FI_FLAG_SYS_ATTR;
2670 FileInfo->FileIdent->fileCharacteristics &= ~FILE_DIRECTORY;
2679 FileInfo->FileIdent->fileCharacteristics = 0;
2694 ImpUseLen = (ImpUseLen + 3) & ~((
uint16)3);
2727 FileInfo->FileIdent->fileCharacteristics = 0;
2729 ImpUseLen =
FileInfo->FileIdent->lengthOfImpUse;
2733 ((
icbtag*)(
FileInfo->Dloc->FileEntry+1))->parentICBLocation.logicalBlockNum =
2735 ((
icbtag*)(
FileInfo->Dloc->FileEntry+1))->parentICBLocation.partitionReferenceNum = (
uint16)PartNum;
2740 if(undel)
goto CrF__2;
2741#ifndef UDF_LIMIT_DIR_SIZE
2759#ifndef UDF_LIMIT_DIR_SIZE
2763#ifndef UDF_LIMIT_DIR_SIZE
2773 hDirNdx = DirInfo->Dloc->DirIndex;
2783 if( ((
d = ((LBS - (DirNdx->
Offset +
l + DirInfo->Dloc->DataLoc.Offset)) & (LBS-1) )) <
sizeof(
FILE_IDENT_DESC)) &&
2797 IUl =
FileInfo->FileIdent->lengthOfImpUse;
2798 FIl =
FileInfo->FileIdent->lengthFileIdent;
2821 DirNdx->
FI_Flags &= ~UDF_FI_FLAG_SYS_ATTR;
2829 if(!(
FileInfo->Dloc->DataLoc.Mapping)) {
2833 FileInfo->Dloc->DataLoc.Length = 0;
2847 if(!
Vcb->CDR_Mode) {
2860#ifdef UDF_CHECK_DISK_ALLOCATION
2866 AdPrint((
"Flushing to Discarded block %x\n",
FileInfo->Dloc->FELoc.Mapping[0].extLocation));
2873 FileInfo->FileIdent->fileCharacteristics = 0;
2919#ifndef UDF_READ_ONLY_BUILD
2970 SIZE_T to_write, WrittenBytes;
2980 if((Lba == (
uint32)-1) ||
3003 UDFPrint((
"Closing Current or Parent Directory... :-\\\n"));
3012 UDFPrint((
"ERROR: Closing unreferenced file!\n"));
3015 if(
FileInfo->ParentFile->OpenCount) {
3020 UDFPrint((
"ERROR: Closing unopened file!\n"));
3036 UDFPrint((
"ERROR: Closing unreferenced file!\n"));
3048 UDFPrint((
"ERROR: Closing unopened file!\n"));
3060 if(PartNum == (
uint32)-1) {
3068#ifdef UDF_CHECK_DISK_ALLOCATION
3089 AdPrint((
"Flushing to Discarded block %x\n",
FileInfo->Dloc->FELoc.Mapping[0].extLocation));
3096 if(!
FileInfo->Dloc->FELoc.Mapping[0].extLocation ||
3105 if( !((
icbtag*)(
FileInfo->Dloc->FileEntry+1))->parentICBLocation.logicalBlockNum &&
3106 !((
icbtag*)(
FileInfo->Dloc->FileEntry+1))->parentICBLocation.partitionReferenceNum &&
3112 ((
icbtag*)(
FileInfo->Dloc->FileEntry+1))->parentICBLocation.logicalBlockNum =
3114 ((
icbtag*)(
FileInfo->Dloc->FileEntry+1))->parentICBLocation.partitionReferenceNum = (
uint16)PartNum;
3119 if(!
FileInfo->Dloc->LinkRefCount) {
3131 AdPrint((
"Dir pre-alloc truncated (Close)\n"));
3145 UDFPrint((
"Recovery: mark as deleted & flush FI\n"));
3162 if((
FileInfo->Dloc->FileEntry->descVersion != 2) &&
3163 (
FileInfo->Dloc->FileEntry->descVersion != 3)) {
3171#ifndef UDF_READ_ONLY_BUILD
3201 if(DirInfo1 == DirInfo2) {
3217 IUl = DirNdx2->
FileInfo->FileIdent->lengthOfImpUse;
3246 TRUE, DirInfo2, &FileInfo2))) {
3258 goto cleanup_and_abort_rename;
3282cleanup_and_abort_rename:
3375 (*Replace) = Recovery;
3405 if( DirInfo->FileIdent &&
3411 if(DirInfo->FileIdent) DirInfo->FileIdent->fileCharacteristics |=
FILE_DIRECTORY;
3418 FileInfo.Dloc->FileEntry = DirInfo->ParentFile->Dloc->FileEntry;
3419 FileInfo.Dloc->FileEntryLen = DirInfo->ParentFile->Dloc->FileEntryLen;
3420 FileInfo.Dloc->DataLoc = DirInfo->Dloc->DataLoc;
3421 FileInfo.Dloc->FELoc = DirInfo->Dloc->FELoc;
3424 lba = DirInfo->Dloc->FELoc.Mapping[0].extLocation;
3460 DirInfo->FileIdent->fileCharacteristics;
3520 if(
FileInfo->Dloc->DataLoc.Mapping[0].extLocation !=
3521 FileInfo->Dloc->FELoc.Mapping[0].extLocation) {
3527 >
Vcb->LBlockSize) {
3529 FileInfo->Dloc->DataLoc.Mapping[0].extLength -=
Vcb->LBlockSize;
3530 FileInfo->Dloc->DataLoc.Mapping[0].extLocation += (1 <<
Vcb->LB2B_Bits);
3531 goto mark_data_map_0;
3535 if(
FileInfo->Dloc->AllocLoc.Mapping) {
3537 >
Vcb->LBlockSize) {
3538 FileInfo->Dloc->AllocLoc.Mapping[0].extLength -=
Vcb->LBlockSize;
3539 FileInfo->Dloc->AllocLoc.Mapping[0].extLocation += (1 <<
Vcb->LB2B_Bits);
3548 FileInfo->Dloc->AllocLoc.Length = 0;
3549 FileInfo->Dloc->AllocLoc.Offset = 0;
3555 FileInfo->Dloc->DataLoc.Mapping = NewMap;
3628 PartNum =
Vcb->Partitions[PartNdx].PartitionNum;
3629 root =
Vcb->Partitions[PartNdx].PartitionRoot;
3630 if(
Vcb->LBlockSize !=
Vcb->BlockSize) {
3634 if((
Vcb->LastTrackNum > 1) &&
3635 (
Vcb->LastLBA ==
Vcb->TrackMap[
Vcb->LastTrackNum-1].LastLba)) {
3636 UDFPrint((
"Hardware Read-only volume\n"));
3682 Vcb->minUDFReadRev =
3683 Vcb->minUDFWriteRev =
3684 Vcb->maxUDFWriteRev = 0x0150;
3699 if(!Buf)
goto err_vat_15_2;
3714 UDFPrint((
"unknown (or wrong) VAT format\n"));
3751 Vcb->VatPartNdx = PartNdx;
3761 len =
Vcb->LastPossibleLBA;
3766 for(
j=0; (
j<7) && (
i<
len);
j++,
i++)
3870 int8* NewAllocDescs;
3886 if(
FileInfo->Dloc->AllocLoc.Mapping) {
3891 UDFPrint((
" FlushFE: %x\n",
FileInfo->Dloc->FELoc.Mapping[0].extLocation));
3892#ifndef UDF_READ_ONLY_BUILD
3894 if(
FileInfo->Dloc->DataLoc.Modified ||
3895 FileInfo->Dloc->AllocLoc.Modified) {
3899 UDFPrint((
" FlushFE: UDFBuildAllocDescs() faliled (%x)\n",
status));
3933#if defined(UDF_DBG) && !defined(UDF_CHECK_UTIL)
3955 if(PartNum == (
uint32)(-1) || PartNum == (
uint32)(-2)) {
3956 UDFPrint((
" bad PartNum: %d\n", PartNum));
3965 lba =
FileInfo->Dloc->FELoc.Mapping[0].extLocation;
3966 if(
Vcb->BSBM_Bitmap) {
3981 UDFPrint((
" FlushFE: UDFWriteExtent(2) faliled (%x)\n",
status));
4018 UDFPrint((
" update reference in FI\n"));
4020 FileInfo->FileIdent->icb.extLocation.logicalBlockNum =
4027 goto retry_flush_FE;
4033 FileInfo->Dloc->FE_Flags &= ~UDF_FE_FLAG_FE_MODIFIED;
4037 (
FileInfo->Dloc->FileEntry->descVersion == 3));
4041 if(
FileInfo->Dloc->AllocLoc.Mapping) {
4062 #define lba WrittenBytes
4076#ifndef UDF_READ_ONLY_BUILD
4108 DirNdx->
FI_Flags &= ~UDF_FI_FLAG_FI_MODIFIED;
4133 if(PartNum == (
uint32)-1) {
4141#ifdef UDF_CHECK_DISK_ALLOCATION
4159 AdPrint((
"Flushing to Discarded block %x\n",
FileInfo->Dloc->FELoc.Mapping[0].extLocation));
4177 AdPrint((
"Dir pre-alloc truncated (Flush)\n"));