Changeset 73825 in vbox for trunk/src/VBox/Main/src-all
- Timestamp:
- Aug 22, 2018 12:51:23 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 124516
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
r73716 r73825 143 143 /** Set if we've made the pfnVirtualBoxReady or pfnConsoleReady call. */ 144 144 bool fMadeReadyCall; 145 #ifndef VBOX_COM_INPROC 146 /** Pointer to the VirtualBox object so we can create a progress object. */ 147 VirtualBox *pVirtualBox; 148 #endif 145 149 146 150 RTMEMEF_NEW_AND_DELETE_OPERATORS(); … … 720 724 * 721 725 * @returns COM status code. 726 * @param a_pVirtualBox The VirtualBox object. 722 727 * @param a_enmContext The context we're in. 723 728 * @param a_pszName The name of the extension pack. This is also the … … 726 731 * @param a_pszDir The extension pack directory name. 727 732 */ 728 HRESULT ExtPack::initWithDir(V BOXEXTPACKCTX a_enmContext, const char *a_pszName, const char *a_pszDir)733 HRESULT ExtPack::initWithDir(VirtualBox *a_pVirtualBox, VBOXEXTPACKCTX a_enmContext, const char *a_pszName, const char *a_pszDir) 729 734 { 730 735 AutoInitSpan autoInitSpan(this); … … 744 749 /* pfnLoadVDPlugin = */ ExtPack::i_hlpLoadVDPlugin, 745 750 /* pfnUnloadVDPlugin = */ ExtPack::i_hlpUnloadVDPlugin, 751 /* pfnCreateProgress = */ ExtPack::i_hlpCreateProgress, 752 /* pfnGetCanceledProgress = */ ExtPack::i_hlpGetCanceledProgress, 753 /* pfnUpdateProgress = */ ExtPack::i_hlpUpdateProgress, 754 /* pfnNextOperationProgress = */ ExtPack::i_hlpNextOperationProgress, 755 /* pfnCompleteProgress = */ ExtPack::i_hlpCompleteProgress, 746 756 /* pfnReserved1 = */ ExtPack::i_hlpReservedN, 747 757 /* pfnReserved2 = */ ExtPack::i_hlpReservedN, … … 774 784 m->enmContext = a_enmContext; 775 785 m->fMadeReadyCall = false; 786 #ifndef VBOX_COM_INPROC 787 m->pVirtualBox = a_pVirtualBox; 788 #else 789 RT_NOREF(a_pVirtualBox); 790 #endif 776 791 777 792 /* … … 1723 1738 } 1724 1739 1740 /*static*/ DECLCALLBACK(uint32_t) 1741 ExtPack::i_hlpCreateProgress(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IUnknown) *pInitiator, 1742 const char *pcszDescription, uint32_t cOperations, 1743 uint32_t uTotalOperationsWeight, const char *pcszFirstOperationDescription, 1744 uint32_t uFirstOperationWeight, VBOXEXTPACK_IF_CS(IProgress) **ppProgressOut) 1745 { 1746 /* 1747 * Validate the input and get our bearings. 1748 */ 1749 AssertPtrReturn(pcszDescription, E_INVALIDARG); 1750 AssertReturn(cOperations >= 1, E_INVALIDARG); 1751 AssertReturn(uTotalOperationsWeight >= 1, E_INVALIDARG); 1752 AssertPtrReturn(pcszFirstOperationDescription, E_INVALIDARG); 1753 AssertReturn(uFirstOperationWeight >= 1, E_INVALIDARG); 1754 AssertPtrReturn(ppProgressOut, E_INVALIDARG); 1755 1756 AssertPtrReturn(pHlp, VERR_INVALID_POINTER); 1757 AssertReturn(pHlp->u32Version == VBOXEXTPACKHLP_VERSION, VERR_INVALID_POINTER); 1758 #ifndef VBOX_COM_INPROC 1759 ExtPack::Data *m = RT_FROM_CPP_MEMBER(pHlp, Data, Hlp); 1760 #endif 1761 1762 ComObjPtr<Progress> pProgress; 1763 HRESULT hrc = pProgress.createObject(); 1764 if (FAILED(hrc)) 1765 return hrc; 1766 hrc = pProgress->init( 1767 #ifndef VBOX_COM_INPROC 1768 m->pVirtualBox, 1769 #endif 1770 pInitiator, pcszDescription, TRUE /* aCancelable */, 1771 cOperations, uTotalOperationsWeight, 1772 pcszFirstOperationDescription, uFirstOperationWeight); 1773 if (FAILED(hrc)) 1774 return hrc; 1775 1776 return pProgress.queryInterfaceTo(ppProgressOut); 1777 } 1778 1779 /*static*/ DECLCALLBACK(uint32_t) 1780 ExtPack::i_hlpGetCanceledProgress(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IProgress) *pProgress, 1781 bool *pfCanceled) 1782 { 1783 /* 1784 * Validate the input and get our bearings. 1785 */ 1786 AssertPtrReturn(pProgress, E_INVALIDARG); 1787 AssertPtrReturn(pfCanceled, E_INVALIDARG); 1788 1789 AssertPtrReturn(pHlp, VERR_INVALID_POINTER); 1790 AssertReturn(pHlp->u32Version == VBOXEXTPACKHLP_VERSION, VERR_INVALID_POINTER); 1791 1792 BOOL fCanceled = FALSE; 1793 HRESULT hrc = pProgress->GetCanceled(&fCanceled); 1794 *pfCanceled = !!fCanceled; 1795 return hrc; 1796 } 1797 1798 /*static*/ DECLCALLBACK(uint32_t) 1799 ExtPack::i_hlpUpdateProgress(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IProgress) *pProgress, 1800 uint32_t uPercent) 1801 { 1802 /* 1803 * Validate the input and get our bearings. 1804 */ 1805 AssertPtrReturn(pProgress, E_INVALIDARG); 1806 AssertReturn(uPercent <= 100, E_INVALIDARG); 1807 1808 AssertPtrReturn(pHlp, VERR_INVALID_POINTER); 1809 AssertReturn(pHlp->u32Version == VBOXEXTPACKHLP_VERSION, VERR_INVALID_POINTER); 1810 1811 return pProgress->SetCurrentOperationProgress(uPercent); 1812 } 1813 1814 /*static*/ DECLCALLBACK(uint32_t) 1815 ExtPack::i_hlpNextOperationProgress(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IProgress) *pProgress, 1816 const char *pcszNextOperationDescription, 1817 uint32_t uNextOperationWeight) 1818 { 1819 /* 1820 * Validate the input and get our bearings. 1821 */ 1822 AssertPtrReturn(pProgress, E_INVALIDARG); 1823 AssertPtrReturn(pcszNextOperationDescription, E_INVALIDARG); 1824 AssertReturn(uNextOperationWeight >= 1, E_INVALIDARG); 1825 1826 AssertPtrReturn(pHlp, VERR_INVALID_POINTER); 1827 AssertReturn(pHlp->u32Version == VBOXEXTPACKHLP_VERSION, VERR_INVALID_POINTER); 1828 1829 return pProgress->SetNextOperation(Bstr(pcszNextOperationDescription).raw(), uNextOperationWeight); 1830 } 1831 1832 /*static*/ DECLCALLBACK(uint32_t) 1833 ExtPack::i_hlpCompleteProgress(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IProgress) *pProgress, 1834 uint32_t uResultCode) 1835 { 1836 /* 1837 * Validate the input and get our bearings. 1838 */ 1839 AssertPtrReturn(pProgress, E_INVALIDARG); 1840 1841 AssertPtrReturn(pHlp, VERR_INVALID_POINTER); 1842 AssertReturn(pHlp->u32Version == VBOXEXTPACKHLP_VERSION, VERR_INVALID_POINTER); 1843 1844 Progress *pProgressInt = static_cast<Progress *>(pProgress); 1845 return pProgressInt->i_notifyComplete(uResultCode); 1846 } 1847 1725 1848 /*static*/ DECLCALLBACK(int) 1726 1849 ExtPack::i_hlpReservedN(PCVBOXEXTPACKHLP pHlp) … … 2005 2128 HRESULT hrc2 = NewExtPack.createObject(); 2006 2129 if (SUCCEEDED(hrc2)) 2007 hrc2 = NewExtPack->initWithDir(a_ enmContext, pstrName->c_str(), szExtPackDir);2130 hrc2 = NewExtPack->initWithDir(a_pVirtualBox, a_enmContext, pstrName->c_str(), szExtPackDir); 2008 2131 delete pstrName; 2009 2132 if (SUCCEEDED(hrc2)) … … 2590 2713 hrc = ptrNewExtPack.createObject(); 2591 2714 if (SUCCEEDED(hrc)) 2592 hrc = ptrNewExtPack->initWithDir(m-> enmContext, a_pszName, szDir);2715 hrc = ptrNewExtPack->initWithDir(m->pVirtualBox, m->enmContext, a_pszName, szDir); 2593 2716 if (SUCCEEDED(hrc)) 2594 2717 {
Note:
See TracChangeset
for help on using the changeset viewer.