c# - Scan disk unallocated space using .Net framework -


i want play around file recovery programming in dotnet (c#). trouble dont know start. seems in dotnet assumes kind of filesystem, directory and/or file exists , im interested in files that, according os dont exist.

i assume have learn more file formats, start , end markers , scan disk space byte codes etc (0xff, 0xd8 in jpegs instance) before wonder how scan disk sector sector, including unallocated space such byte codes in dotnet.

i have little program floating around read disk chunks, you, in c++ using windows api , not .net.

store internal hdd information:

typedef struct drive {     handle hdrive;     int sector;     int *sector_data;     dword dwread;     int sector_size; } drive; 

open reading:

/*-- create structure store drive data --*/ drive cdrive; /*-- open c drive 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 position of reading pointer --*/ setfilepointer(cdrive.hdrive, cdrive.sector*cdrive.sector_size, 0, file_begin); /*-- empty previous sector data (to honest precaution) --*/ memset(cdrive.sector_data, 0, sizeof(cdrive.sector_data)); /*-- read new data --*/ readfile(cdrive.hdrive, cdrive.sector_data, cdrive.sector_size, &cdrive.dwread, 0); 

hope useful you!


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -