user274494
user274494

Reputation: 11

partition and mbr recovery

how do you read mbr and partition table from the hard disk and edit it? I want to know exactly how do the partition recovery softwares work?

Upvotes: 1

Views: 793

Answers (3)

t0mm13b
t0mm13b

Reputation: 34592

Please see here on what MSDN has to say about 'CreateFile', somewhere down on the page titled 'Physical Disks and Volumes', and see on the KB about this. You would have to make calls to 'DeviceIoControl'.

The partition and MBR is part of the boot sector found at the first sector of the disk, i.e. sector 0.

Be careful! Messing with the partitions will end up losing the data. Don't say you weren't warned!

If you want to access the disk physically prior to Windows starting up, look at Ralph Brown's interrupt list for Int 0x13 (hexadecimal) to do direct Disk I/O. There are some excellent open source software such as 'fdisk', 'cfdisk', 'gnuparted' that will explain how it works. - Use the source luke...

Upvotes: 2

Piskvor left the building
Piskvor left the building

Reputation: 92762

Start by reading up on BIOS interrupt calls, e.g. here: http://en.wikipedia.org/wiki/INT_13

BIOS is probably the closest access you can normally get to hardware - it lives even below the OS and provides, amongst other things, raw disk access.

Upvotes: 1

Pascal Cuoq
Pascal Cuoq

Reputation: 80276

Get the sources of fdisk.

Upvotes: 2

Related Questions