我在读FAT表时遇到运行时错误,错误说:
变量已损坏。
这是我的代码
void Drive::readFatTable()
{
int c = 0;
DWORD nOBTR = 0;
HANDLE usb = NULL;
usb = CreateFile("\\\\.\\A:",GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,0,NULL);
BYTE buff[513];
memset(buff,0,512);
if(usb==INVALID_HANDLE_VALUE)
{
std::cout<<"ERROR in reading : "<<GetLastError()<<std::endl;
return;
}
UINT32 fat_start = 0;//seek to table
calc(fat_start);
seek_to_sect(usb,fat_start,_bpb.BPB_BytsPerSec);
LPVOID ptr = &fat_table;
UINT32 ent = 0;
while(c < _bpb.BPB_FATSz32)
{
c++;
if(!ReadFile(usb,buff,sizeof(BPB),&nOBTR,0))
{
std::cout<<"ERROR in reading fat: "<<GetLastError()<<std::endl;
return;
}
BYTE* ptr = buff;
for (int i=0;i<16;i++)
{
memcpy(&ent,ptr,32);
fat_table.push_back(ent);
ptr+=32;
}
}
CloseHandle(usb);
std::cout<<GetLastError()<<std::endl;
//delete(&fat_start);
}
答案 0 :(得分:3)
您正在将32个字节的数据复制到一个4字节的变量中:
libs\regex\build\has_icu_test.cpp(12) : fatal error C1083: Cannot open include file: 'unicode/uversion.h': No such file or directory