468,512 Members | 1,406 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

Boot Sector - can it be read using C++?

jlm699
314 100+
Greetings friends,

It's been a while since I've visited this C/C++ forum, and as expected my C++ is unacceptably rusty. Recently I've been reading about Master Boot Records (MBR) and the boot process of a computer. Now I've downloaded small utilities that have the ability to read (and backup to file) the MBR of a partition. These utilities usually have the ability to restore the MBR from a file or simply "fix" the MBR. What I'm wondering: Can a similar utility be written in C++ ? I have no idea what these programs may have been written in, btw.

Alright so I know that was long-winded but my only real question is, is it possible to access and read the portion of the disk that contains the MBR via C++ and can somebody point me in the direction of how to achieve this?

thanks!

James
Feb 29 '08 #1
1 7691
oler1s
671 Expert 512MB
Can a similar utility be written in C++ ?
Absolutely. As you might realize, a lot of the limitations of a programming language arise from the library bindings it has. In this case, you care about the bindings to the operating system API, as the operating system has control of the hard disk and filesystem. Currently, Microsoft maintains two sets of APIs for working with Windows: the old C WinAPI and the newer .NET APIs. C++, by compatibility with C, has access to the Windows API.

So you'll basically have to figure out how to use the Windows API to get access to the hard disk. Then, in combination with knowledge of filesystems and hard drives and so on, you can write code to work with the MBR.
Feb 29 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by dfg | last post: by
5 posts views Thread by Sumana | last post: by
12 posts views Thread by Krunoslav Ostrouska | last post: by
2 posts views Thread by IT Specialist | last post: by
4 posts views Thread by mofthegame | last post: by
5 posts views Thread by Jordi Maycas | last post: by
reply views Thread by Chris Calloway | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.