[vbox-dev] A question about virtualbox sdk api

magicdmer at gmail.com magicdmer at gmail.com
Wed Oct 9 08:24:27 UTC 2013

    I'm new to Virtualbox Development. I have a few problems when i use virtualbox sdk.
IMedium* pIMedium = NULL;

rc = IMediumAttachmentVector[j]->get_Medium(&pIMedium);

if(SUCCEEDED(rc) && pIMedium)


        IMedium* BaseMedium = NULL;

        rc = pIMedium->get_Base(&BaseMedium);

        if(SUCCEEDED(rc) && BaseMedium)


                BSTR bstrName;


                LONG64 aLogicalSize = 0;

                if(Device.Type == DeviceType_HardDisk)


                        rc = pIMedium->get_LogicalSize(&aLogicalSize);       //here can't get the real size, always zero

                        rc = pIMedium->get_Size(&aLogicalSize);






The API "get_LogicalSize" can't get the real size ,it is always zero and return value is ok. but when i open virtualbox (virtualbox.exe) , the function Execute successfully and get the real size. Does it need some preconditions ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.virtualbox.org/pipermail/vbox-dev/attachments/20131009/143540b0/attachment.html 

More information about the vbox-dev mailing list