If you want to write C# code, then you'll have to use P/Invoke to read data from your disk (RAW access).
Is there any way to just read an entire drive's contents bit by bit?
You'll have to make a difference between the drive (logical representation of your flash card, with a FileSystem installed on it, specified by the drive letter) and the disk (physical representation of your flash card, specified by the disk number).
See my previous answer about how to read RAW data from a drive/disk:
Basically, you'll first need a handle to the disk/drive:
// For a DISK:
IntPtr hDisk = CreateFile(string.Format("\\\\.\\PhysicalDrive{0}", diskNumber),
GenericRead,
Read | Write,
0,
OpenExisting,
0,
IntPtr.Zero);
// For a DRIVE
IntPtr hDrive = NativeMethods.CreateFile(
string.Format("\\\\.\\{0}:", DriveLetter)
GenericRead,
Read | Write,
IntPtr.Zero,
OpenExisting,
0,
IntPtr.Zero);
Then use SetFilePointerEx
(so you can move the offset where you want to read), ReadFile
(fills a buffer with bytes read from the disk/drive), CloseHandle
(closes the handle opened by CreateFile).
Read the disk/drive by chunks (so basically, a loop from offset "0" to offset "disk/drive size").
What's important (or ReadFile
will always fail): the size of read chunks must be a multiple of the sector size of your disk (512 bytes generally).