473,231 Members | 2,587 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,231 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 8750
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: ...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.