0

I'm trying to read a partition block by block using vc++. The hard drive has a block size of 512 bytes and the partition table tells me that the partition has a start offset of 128 and an end offset of 2048128. Since the partition is 1000MB in size, in my opinion the end offset should be 2048127 - whatever.

Now I open the volume with CreateFile (e.g. \?\Volume{a49ac1d4-723b-11ee-83be-386893b7f76d}) and read blocks of 512 bytes with ReadFile.

This works until block 2048120. After that, ReadFile signals EOF.

Can someone explain to me why this is so?

Is it correct that I cannot read the last 8 blocks of a partition (for whatever reason) or am I making a (thinking) mistake?

2
  • As a test, I reduced the partition to 100 MB. Here too I cannot read the last 8 blocks... Commented Oct 24, 2023 at 14:07
  • OK - found an error. It's as I already suspected. If Windows gives me the start offset with 128 and the end offset with 2048128 and I look at the disk under Linux with parted or fdisk, then Linux gives me the end offset with 2048127. ;-) However, that still doesn't explain why I can't read the last 8 (which is then only 7) sectors under Windows. :-( Commented Oct 24, 2023 at 16:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.