<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">after the fix, VHD->VMDk seems to be working fine, but VHD->VDI still not working, the generated vdi disk throws invalid header error.<BR><BR>--- On <B>Wed, 10/7/09, Huihong Luo <I><huisinro@yahoo.com></I></B> wrote:<BR>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>From: Huihong Luo <huisinro@yahoo.com><BR>Subject: [vbox-dev] VDCopy() fix for VHD<BR>To: vbox-dev@virtualbox.org<BR>Date: Wednesday, October 7, 2009, 12:30 AM<BR><BR>
<DIV id=yiv977877906>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD vAlign=top>
<DIV>Can you guys add the following code to function VDCopy() in VBoxHDD.cpp? right before VDCreateBase() is called. </DIV>
<DIV> </DIV>
<DIV>It resets the geometry if cSectors > 63, VHD disk somehow has more than 63 sectors.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>    /* vmlite, fix converting error from VHD */<BR>    if (PCHSGeometryFrom.cHeads > 16 || PCHSGeometryFrom.cSectors > 63)<BR>    {<BR>     Assert(RT_MIN(cbSize / 512 / 16 / 63, 16383) -<BR>        (unsigned int)RT_MIN(cbSize / 512 / 16 / 63, 16383) == 0);  <BR>     PCHSGeometryFrom.cCylinders = (unsigned int)RT_MIN(cbSize / 512 / 16 / 63, 16383);<BR>     PCHSGeometryFrom.cHeads = 16;<BR>     PCHSGeometryFrom.cSectors = 63;<BR>    }<BR>    /* vmlite */</DIV>
<DIV>                rc = VDCreateBase(pDiskTo, pszBackend, pszFilename, cbSize,<BR>                                  uImageFlags, szComment,<BR>                                  &PCHSGeometryFrom, &LCHSGeometryFrom,<BR>                                  NULL, uOpenFlagsFrom & ~VD_OPEN_FLAGS_READONLY, NULL,
 NULL);<BR>                if (RT_SUCCESS(rc) && !RTUuidIsNull(&ImageUuid))<BR>                     pDiskTo->pLast->Backend->pfnSetUuid(pDiskTo->pLast->pvBackendData, &ImageUuid);<BR>                if (RT_SUCCESS(rc) && !RTUuidIsNull(&ParentUuid))<BR>                     pDiskTo->pLast->Backend->pfnSetParentUuid(pDiskTo->pLast->pvBackendData, &ParentUuid);</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>- Huihong</DIV></TD></TR></TBODY></TABLE></DIV><BR>-----Inline Attachment Follows-----<BR><BR>
<DIV class=plainMail>_______________________________________________<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>