Changeset 35184 in vbox
- Timestamp:
- Dec 16, 2010 2:00:55 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
include/VBox/ExtPack/ExtPack.h (modified) (4 diffs)
-
include/VBox/err.h (modified) (3 diffs)
-
src/VBox/Main/ExtPackManagerImpl.cpp (modified) (7 diffs)
-
src/VBox/Main/include/ExtPackManagerImpl.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/ExtPack/ExtPack.h
r34287 r35184 185 185 * This is called in the context of the per-user service (VBoxSVC). 186 186 * 187 * @returns VBox status code. 188 * @retval VERR_EXTPACK_UNSUPPORTED_HOST_UNINSTALL if the extension pack 189 * requires some different host version or a prerequisite is 190 * missing from the host. Automatic uninstall will be attempted. 191 * Must set error info. 192 * 187 193 * @param pThis Pointer to this structure. 188 194 * @param pVirtualBox The VirtualBox interface. 189 */ 190 DECLCALLBACKMEMBER(void, pfnInstalled)(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox); 195 * @param pErrInfo Where to return extended error information. 196 */ 197 DECLCALLBACKMEMBER(int, pfnInstalled)(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, 198 PRTERRINFO pErrInfo); 191 199 192 200 /** … … 198 206 * @param pThis Pointer to this structure. 199 207 * @param pVirtualBox The VirtualBox interface. 208 * 200 209 * @todo This is currently called holding locks making pVirtualBox 201 210 * relatively unusable. … … 319 328 * be valid and unchanged until the module is unloaded 320 329 * (i.e. use some static const data for it). 321 * @param pszErr Error message buffer for explaining any failure. 322 * @param cbErr The size of the error message buffer. 323 */ 324 typedef DECLCALLBACK(int) FNVBOXEXTPACKREGISTER(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, char *pszErr, size_t cbErr); 330 * @param pErrInfo Where to return extended error information. 331 */ 332 typedef DECLCALLBACK(int) FNVBOXEXTPACKREGISTER(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, PRTERRINFO pErrInfo); 325 333 /** Pointer to a FNVBOXEXTPACKREGISTER. */ 326 334 typedef FNVBOXEXTPACKREGISTER *PFNVBOXEXTPACKREGISTER; … … 339 347 #define VBOXEXTPACK_IS_VER_COMPAT(u32Provider, u32User) \ 340 348 ( VBOXEXTPACK_IS_MAJOR_VER_EQUAL(u32Provider, u32User) \ 341 && RT_LOWORD(u32Provider) >= RT_LOWORD(u32User) )349 && (int32_t)RT_LOWORD(u32Provider) >= (int32_t)RT_LOWORD(u32User) ) /* stupid casts to shut up gcc */ 342 350 343 351 /** -
trunk/include/VBox/err.h
r33806 r35184 1611 1611 * @{ 1612 1612 */ 1613 /** CPU hotplug events from VMMDev are not monitored by the guest */1613 /** CPU hotplug events from VMMDev are not monitored by the guest. */ 1614 1614 #define VERR_CPU_HOTPLUG_NOT_MONITORED_BY_GUEST (-4700) 1615 1615 /** @} */ … … 1625 1625 * @{ 1626 1626 */ 1627 /** LUN type is not supported */1627 /** LUN type is not supported. */ 1628 1628 #define VERR_VSCSI_LUN_TYPE_NOT_SUPPORTED (-4900) 1629 /** LUN is already/still attached to a device */1629 /** LUN is already/still attached to a device. */ 1630 1630 #define VERR_VSCSI_LUN_ATTACHED_TO_DEVICE (-4901) 1631 /** The specified LUN is invalid */1631 /** The specified LUN is invalid. */ 1632 1632 #define VERR_VSCSI_LUN_INVALID (-4902) 1633 /** The LUN is not attached to the device */1633 /** The LUN is not attached to the device. */ 1634 1634 #define VERR_VSCSI_LUN_NOT_ATTACHED (-4903) 1635 1635 /** The LUN is still busy. */ … … 1637 1637 /** @} */ 1638 1638 1639 /** @name VBox FAM error codes1640 * @{ 1641 */ 1642 /** FAM failed to open a connection */1639 /** @name VBox FAM Status Codes 1640 * @{ 1641 */ 1642 /** FAM failed to open a connection. */ 1643 1643 #define VERR_FAM_OPEN_FAILED (-5000) 1644 /** FAM failed to add a file to the list to be monitored */1644 /** FAM failed to add a file to the list to be monitored. */ 1645 1645 #define VERR_FAM_MONITOR_FILE_FAILED (-5001) 1646 /** FAM failed to add a directory to the list to be monitored */1646 /** FAM failed to add a directory to the list to be monitored. */ 1647 1647 #define VERR_FAM_MONITOR_DIRECTORY_FAILED (-5002) 1648 /** The connection to the FAM daemon was lost */1648 /** The connection to the FAM daemon was lost. */ 1649 1649 #define VERR_FAM_CONNECTION_LOST (-5003) 1650 1650 /** @} */ 1651 1651 1652 /** @name VBox Extension Pack Status Codes 1653 * @{ 1654 */ 1655 /** The host is not supported. Uninstall the extension pack. 1656 * Returned by the VBOXEXTPACKREG::pfnInstalled. */ 1657 #define VERR_EXTPACK_UNSUPPORTED_HOST_UNINSTALL (-5000) 1658 /** @} */ 1659 1652 1660 /* SED-END */ 1653 1661 -
trunk/src/VBox/Main/ExtPackManagerImpl.cpp
r35152 r35184 38 38 #include <VBox/com/array.h> 39 39 #include <VBox/com/ErrorInfo.h> 40 #include <VBox/err.h> 40 41 #include <VBox/log.h> 41 42 #include <VBox/sup.h> … … 726 727 * @param a_pVirtualBox The VirtualBox interface. 727 728 * @param a_pLock The write lock held by the caller. 728 */ 729 bool ExtPack::callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock) 729 * @param pErrInfo Where to return error information. 730 */ 731 bool ExtPack::callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock, PRTERRINFO pErrInfo) 730 732 { 731 733 if ( m != NULL … … 736 738 ComPtr<ExtPack> ptrSelfRef = this; 737 739 a_pLock->release(); 738 m->pReg->pfnInstalled(m->pReg, a_pVirtualBox);740 pErrInfo->rc = m->pReg->pfnInstalled(m->pReg, a_pVirtualBox, pErrInfo); 739 741 a_pLock->acquire(); 740 742 return true; 741 743 } 742 744 } 745 pErrInfo->rc = VINF_SUCCESS; 743 746 return false; 744 747 } … … 1172 1175 } 1173 1176 1177 RTERRINFOSTATIC ErrInfo; 1178 RTErrInfoInitStatic(&ErrInfo); 1174 1179 if (fIsNative) 1175 1180 { 1176 char szError[8192]; 1177 vrc = RTLdrLoadEx(m->strMainModPath.c_str(), &m->hMainMod, 0 /*=fFlags*/, szError, sizeof(szError)); 1181 vrc = RTLdrLoadEx(m->strMainModPath.c_str(), &m->hMainMod, 0 /*fFlags*/, &ErrInfo.Core); 1178 1182 if (RT_FAILURE(vrc)) 1179 1183 { 1180 1184 m->hMainMod = NIL_RTLDRMOD; 1181 1185 m->strWhyUnusable.printf(tr("Failed to locate load the main module ('%s'): %Rrc - %s"), 1182 m->strMainModPath.c_str(), vrc, szError);1186 m->strMainModPath.c_str(), vrc, ErrInfo.Core.pszMsg); 1183 1187 return; 1184 1188 } … … 1197 1201 if (RT_SUCCESS(vrc)) 1198 1202 { 1199 RT _ZERO(szErr);1200 vrc = pfnRegistration(&m->Hlp, &m->pReg, szErr, sizeof(szErr) - 16);1203 RTErrInfoClear(&ErrInfo.Core); 1204 vrc = pfnRegistration(&m->Hlp, &m->pReg, &ErrInfo.Core); 1201 1205 if ( RT_SUCCESS(vrc) 1202 && szErr[0] == '\0'1206 && !RTErrInfoIsSet(&ErrInfo.Core) 1203 1207 && VALID_PTR(m->pReg)) 1204 1208 { … … 1233 1237 } 1234 1238 else 1235 { 1236 szErr[sizeof(szErr) - 1] = '\0'; 1237 m->strWhyUnusable.printf(tr("%s returned %Rrc, pReg=%p szErr='%s'"), 1238 VBOX_EXTPACK_MAIN_MOD_ENTRY_POINT, vrc, m->pReg, szErr); 1239 } 1239 m->strWhyUnusable.printf(tr("%s returned %Rrc, pReg=%p ErrInfo='%s'"), 1240 VBOX_EXTPACK_MAIN_MOD_ENTRY_POINT, vrc, m->pReg, ErrInfo.Core.pszMsg); 1240 1241 m->pReg = NULL; 1241 1242 } … … 2488 2489 if (SUCCEEDED(hrc)) 2489 2490 { 2490 LogRel(("ExtPackManager: Successfully installed extension pack '%s'.\n", pStrName->c_str())); 2491 pExtPack->callInstalledHook(m->pVirtualBox, &autoLock); 2491 RTERRINFOSTATIC ErrInfo; 2492 RTErrInfoInitStatic(&ErrInfo); 2493 pExtPack->callInstalledHook(m->pVirtualBox, &autoLock, &ErrInfo.Core); 2494 if (RT_SUCCESS(ErrInfo.Core.rc)) 2495 LogRel(("ExtPackManager: Successfully installed extension pack '%s'.\n", pStrName->c_str())); 2496 else 2497 { 2498 LogRel(("ExtPackManager: Installated hook for '%s' failed: %Rrc - %s\n", 2499 pStrName->c_str(), ErrInfo.Core.rc, ErrInfo.Core.pszMsg)); 2500 2501 /* 2502 * Uninstall the extpack if the error indicates that. 2503 */ 2504 if (ErrInfo.Core.rc == VERR_EXTPACK_UNSUPPORTED_HOST_UNINSTALL) 2505 runSetUidToRootHelper("uninstall", 2506 "--base-dir", m->strBaseDir.c_str(), 2507 "--name", pStrName->c_str(), 2508 "--forced", 2509 (const char *)NULL); 2510 hrc = setError(E_FAIL, tr("The installation hook failed: %Rrc - %s"), 2511 ErrInfo.Core.rc, ErrInfo.Core.pszMsg); 2512 } 2492 2513 } 2493 2514 } -
trunk/src/VBox/Main/include/ExtPackManagerImpl.h
r35100 r35184 139 139 /** @name Internal interfaces used by ExtPackManager. 140 140 * @{ */ 141 bool callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock );141 bool callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock, PRTERRINFO pErrInfo); 142 142 HRESULT callUninstallHookAndClose(IVirtualBox *a_pVirtualBox, bool a_fForcedRemoval); 143 143 bool callVirtualBoxReadyHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock);
Note:
See TracChangeset
for help on using the changeset viewer.

