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.
---
src/vbox/vbox_tmpl.c | 9 ++++-----
src/vbox/vbox_uniformed_api.h | 2 +-
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 7c14c0d..8aed0d6 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -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 */
}
diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h
index d0403ad..337ae9c 100644
--- a/src/vbox/vbox_uniformed_api.h
+++ b/src/vbox/vbox_uniformed_api.h
@@ -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);
--
1.7.9.5