{
char *lfn;
__u8sum;
int i;
if (de->attr == VFAT_LN_ATTR)
die("lfn_get called with LFN directory entry");
#if 0if (de->lcase)
VfatPrint( "lcase=%02x\n",de->lcase );
#endifif (lfn_slot == -1)
/* no long name for this file */returnNULL;
if (lfn_slot != 0) {
/* The long name isn't finished yet. *//* Causes: 1) LFN slot overwritten by non-VFAT aware tool *//* Fixes: 1) delete LFN 2) move overwriting entry to somewhere else * and let user enter missing part of LFN (hard to do :-() * 3) renumber entries and truncate name */char *long_name = CNV_PARTS_SO_FAR();
char *short_name = file_name(de->name);
VfatPrint( "Unfinished long file name \"%s\".\n"" (Start may have been overwritten by %s)\n",
long_name, short_name );
vffree( long_name );
if (FsCheckFlags & FSCHECK_INTERACTIVE) {
VfatPrint( "1: Delete LFN\n2: Leave it as it is.\n""3: Fix numbering (truncates long name and attaches ""it to short name %s)\n", short_name );
}
elseVfatPrint( " Not auto-correcting this.\n" );
if (FsCheckFlags & FSCHECK_INTERACTIVE) {
switch( get_key( "123", "?" )) {
case'1':
clear_lfn_slots( 0, lfn_parts-1 );
lfn_reset();
returnNULL;
case'2':
lfn_reset();
returnNULL;
case'3':
for( i = 0; i < lfn_parts; ++i ) {
__u8id = (lfn_parts-i) | (i==0 ? LFN_ID_START : 0);
fs_write( lfn_offsets[i]+offsetof(LFN_ENT,id),
sizeof(id), &id );
}
memmove( lfn_unicode, lfn_unicode+lfn_slot*CHARS_PER_LFN*2,
lfn_parts*CHARS_PER_LFN*2 );
break;
}
}
}
for (sum = 0, i = 0; i < 8; i++)
sum = (((sum&1) << 7) | ((sum&0xfe) >> 1)) + de->name[i];
for (i = 0; i < 3; i++)
sum = (((sum&1) << 7) | ((sum&0xfe) >> 1)) + de->ext[i];
if (sum != lfn_checksum) {
/* checksum doesn't match, long name doesn't apply to this alias *//* Causes: 1) alias renamed *//* Fixes: 1) Fix checksum in LFN entries */char *long_name = CNV_PARTS_SO_FAR();
char *short_name = file_name(de->name);
VfatPrint( "Wrong checksum for long file name \"%s\".\n"" (Short name %s may have changed without updating the long name)\n",
long_name, short_name );
vffree( long_name );
if (FsCheckFlags & FSCHECK_INTERACTIVE) {
VfatPrint( "1: Delete LFN\n2: Leave it as it is.\n""3: Fix checksum (attaches to short name %s)\n",
short_name );
}
elseVfatPrint( " Not auto-correcting this.\n" );
if (FsCheckFlags & FSCHECK_INTERACTIVE) {
switch( get_key( "123", "?" )) {
case'1':
clear_lfn_slots( 0, lfn_parts-1 );
lfn_reset();
returnNULL;
case'2':
lfn_reset();
returnNULL;
case'3':
for( i = 0; i < lfn_parts; ++i ) {
fs_write( lfn_offsets[i]+offsetof(LFN_ENT,alias_checksum),
sizeof(sum), &sum );
}
break;
}
}
}
lfn = cnv_unicode( lfn_unicode, UNTIL_0, 1 );
lfn_reset();
return( lfn );
}
Generated on Sun May 27 2012 06:04:13 for ReactOS by
1.7.6.1
ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.