473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 8774
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

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

Similar topics

5
by: dfg | last post by:
Can I write a boot sector using VB? Is there some built in library, or is it possible to make my own? Can I embed Assembly language? Getting ready to work with Visual Basic for the first...
7
by: Claudio Grondi | last post by:
Googling for keywords like "direct access sector harddrive Python module Windows" seems to give no useful results. Any hints(best if cross-platform)? Claudio
5
by: Sumana | last post by:
Hi All, We developed our project on VC++.Net console application to create image of disk and to write the image We are having problem with reading and writing the sector beyond 6GB Disk or...
12
by: Krunoslav Ostrouska | last post by:
How can i write on specifyed sector on a multimedia card? I must go round file system and write/read direct. C# VS2003 Thanks Kruno
2
by: IT Specialist | last post by:
Any one has any code to create a boot disk in C++ for a pc with no operating system?
4
by: mofthegame | last post by:
Hi, I'm having a problem with this computer I built for the 3rd time it works fine here where I build it but when I bring it to the person I built it forit works fine then by the time I get home I...
5
by: Jordi Maycas | last post by:
Could I do something like this with .net 2005? PROGRAM WriteBootSector; VAR DiskSectorsPerTrack, DiskTracksPerHead, DiskHeads : WORD; FUNCTION WriteSector(Sector : WORD; Buffer : POINTER) :...
3
by: aditigupta | last post by:
hi actually i m using absread to read a particular sector but when i write it i m getting some special characters instead of actual data....... i m writing the data by this command for...
0
by: Chris Calloway | last post by:
Triangle (NC) Zope and Python Users Group (TriZPUG) is proud to open registration for our fourth annual ultra-low cost Plone and Python training camps, BootCampArama 2008: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.