总算把问题解决了

找来找去还是那个XB_BUF的边界问题

XSEG     AT  0000H
PRD:  DS 8 ;PRD has to be defined at WORD boundary.  
XB_BUF0:   DS   512
XB_BUF1:   DS  512
XB_BUF2:     DS  512 ;use by the media function as backup

三点

1,创建文件名时 反复拷贝 常常会重名  导致错误退出

2,fatGetNextClusterChain的程序里就有逻辑不严的问题

ULONG fatGetNextClusterChain(PCLUSTERCHAININFO PChainInfo)
{
   ULONG Len;
   BYTE byStatus;
/*
   if(ccbuf.ChainBufferCount==1) byStatus = fatGetFreeArea();
   if (byStatus == 0) return 0;
*/
   if(ccbuf.ChainBufferCount==1)
   { byStatus = fatGetFreeArea();
    if (byStatus == 0) return 0;
   }

   memcpy(PChainInfo,(PCLUSTERCHAININFO)&ccbuf.ChainBuffer[ccbuf.ChainBufferRp],sizeof(CLUSTERCHAININFO));
   if(ccbuf.ChainBufferRp>CHAINBUFLEN-2)
    ccbuf.ChainBufferRp =0;
   else
    ccbuf.ChainBufferRp++;
   ccbuf.ChainBufferCount–;
   Len = PChainInfo->EndCluster – PChainInfo->StartCluster ;
   return Len;
}
3

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: