| if (ReadSectors(uDiskID, m_uFrom, (UINT)dwSectorNum, bBuf) == FALSE) { MessageBox("所选磁盘分区不存在!", "错误", MB_OK | MB_ICONERROR); return; } |
| for (DWORD i = 0; i < dwSectorNum * 512; i++) { sprintf(cBuf, "%s%02X ", cBuf, bBuf[i]); if ((i % 512) == 511) sprintf(cBuf, "%s\r\n第%d扇区\r\n", cBuf, (int)(i / 512) + m_uFrom); if ((i % 16) == 15) sprintf(cBuf, "%s\r\n", cBuf); else if ((i % 16) == 7) sprintf(cBuf, "%s- ", cBuf); } |
![]() |
| file.Open(fileDlg.GetPathName(), CFile::modeCreate | CFile::modeReadWrite); …… if (ReadSectors(uDiskID, m_uFrom, (UINT)dwSectorNum, bBuf) == FALSE) { MessageBox("所选磁盘分区不存在!", "错误", MB_OK | MB_ICONERROR); return; } file.Write(bBuf, dwSectorNum * 512); file.Close(); |
| file.Open(fileDlg.GetPathName(), CFile::modeReadWrite); DWORD dwSectorNum = file.GetLength(); if (dwSectorNum % 512 != 0) return; dwSectorNum /= 512; unsigned char* bBuf = new unsigned char[dwSectorNum * 512]; file.Read(bBuf, dwSectorNum * 512); if (WriteSectors(uDiskID, m_uFrom, (UINT)dwSectorNum, bBuf) == FALSE) { MessageBox("所选磁盘分区不存在!", "错误", MB_OK | MB_ICONERROR); return; } file.Close(); delete[] bBuf; |
| unsigned char bBuf[512]; UINT i = 0; BOOL bRet = TRUE; while (m_bAllDisk){ memset(bBuf, 0xFF, sizeof(bBuf)); bRet = WriteSectors(uDiskID, i, 1, bBuf); memset(bBuf, 0, sizeof(bBuf)); bRet = WriteSectors(uDiskID, i, 1, bBuf); if (bRet == FALSE){ if (i == 0) MessageBox("所选磁盘分区不存在!", "错误", MB_OK | MB_ICONERROR); else MessageBox("磁盘数据擦除完毕!", "错误", MB_OK | MB_ICONERROR); return; } i++; } |
关注此文的读者还看过: