求教一下这个偏移如何实现?
void CsectorDlg::OnBnClickedButton1(){
// TODO: 在此添加控件通知处理程序代码
UpdateData(TRUE);
int i,j;
unsigned char buf[512];
OVERLAPPED overlap;
HANDLE hFile = CreateFile(_T("\\\\.\\PhysicalDrive0"),
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
NULL,//FILE_FLAG_OVERLAPPED,
NULL);
DWORD RSize=0;
overlap.Offset = (DWORD)( m_sanqu*512ull % 0x100000000ull );
overlap.OffsetHigh = (DWORD)( m_sanqu*512ull / 0x100000000ull );
ReadFile(hFile, buf, 512, &RSize, &overlap/*NULL*/);
CloseHandle(hFile);
for(j=0;j<512;j++)
{
CString buf1[1000]={0};
if(buf[j]/16%16==0)
{
buf1[j].Format(_T("0%X "),buf[j]);
if((j+1)%16==0&&(j+1))
{
buf1[j].Format(_T("0%X"),buf[j]);
}
}
else
{
buf1[j].Format(_T("%2X "),buf[j]);
if((j+1)%16==0&&(j+1))
{
buf1[j].Format(_T("%2X"),buf[j]);
}
}
m_sector+=buf1[j];
}
UpdateData(FALSE);
}
其他地方我都做过检查了就是offset偏移那块有问题,只要有偏移在程序里就无法实现,求教一下如何实现读取位置的偏移。多谢了