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};
40 #else // NO X86 optimization , use generic C/C++ 44 #define DOS_CRC_MODULUS 41 45 #define hexChar crcChar 46 static const char crcChar[] =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ#_~-@";
52 0x0000
U, 0x1021
U, 0x2042
U, 0x3063
U, 0x4084
U, 0x50a5
U, 0x60c6
U, 0x70e7
U,
53 0x8108
U, 0x9129
U, 0xa14a
U, 0xb16b
U, 0xc18c
U, 0xd1ad
U, 0xe1ce
U, 0xf1ef
U,
54 0x1231
U, 0x0210
U, 0x3273
U, 0x2252
U, 0x52b5
U, 0x4294
U, 0x72f7
U, 0x62d6
U,
55 0x9339
U, 0x8318
U, 0xb37b
U, 0xa35a
U, 0xd3bd
U, 0xc39c
U, 0xf3ff
U, 0xe3de
U,
56 0x2462
U, 0x3443
U, 0x0420
U, 0x1401
U, 0x64e6
U, 0x74c7
U, 0x44a4
U, 0x5485
U,
57 0xa56a
U, 0xb54b
U, 0x8528
U, 0x9509
U, 0xe5ee
U, 0xf5cf
U, 0xc5ac
U, 0xd58d
U,
58 0x3653
U, 0x2672
U, 0x1611
U, 0x0630
U, 0x76d7
U, 0x66f6
U, 0x5695
U, 0x46b4
U,
59 0xb75b
U, 0xa77a
U, 0x9719
U, 0x8738
U, 0xf7df
U, 0xe7fe
U, 0xd79d
U, 0xc7bc
U,
60 0x48c4
U, 0x58e5
U, 0x6886
U, 0x78a7
U, 0x0840
U, 0x1861
U, 0x2802
U, 0x3823
U,
61 0xc9cc
U, 0xd9ed
U, 0xe98e
U, 0xf9af
U, 0x8948
U, 0x9969
U, 0xa90a
U, 0xb92b
U,
62 0x5af5
U, 0x4ad4
U, 0x7ab7
U, 0x6a96
U, 0x1a71
U, 0x0a50
U, 0x3a33
U, 0x2a12
U,
63 0xdbfd
U, 0xcbdc
U, 0xfbbf
U, 0xeb9e
U, 0x9b79
U, 0x8b58
U, 0xbb3b
U, 0xab1a
U,
64 0x6ca6
U, 0x7c87
U, 0x4ce4
U, 0x5cc5
U, 0x2c22
U, 0x3c03
U, 0x0c60
U, 0x1c41
U,
65 0xedae
U, 0xfd8f
U, 0xcdec
U, 0xddcd
U, 0xad2a
U, 0xbd0b
U, 0x8d68
U, 0x9d49
U,
66 0x7e97
U, 0x6eb6
U, 0x5ed5
U, 0x4ef4
U, 0x3e13
U, 0x2e32
U, 0x1e51
U, 0x0e70
U,
67 0xff9f
U, 0xefbe
U, 0xdfdd
U, 0xcffc
U, 0xbf1b
U, 0xaf3a
U, 0x9f59
U, 0x8f78
U,
68 0x9188
U, 0x81a9
U, 0xb1ca
U, 0xa1eb
U, 0xd10c
U, 0xc12d
U, 0xf14e
U, 0xe16f
U,
69 0x1080
U, 0x00a1
U, 0x30c2
U, 0x20e3
U, 0x5004
U, 0x4025
U, 0x7046
U, 0x6067
U,
70 0x83b9
U, 0x9398
U, 0xa3fb
U, 0xb3da
U, 0xc33d
U, 0xd31c
U, 0xe37f
U, 0xf35e
U,
71 0x02b1
U, 0x1290
U, 0x22f3
U, 0x32d2
U, 0x4235
U, 0x5214
U, 0x6277
U, 0x7256
U,
72 0xb5ea
U, 0xa5cb
U, 0x95a8
U, 0x8589
U, 0xf56e
U, 0xe54f
U, 0xd52c
U, 0xc50d
U,
73 0x34e2
U, 0x24c3
U, 0x14a0
U, 0x0481
U, 0x7466
U, 0x6447
U, 0x5424
U, 0x4405
U,
74 0xa7db
U, 0xb7fa
U, 0x8799
U, 0x97b8
U, 0xe75f
U, 0xf77e
U, 0xc71d
U, 0xd73c
U,
75 0x26d3
U, 0x36f2
U, 0x0691
U, 0x16b0
U, 0x6657
U, 0x7676
U, 0x4615
U, 0x5634
U,
76 0xd94c
U, 0xc96d
U, 0xf90e
U, 0xe92f
U, 0x99c8
U, 0x89e9
U, 0xb98a
U, 0xa9ab
U,
77 0x5844
U, 0x4865
U, 0x7806
U, 0x6827
U, 0x18c0
U, 0x08e1
U, 0x3882
U, 0x28a3
U,
78 0xcb7d
U, 0xdb5c
U, 0xeb3f
U, 0xfb1e
U, 0x8bf9
U, 0x9bd8
U, 0xabbb
U, 0xbb9a
U,
79 0x4a75
U, 0x5a54
U, 0x6a37
U, 0x7a16
U, 0x0af1
U, 0x1ad0
U, 0x2ab3
U, 0x3a92
U,
80 0xfd2e
U, 0xed0f
U, 0xdd6c
U, 0xcd4d
U, 0xbdaa
U, 0xad8b
U, 0x9de8
U, 0x8dc9
U,
81 0x7c26
U, 0x6c07
U, 0x5c64
U, 0x4c45
U, 0x3ca2
U, 0x2c83
U, 0x1ce0
U, 0x0cc1
U,
82 0xef1f
U, 0xff3e
U, 0xcf5d
U, 0xdf7c
U, 0xaf9b
U, 0xbfba
U, 0x8fd9
U, 0x9ff8
U,
83 0x6e17
U, 0x7e36
U, 0x4e55
U, 0x5e74
U, 0x2e93
U, 0x3eb2
U, 0x0ed1
U, 0x1ef0
U 87 0x00000000
L, 0x77073096
L, 0xee0e612c
L, 0x990951ba
L, 0x076dc419
L,
88 0x706af48f
L, 0xe963a535
L, 0x9e6495a3
L, 0x0edb8832
L, 0x79dcb8a4
L,
89 0xe0d5e91e
L, 0x97d2d988
L, 0x09b64c2b
L, 0x7eb17cbd
L, 0xe7b82d07
L,
90 0x90bf1d91
L, 0x1db71064
L, 0x6ab020f2
L, 0xf3b97148
L, 0x84be41de
L,
91 0x1adad47d
L, 0x6ddde4eb
L, 0xf4d4b551
L, 0x83d385c7
L, 0x136c9856
L,
92 0x646ba8c0
L, 0xfd62f97a
L, 0x8a65c9ec
L, 0x14015c4f
L, 0x63066cd9
L,
93 0xfa0f3d63
L, 0x8d080df5
L, 0x3b6e20c8
L, 0x4c69105e
L, 0xd56041e4
L,
94 0xa2677172
L, 0x3c03e4d1
L, 0x4b04d447
L, 0xd20d85fd
L, 0xa50ab56b
L,
95 0x35b5a8fa
L, 0x42b2986c
L, 0xdbbbc9d6
L, 0xacbcf940
L, 0x32d86ce3
L,
96 0x45df5c75
L, 0xdcd60dcf
L, 0xabd13d59
L, 0x26d930ac
L, 0x51de003a
L,
97 0xc8d75180
L, 0xbfd06116
L, 0x21b4f4b5
L, 0x56b3c423
L, 0xcfba9599
L,
98 0xb8bda50f
L, 0x2802b89e
L, 0x5f058808
L, 0xc60cd9b2
L, 0xb10be924
L,
99 0x2f6f7c87
L, 0x58684c11
L, 0xc1611dab
L, 0xb6662d3d
L, 0x76dc4190
L,
100 0x01db7106
L, 0x98d220bc
L, 0xefd5102a
L, 0x71b18589
L, 0x06b6b51f
L,
101 0x9fbfe4a5
L, 0xe8b8d433
L, 0x7807c9a2
L, 0x0f00f934
L, 0x9609a88e
L,
102 0xe10e9818
L, 0x7f6a0dbb
L, 0x086d3d2d
L, 0x91646c97
L, 0xe6635c01
L,
103 0x6b6b51f4
L, 0x1c6c6162
L, 0x856530d8
L, 0xf262004e
L, 0x6c0695ed
L,
104 0x1b01a57b
L, 0x8208f4c1
L, 0xf50fc457
L, 0x65b0d9c6
L, 0x12b7e950
L,
105 0x8bbeb8ea
L, 0xfcb9887c
L, 0x62dd1ddf
L, 0x15da2d49
L, 0x8cd37cf3
L,
106 0xfbd44c65
L, 0x4db26158
L, 0x3ab551ce
L, 0xa3bc0074
L, 0xd4bb30e2
L,
107 0x4adfa541
L, 0x3dd895d7
L, 0xa4d1c46d
L, 0xd3d6f4fb
L, 0x4369e96a
L,
108 0x346ed9fc
L, 0xad678846
L, 0xda60b8d0
L, 0x44042d73
L, 0x33031de5
L,
109 0xaa0a4c5f
L, 0xdd0d7cc9
L, 0x5005713c
L, 0x270241aa
L, 0xbe0b1010
L,
110 0xc90c2086
L, 0x5768b525
L, 0x206f85b3
L, 0xb966d409
L, 0xce61e49f
L,
111 0x5edef90e
L, 0x29d9c998
L, 0xb0d09822
L, 0xc7d7a8b4
L, 0x59b33d17
L,
112 0x2eb40d81
L, 0xb7bd5c3b
L, 0xc0ba6cad
L, 0xedb88320
L, 0x9abfb3b6
L,
113 0x03b6e20c
L, 0x74b1d29a
L, 0xead54739
L, 0x9dd277af
L, 0x04db2615
L,
114 0x73dc1683
L, 0xe3630b12
L, 0x94643b84
L, 0x0d6d6a3e
L, 0x7a6a5aa8
L,
115 0xe40ecf0b
L, 0x9309ff9d
L, 0x0a00ae27
L, 0x7d079eb1
L, 0xf00f9344
L,
116 0x8708a3d2
L, 0x1e01f268
L, 0x6906c2fe
L, 0xf762575d
L, 0x806567cb
L,
117 0x196c3671
L, 0x6e6b06e7
L, 0xfed41b76
L, 0x89d32be0
L, 0x10da7a5a
L,
118 0x67dd4acc
L, 0xf9b9df6f
L, 0x8ebeeff9
L, 0x17b7be43
L, 0x60b08ed5
L,
119 0xd6d6a3e8
L, 0xa1d1937e
L, 0x38d8c2c4
L, 0x4fdff252
L, 0xd1bb67f1
L,
120 0xa6bc5767
L, 0x3fb506dd
L, 0x48b2364b
L, 0xd80d2bda
L, 0xaf0a1b4c
L,
121 0x36034af6
L, 0x41047a60
L, 0xdf60efc3
L, 0xa867df55
L, 0x316e8eef
L,
122 0x4669be79
L, 0xcb61b38c
L, 0xbc66831a
L, 0x256fd2a0
L, 0x5268e236
L,
123 0xcc0c7795
L, 0xbb0b4703
L, 0x220216b9
L, 0x5505262f
L, 0xc5ba3bbe
L,
124 0xb2bd0b28
L, 0x2bb45a92
L, 0x5cb36a04
L, 0xc2d7ffa7
L, 0xb5d0cf31
L,
125 0x2cd99e8b
L, 0x5bdeae1d
L, 0x9b64c2b0
L, 0xec63f226
L, 0x756aa39c
L,
126 0x026d930a
L, 0x9c0906a9
L, 0xeb0e363f
L, 0x72076785
L, 0x05005713
L,
127 0x95bf4a82
L, 0xe2b87a14
L, 0x7bb12bae
L, 0x0cb61b38
L, 0x92d28e9b
L,
128 0xe5d5be0d
L, 0x7cdcefb7
L, 0x0bdbdf21
L, 0x86d3d2d4
L, 0xf1d4e242
L,
129 0x68ddb3f8
L, 0x1fda836e
L, 0x81be16cd
L, 0xf6b9265b
L, 0x6fb077e1
L,
130 0x18b74777
L, 0x88085ae6
L, 0xff0f6a70
L, 0x66063bca
L, 0x11010b5c
L,
131 0x8f659eff
L, 0xf862ae69
L, 0x616bffd3
L, 0x166ccf45
L, 0xa00ae278
L,
132 0xd70dd2ee
L, 0x4e048354
L, 0x3903b3c2
L, 0xa7672661
L, 0xd06016f7
L,
133 0x4969474d
L, 0x3e6e77db
L, 0xaed16a4a
L, 0xd9d65adc
L, 0x40df0b66
L,
134 0x37d83bf0
L, 0xa9bcae53
L, 0xdebb9ec5
L, 0x47b2cf7f
L, 0x30b5ffe9
L,
135 0xbdbdf21c
L, 0xcabac28a
L, 0x53b39330
L, 0x24b4a3a6
L, 0xbad03605
L,
136 0xcdd70693
L, 0x54de5729
L, 0x23d967bf
L, 0xb3667a2e
L, 0xc4614ab8
L,
137 0x5d681b02
L, 0x2a6f2b94
L, 0xb40bbe37
L, 0xc30c8ea1
L, 0x5a05df1b
L,
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) {
359 #pragma warning(push) 360 #pragma warning(disable:4035) // re-enable below 375 #if defined (_X86_) && defined (_MSC_VER) 396 #else // NO X86 optimization , use generic C/C++ 404 #pragma warning(pop) // re-enable warning #4035 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;
773 if (charLen > bytesLeft)
785 while (
index +1 <udfLen &&
794 bytesLeft -= charLen;
802 if (
index < udfLen || extLen == 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;
1016 FileEntry->icbTag.flags = AllocMode;
1018 FileEntry->icbTag.numEntries = 1;
1020 FileEntry->icbTag.strategyType = 4;
1024 FileEntry->uid =
Vcb->DefaultUID;
1025 FileEntry->gid =
Vcb->DefaultGID;
1033 lcp = &(FileEntry->fileLinkCount);
1055 #endif //UDF_READ_ONLY_BUILD 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;
1141 FileId->fileVersionNum = 1;
1142 FileId->lengthOfImpUse = (
uint16)ImpUseLen;
1143 FileId->lengthFileIdent = (
uint8)Nlen;
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;
1230 #endif //UDF_READ_ONLY_BUILD 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;
1349 #endif //UDF_READ_ONLY_BUILD 1366 Ident =
FileInfo->Dloc->FileEntry->tagIdent;
1382 #ifdef UDF_CHECK_UTIL 1387 UDFSetFileLinkCount(
1399 Ident =
FileInfo->Dloc->FileEntry->tagIdent;
1414 #endif //UDF_CHECK_UTIL 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;
1484 #endif //UDF_READ_ONLY_BUILD 1497 Ident = FileEntry->tagIdent;
1518 #ifndef UDF_READ_ONLY_BUILD 1556 #endif //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",
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"));
1736 ExtPrint((
" write old in-icd data\n"));
1783 AdPrint((
"UDFUnlinkFile__:\n"));
1808 #if defined UDF_DBG || defined PRINT_ALWAYS 1846 if(DirNdx && FreeSpace) {
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;
1956 hCurDirNdx = DirInfo->Dloc->DirIndex;
1972 goto err_del_stream;
1974 goto skip_del_stream;
1996 #endif //UDF_READ_ONLY_BUILD 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))
2166 #ifndef UDF_READ_ONLY_BUILD 2167 if((
FileInfo->Dloc->DirIndex->DelCount >
Vcb->PackDirThreshold) &&
2173 #endif //UDF_READ_ONLY_BUILD 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) &&
2264 #endif //UDF_READ_ONLY_BUILD 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 2440 #endif //UDF_TRACK_ONDISK_ALLOCATION 2452 #ifdef UDF_TRACK_ONDISK_ALLOCATION 2463 #endif //UDF_TRACK_ONDISK_ALLOCATION 2466 #ifdef UDF_TRACK_ONDISK_ALLOCATION 2486 #endif //UDF_TRACK_ONDISK_ALLOCATION 2555 if(!Parallel &&
FileInfo->FileIdent)
2569 #ifndef UDF_READ_ONLY_BUILD 2608 ASSERT(DirInfo->Dloc->FELoc.Mapping[0].extLocation);
2627 goto CreateBothFound;
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 2743 #endif // UDF_LIMIT_DIR_SIZE 2759 #ifndef UDF_LIMIT_DIR_SIZE 2761 #endif // UDF_LIMIT_DIR_SIZE 2763 #ifndef UDF_LIMIT_DIR_SIZE 2765 #endif // 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;
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));
2870 #endif // UDF_CHECK_DISK_ALLOCATION 2873 FileInfo->FileIdent->fileCharacteristics = 0;
2897 #endif //UDF_READ_ONLY_BUILD 2919 #ifndef UDF_READ_ONLY_BUILD 2970 SIZE_T to_write, WrittenBytes;
2980 if((Lba == (
uint32)-1) ||
2987 #endif //UDF_READ_ONLY_BUILD 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 ||
3103 #endif // UDF_CHECK_DISK_ALLOCATION 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;
3282 cleanup_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;
3596 #endif //UDF_READ_ONLY_BUILD 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;
4037 (
FileInfo->Dloc->FileEntry->descVersion == 3));
4039 #endif //UDF_READ_ONLY_BUILD 4041 if(
FileInfo->Dloc->AllocLoc.Mapping) {
4062 #define lba WrittenBytes 4076 #ifndef UDF_READ_ONLY_BUILD 4110 #endif //UDF_READ_ONLY_BUILD 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));
4163 #endif // UDF_CHECK_DISK_ALLOCATION 4177 AdPrint((
"Dir pre-alloc truncated (Flush)\n"));
4196 UDFPrint((
"Recovery: mark as deleted & flush FI\n"));
4209 (
FileInfo->Dloc->FileEntry->descVersion == 3));
4230 if(
f1->Dloc->FileEntryLen !=
f2->Dloc->FileEntryLen)
return FALSE;
4236 if(
f1->Index !=
f2->Index)
return FALSE;
4237 if(!(
f1->Dloc->DataLoc.Mapping))
return FALSE;
4238 if(!(
f2->Dloc->DataLoc.Mapping))
return FALSE;
4239 if(
f1->Dloc->DataLoc.Mapping[0].extLocation !=
f2->Dloc->DataLoc.Mapping[0].extLocation)
return FALSE;
4240 if(
f1->Dloc->DataLoc.Mapping[0].extLength !=
f2->Dloc->DataLoc.Mapping[0].extLength)
return FALSE;
4244 if(!(
f1->Dloc->FileEntry))
return FALSE;
4245 if(!(
f2->Dloc->FileEntry))
return FALSE;
4248 if(!(hDirIndex1 =
f1->Dloc->DirIndex))
return FALSE;
4249 if(!(hDirIndex2 =
f2->Dloc->DirIndex))
return FALSE;