vbox: Make IMediumAttachment work with vbox2.2 and 3.0

The GetMedium will always return a IHardDisk object them.
In 2.2 and 3.0, it is what GetHardDisk exactly do. In 3.1 and later,
The IMedium is same as IHardDisk.
This commit is contained in:
Taowei Luo 2014-10-24 09:46:47 +08:00 committed by Michal Privoznik
parent 0cd409cdb3
commit 3d33e38877
2 changed files with 5 additions and 6 deletions

View File

@ -4680,14 +4680,13 @@ _mediumCreateDiffStorage(IMedium *medium ATTRIBUTE_UNUSED,
}
static nsresult
_mediumAttachmentGetMedium(IMediumAttachment *mediumAttachment ATTRIBUTE_UNUSED,
IMedium **medium ATTRIBUTE_UNUSED)
_mediumAttachmentGetMedium(IMediumAttachment *mediumAttachment,
IHardDisk **hardDisk)
{
#if VBOX_API_VERSION < 3001000
vboxUnsupported();
return 0;
return mediumAttachment->vtbl->GetHardDisk(mediumAttachment, hardDisk);
#else /* VBOX_API_VERSION >= 3001000 */
return mediumAttachment->vtbl->GetMedium(mediumAttachment, medium);
return mediumAttachment->vtbl->GetMedium(mediumAttachment, hardDisk);
#endif /* VBOX_API_VERSION >= 3001000 */
}

View File

@ -426,7 +426,7 @@ typedef struct {
/* Functions for IMediumAttachment */
typedef struct {
nsresult (*GetMedium)(IMediumAttachment *mediumAttachment, IMedium **medium);
nsresult (*GetMedium)(IMediumAttachment *mediumAttachment, IHardDisk **hardDisk);
nsresult (*GetController)(IMediumAttachment *mediumAttachment, PRUnichar **controller);
nsresult (*GetType)(IMediumAttachment *mediumAttachment, PRUint32 *type);
nsresult (*GetPort)(IMediumAttachment *mediumAttachment, PRInt32 *port);