␉struct direntry *dirp;␊ |
␉uint16_t␉␉vfatname[WIN_MAXLEN+2*WIN_CHARS];␊ |
␉if (MSDOSInitPartition (ih)<0)␊ |
␉{␊ |
␉␉return -1;␊ |
␉}␊ |
␊ |
␉if (dirPath[0] == '/')␊ |
␉{␊ |
␉␉dirPath++;␊ |
␉}␊ |
␊ |
␉st = (struct msdosdirstate *)(long) *dirIndex;␊ |
␉if (!st)␊ |
␉{␊ |
|
␉␉␉st->cluster = OSReadLittleInt16 ((dirp->deStartCluster),0);␊ |
␉␉␉st->vfatnumber = 0;␊ |
␉␉␉if (msdosfatbits == 32)␊ |
␉␉␉{␊ |
␉␉␉␉st->cluster |= ((uint32_t)OSReadLittleInt16 ((dirp->deHighClust),0)) <<16;␊ |
␉␉␉}␊ |
␊ |
␉␉}␊ |
␉␉else␊ |
␉␉␉initRoot (st);␊ |
|
␉␉}␊ |
␉␉for (i=7;i>=0;i--)␊ |
␉␉␉if (dirp->deName[i]!=' ')␊ |
␉␉␉{␊ |
␉␉␉␉break;␊ |
␉␉␉}␊ |
␊ |
␉␉j=i+1;␊ |
␉␉tmp[i+1]=0;␊ |
␉␉for(;i>=0;i--)␊ |
␉␉␉tmp[i]=(dirp->deName[i]>=128)?cp850[dirp->deName[i]-128][0]:tolower(dirp->deName[i]);␊ |
␉␉for (i=2;i>=0;i--)␊ |
␉␉␉if (dirp->deName[8+i]!=' ')␊ |
␉␉␉{␊ |
␉␉␉␉break;␊ |
␉␉␊ |
␉␉␉}␊ |
␊ |
␉␉if (i>=0)␊ |
␉␉{␊ |
␉␉␉tmp[j++]='.';␊ |
|
␉␉␊ |
␉␉utf_encodestr(tmp, j, (uint8_t*)*name, 25, OSHostByteOrder() );␊ |
␉}␊ |
␊ |
␉if (dirp->deAttributes & ATTR_DIRECTORY)␊ |
␉{␊ |
␉␉*flags = kFileTypeDirectory;␊ |
␉}␊ |
␉else␊ |
␉{␊ |
␉␉*flags = kFileTypeFlat;␊ |
␉␊ |
␉}␊ |
␊ |
␉// Calculate a fake timestamp using modification date and time values.␊ |
␉*time = ((dirp->deMDate & 0x7FFF) << 16) + dirp->deMTime;␊ |
␉␊ |
␉if (infoValid)␊ |
␉{␊ |
␉␉*infoValid = 1;␊ |
␉}␊ |
␊ |
␉return 0;␊ |
}␊ |
|
␉char devStr[12];␊ |
␊ |
␉if (MSDOSInitPartition (ih)<0)␊ |
␉{␊ |
␉␉return -1;␊ |
␉}␊ |
␊ |
␉if (filePath[0] == '/')␊ |
␉{␊ |
␉␉filePath++;␊ |
␉}␊ |
␉buf = malloc(msdosclustersize);␊ |
␉if (!buf)␊ |
␉{␊ |
|
␉}␊ |
␉cluster = OSReadLittleInt16 ((dirp->deStartCluster),0);␊ |
␉if (msdosfatbits == 32)␊ |
␉{␊ |
␉␉cluster |= ((uint32_t)OSReadLittleInt16 ((dirp->deHighClust),0)) <<16;␊ |
␉}␊ |
␊ |
␉size = (uint32_t)OSReadLittleInt32 ((dirp->deFileSize),0);␊ |
␉if (size<=offset)␊ |
␉{␊ |
|
␉msdosreadcluster (ih, buf, msdosclustersize, &cluster);␊ |
␉toread=length;␊ |
␉if (length==0 || length>size-offset)␊ |
␉{␊ |
␉␉toread=size-offset;␊ |
␉}␊ |
␊ |
␉wastoread=toread;␊ |
␉bcopy (buf+(offset%msdosclustersize),ptr,MIN((msdosclustersize-(offset%msdosclustersize)),(unsigned)toread));␊ |
␉ptr+=msdosclustersize-(offset%msdosclustersize);␊ |
|
*/␊ |
␉free (buf);␊ |
␉if (toread<0)␊ |
␉{␊ |
␉␉return wastoread;␊ |
␉}␊ |
␉else␊ |
␉{␊ |
␉␉return wastoread-toread;␊ |
␉}␊ |
}␊ |
␊ |
long ␊ |
MSDOSGetFileBlock(CICell ih, char *filePath, unsigned long long *firstBlock)␊ |
long MSDOSGetFileBlock(CICell ih, char *filePath, unsigned long long *firstBlock)␊ |
{␊ |
␉uint8_t *buf;␊ |
␉off_t cluster;␊ |
|
}␊ |
␊ |
/* Fix up volume label. */␊ |
static void␊ |
fixLabel(uint8_t *label, char *str, long strMaxLen)␊ |
static void fixLabel(uint8_t *label, char *str, long strMaxLen)␊ |
{␊ |
␉int␉␉␉i, len;␊ |
␉uint16_t␉␉labelucs[13];␊ |
|
}␊ |
␊ |
␊ |
void␊ |
MSDOSGetDescription(CICell ih, char *str, long strMaxLen)␊ |
void MSDOSGetDescription(CICell ih, char *str, long strMaxLen)␊ |
{␊ |
␉struct direntry␉␉*dirp;␊ |
␉uint8_t␉␉␉label[LABEL_LENGTH+1];␊ |