<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>you can simply use VBoxDDU.dll APIs, VDOpen, VDWrite, ...</DIV>
<DIV> </DIV>
<DIV>can be linked directly to your app<BR><BR>--- On <B>Fri, 12/24/10, Maxim Khitrov <I><max@mxcrypt.com></I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>From: Maxim Khitrov <max@mxcrypt.com><BR>Subject: Re: [vbox-dev] Byte-level read/write access to vdi files through Main API<BR>To: "Achim Hasenmüller" <achim.hasenmueller@oracle.com><BR>Cc: vbox-dev@virtualbox.org<BR>Date: Friday, December 24, 2010, 9:00 AM<BR><BR>
<DIV class=plainMail>2010/12/24 Achim Hasenmüller <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=achim.hasenmueller@oracle.com" ymailto="mailto:achim.hasenmueller@oracle.com">achim.hasenmueller@oracle.com</A>>:<BR>>><BR>>> I suspect that the answer to my question is 'no', but would like to<BR>>> get a confirmation. Is there functionality in the Main API (which I'm<BR>>> accessing through COM on Windows) for byte-level read/write access to<BR>>> vdi files?<BR>><BR>> Hehe, of course not. That would not be good for performance.<BR><BR>But it would be very convenient for situations where performance was<BR>not a concern :)<BR><BR>> However, the VirtualBox storage architecture supports a filter driver model. You can develop a simple filter driver and dynamically insert it into the chain of storage drivers.<BR>><BR>> Here's an example filter which we use to perform consistency tests:<BR>><BR>>
 <A href="http://www.virtualbox.org/browser/trunk/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp" target=_blank>http://www.virtualbox.org/browser/trunk/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp</A><BR>><BR>> In its init routine drvdiskintConstruct, it will install the required handlers so that it receives callbacks on disk read/write. If you configure your VM to "Use Host IO cache", then it will be simpler, because there will be no async IO which is much harder to handle.<BR>><BR>> If you want to insert boot sectors, you want to work on the layer above VDI as you only care about sector reads/writes and not how the actual on disk storage looks like.<BR>><BR>> Achim<BR><BR>Sounds like your solution would achieve better abstraction, but I<BR>think it's much more complicated that what I actually need. Ideally,<BR>I'd like to avoid messing with VirtualBox components on the other side<BR>of the Main API. I assume that's where filter
 drivers, such as<BR>DrvDiskIntegrity.cpp, are located?<BR><BR>The API gives me the ability to lock the hard drive for writing and<BR>provides information about its type and location. Given that I don't<BR>need to work with dynamic disks or those that have snapshots, it seems<BR>that the easiest solution is to parse the metadata at the beginning of<BR>the file so that I know what regions correspond to sectors 0, 1, and<BR>so on.<BR><BR>Or is the actual representation of the data on the disk more<BR>complicated than this, even with my set of restrictions?<BR><BR>_______________________________________________<BR>vbox-dev mailing list<BR><A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" ymailto="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</A><BR><A href="http://vbox.innotek.de/mailman/listinfo/vbox-dev" target=_blank>http://vbox.innotek.de/mailman/listinfo/vbox-dev</A><BR></DIV></BLOCKQUOTE></td></tr></table>