I have a little program floating around that will read the disk by chunks, this will help you, but it is in C++ using windows API and not .net.
Store internal HDD Information:
typedef struct DRIVE {
HANDLE hDrive;
int sector;
int *sector_data;
DWORD dwRead;
int sector_size;
} drive;
Open for reading:
/*-- Create Structure to store drive data --*/
DRIVE CDRIVE;
/*-- Open the C drive as a file --*/
CDRIVE.hDrive = CreateFile("\\\\.\\C:", GENERIC_READ, (FILE_SHARE_READ | FILE_SHARE_WRITE), NULL, OPEN_EXISTING, NULL, NULL);
/*-- Set Initial Data in Drive Structure --*/
CDRIVE.sector = 0;
CDRIVE.sector_size = WHATEVER_YOU_CHOOSE;
CDRIVE.sector_data = new int[WHATEVER_YOU_CHOOSE];
if(CDRIVE.hDrive == INVALID_HANDLE_VALUE) {
return false;
}
Reading:
/*-- Set the position of the reading pointer --*/
SetFilePointer(CDRIVE.hDrive, CDRIVE.sector*CDRIVE.sector_size, 0, FILE_BEGIN);
/*-- empty the previous sector data (to be honest this is only a precaution) --*/
memset(CDRIVE.sector_data, 0, sizeof(CDRIVE.sector_data));
/*-- Read the new data --*/
ReadFile(CDRIVE.hDrive, CDRIVE.sector_data, CDRIVE.sector_size, &CDRIVE.dwRead, 0);
Hope this is useful to you!