[vbox-dev] Byte-level read/write access to vdi files through Main API

Maxim Khitrov max at mxcrypt.com
Fri Dec 24 07:47:06 PST 2010

Hello all,

I suspect that the answer to my question is 'no', but would like to
get a confirmation. Is there functionality in the Main API (which I'm
accessing through COM on Windows) for byte-level read/write access to
vdi files?

My goal is to write my own boot loader just for experimentation, so I
need an easy way of modifying disk sectors outside of the VM. The goal
is to have a python script that would update the boot loader code
after I make changes to it, configure some VM parameters, and then
start the VM.

I got almost everything working, including getting access to the right
IMedium interface for the hard drive, but as I searched for how to
write data to it after calling lockWrite, I found nothing relevant. Am
I correct in assuming that the API will only protect the image from
modification by other clients, but actually changing disk contents
will require me to open the .vdi file and then parse the internal
metadata myself?

If so, where can I find the documentation for vdi file layout? I did
search, but didn't find anything. If there is no documentation, can
you point me to the relevant portions of the VirtualBox code so I can
convert the parts that I need to python? I only need a subset of the
functionality that deals with fixed-size images and no snapshots.

Thanks for your help,

More information about the vbox-dev mailing list