1

Does anyone have any example code that shows how to identify the system boot harddisk, and read/write the mbr from the harddisk in windows xp and vista?

I know createfile can be used. But I do not know how to properly identify which device is the boot device.

Like how do you find out which ones you are meant to use? \.\Volume{GUID}\ or \?\Device\HarddiskVolumeX etc?

  • 1
    Danger! Danger Will Robinson! - Why exactly are you needing to write to the MBR? – Amber Aug 03 '09 at 08:50
  • @Dav: There are lots of legitimate uses. But there are also lotsa ways to screw it all up. – EFraim Aug 03 '09 at 08:53
  • 1
    We are using a custom boot loader, and I want to be able to update the text messages that it displays, its just a couple short strings in the MBR. I already know i can do it with dd etc. but I was wondering what the proper API way to do it so it works in vista with all the security. –  Aug 03 '09 at 09:02

1 Answers1

0

you could try looking through the source of rawwrite for windows http://www.chrysocome.net/rawwrite

Spudd86
  • 2,986
  • 22
  • 20
  • 1
    Unfortuently there is some trick to it that was added for nt6, rawwrite doesnt work on vista or windows7. –  Aug 05 '09 at 09:51