Changeset 68828 in vbox for trunk/src/VBox/Main
- Timestamp:
- Sep 22, 2017 2:15:57 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 118082
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ExtPackManagerImpl.h
r63147 r68828 5 5 6 6 /* 7 * Copyright (C) 2010-201 6Oracle Corporation7 * Copyright (C) 2010-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 31 31 32 32 33 #if !defined(VBOX_COM_INPROC)33 #ifndef VBOX_COM_INPROC 34 34 /** 35 35 * An extension pack file. … … 87 87 friend class ExtPackInstallTask; 88 88 }; 89 #endif 89 #endif /* !VBOX_COM_INPROC */ 90 90 91 91 … … 110 110 /** @name Internal interfaces used by ExtPackManager. 111 111 * @{ */ 112 #ifndef VBOX_COM_INPROC 112 113 bool i_callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock, PRTERRINFO pErrInfo); 113 114 HRESULT i_callUninstallHookAndClose(IVirtualBox *a_pVirtualBox, bool a_fForcedRemoval); 114 115 bool i_callVirtualBoxReadyHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock); 116 #endif 117 #ifdef VBOX_COM_INPROC 115 118 bool i_callConsoleReadyHook(IConsole *a_pConsole, AutoWriteLock *a_pLock); 119 #endif 120 #ifndef VBOX_COM_INPROC 116 121 bool i_callVmCreatedHook(IVirtualBox *a_pVirtualBox, IMachine *a_pMachine, AutoWriteLock *a_pLock); 122 #endif 123 #ifdef VBOX_COM_INPROC 117 124 bool i_callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc); 118 125 bool i_callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc); 119 126 bool i_callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock); 127 #endif 120 128 HRESULT i_checkVrde(void); 121 129 HRESULT i_getVrdpLibraryName(Utf8Str *a_pstrVrdeLibrary); … … 197 205 /** @name Internal interfaces used by other Main classes. 198 206 * @{ */ 199 #if !defined(VBOX_COM_INPROC)207 #ifndef VBOX_COM_INPROC 200 208 HRESULT i_doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace, Utf8Str const *a_pstrDisplayInfo); 201 209 HRESULT i_doUninstall(const Utf8Str *a_pstrName, bool a_fForcedRemoval, const Utf8Str *a_pstrDisplayInfo); 202 #endif203 210 void i_callAllVirtualBoxReadyHooks(void); 211 #endif 212 #ifdef VBOX_COM_INPROC 204 213 void i_callAllConsoleReadyHooks(IConsole *a_pConsole); 214 #endif 215 #ifndef VBOX_COM_INPROC 205 216 void i_callAllVmCreatedHooks(IMachine *a_pMachine); 217 #endif 218 #ifdef VBOX_COM_INPROC 206 219 int i_callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM); 207 220 int i_callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM); 208 221 void i_callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM); 222 #endif 209 223 HRESULT i_checkVrdeExtPack(Utf8Str const *a_pstrExtPack); 210 224 int i_getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrVrdeLibrary); -
trunk/src/VBox/Main/include/ExtPackUtil.h
r62485 r68828 5 5 6 6 /* 7 * Copyright (C) 2010-201 6Oracle Corporation7 * Copyright (C) 2010-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 100 100 /** The name of the main module. */ 101 101 RTCString strMainModule; 102 /** The name of the main VM module, empty if none. */ 103 RTCString strMainVMModule; 102 104 /** The name of the VRDE module, empty if none. */ 103 105 RTCString strVrdeModule; -
trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
r66294 r68828 46 46 #include "Global.h" 47 47 #include "ProgressImpl.h" 48 #if defined(VBOX_COM_INPROC)48 #ifdef VBOX_COM_INPROC 49 49 # include "ConsoleImpl.h" 50 50 #else … … 85 85 }; 86 86 87 #if !defined(VBOX_COM_INPROC)87 #ifndef VBOX_COM_INPROC 88 88 /** 89 89 * Private extension pack data. … … 132 132 /** Pointer back to the extension pack object (for Hlp methods). */ 133 133 ExtPack *pThis; 134 /** The extension pack registration structure. */ 134 #ifndef VBOX_COM_INPROC 135 /** The extension pack main registration structure. */ 135 136 PCVBOXEXTPACKREG pReg; 137 #else 138 /** The extension pack main VM registration structure. */ 139 PCVBOXEXTPACKVMREG pReg; 140 #endif 136 141 /** The current context. */ 137 142 VBOXEXTPACKCTX enmContext; … … 157 162 /** The list of installed extension packs. */ 158 163 ExtPackList llInstalledExtPacks; 159 #if !defined(VBOX_COM_INPROC)164 #ifndef VBOX_COM_INPROC 160 165 /** Pointer to the VirtualBox object, our parent. */ 161 166 VirtualBox *pVirtualBox; … … 163 168 /** The current context. */ 164 169 VBOXEXTPACKCTX enmContext; 165 #if !defined(RT_OS_WINDOWS) && !defined(RT_OS_DARWIN)166 /** File handle for the VBoxVMM libary which we slurp because ExtPacks depend on it. */167 RTLDRMOD hVBoxVMM;168 #endif169 170 170 171 RTMEMEF_NEW_AND_DELETE_OPERATORS(); 171 172 }; 172 173 173 #if !defined(VBOX_COM_INPROC)174 #ifndef VBOX_COM_INPROC 174 175 175 176 /** … … 821 822 822 823 824 #ifndef VBOX_COM_INPROC 823 825 /** 824 826 * Calls the installed hook. … … 895 897 if ( m != NULL 896 898 && m->fUsable 899 && m->hMainMod != NIL_RTLDRMOD 897 900 && !m->fMadeReadyCall) 898 901 { … … 909 912 return false; 910 913 } 911 914 #endif /* !VBOX_COM_INPROC */ 915 916 #ifdef VBOX_COM_INPROC 912 917 /** 913 918 * Calls the pfnConsoleReady hook. … … 921 926 if ( m != NULL 922 927 && m->fUsable 928 && m->hMainMod != NIL_RTLDRMOD 923 929 && !m->fMadeReadyCall) 924 930 { … … 935 941 return false; 936 942 } 937 943 #endif /* VBOX_COM_INPROC */ 944 945 #ifndef VBOX_COM_INPROC 938 946 /** 939 947 * Calls the pfnVMCreate hook. … … 947 955 { 948 956 if ( m != NULL 957 && m->hMainMod != NIL_RTLDRMOD 949 958 && m->fUsable) 950 959 { … … 960 969 return false; 961 970 } 962 971 #endif /* !VBOX_COM_INPROC */ 972 973 #ifdef VBOX_COM_INPROC 963 974 /** 964 975 * Calls the pfnVMConfigureVMM hook. … … 976 987 *a_pvrc = VINF_SUCCESS; 977 988 if ( m != NULL 989 && m->hMainMod != NIL_RTLDRMOD 978 990 && m->fUsable) 979 991 { … … 1008 1020 *a_pvrc = VINF_SUCCESS; 1009 1021 if ( m != NULL 1022 && m->hMainMod != NIL_RTLDRMOD 1010 1023 && m->fUsable) 1011 1024 { … … 1036 1049 { 1037 1050 if ( m != NULL 1051 && m->hMainMod != NIL_RTLDRMOD 1038 1052 && m->fUsable) 1039 1053 { … … 1049 1063 return false; 1050 1064 } 1065 #endif /* !VBOX_COM_INPROC */ 1051 1066 1052 1067 /** … … 1285 1300 * Load the main DLL and call the predefined entry point. 1286 1301 */ 1302 #ifndef VBOX_COM_INPROC 1303 const char *pszMainModule = m->Desc.strMainModule.c_str(); 1304 #else 1305 const char *pszMainModule = m->Desc.strMainVMModule.c_str(); 1306 if (m->Desc.strMainVMModule.isEmpty()) 1307 { 1308 /* 1309 * We're good! The main module for VM processes is optional. 1310 */ 1311 m->fUsable = true; 1312 m->strWhyUnusable.setNull(); 1313 return; 1314 } 1315 #endif 1287 1316 bool fIsNative; 1288 if (!i_findModule( m->Desc.strMainModule.c_str(), NULL /* default extension */, VBOXEXTPACKMODKIND_R3,1317 if (!i_findModule(pszMainModule, NULL /* default extension */, VBOXEXTPACKMODKIND_R3, 1289 1318 &m->strMainModPath, &fIsNative, &m->ObjInfoMainMod)) 1290 1319 { 1291 m->strWhyUnusable.printf(tr("Failed to locate the main module ('%s')"), m->Desc.strMainModule.c_str());1320 m->strWhyUnusable.printf(tr("Failed to locate the main module ('%s')"), pszMainModule); 1292 1321 return; 1293 1322 } … … 1320 1349 * Resolve the predefined entry point. 1321 1350 */ 1351 #ifndef VBOX_COM_INPROC 1352 const char *pszMainEntryPoint = VBOX_EXTPACK_MAIN_MOD_ENTRY_POINT; 1322 1353 PFNVBOXEXTPACKREGISTER pfnRegistration; 1323 vrc = RTLdrGetSymbol(m->hMainMod, VBOX_EXTPACK_MAIN_MOD_ENTRY_POINT, (void **)&pfnRegistration); 1354 uint32_t uVersion = VBOXEXTPACKREG_VERSION; 1355 #else 1356 const char *pszMainEntryPoint = VBOX_EXTPACK_MAIN_VM_MOD_ENTRY_POINT; 1357 PFNVBOXEXTPACKVMREGISTER pfnRegistration; 1358 uint32_t uVersion = VBOXEXTPACKVMREG_VERSION; 1359 #endif 1360 vrc = RTLdrGetSymbol(m->hMainMod, pszMainEntryPoint, (void **)&pfnRegistration); 1324 1361 if (RT_SUCCESS(vrc)) 1325 1362 { … … 1330 1367 && VALID_PTR(m->pReg)) 1331 1368 { 1332 if ( VBOXEXTPACK_IS_MAJOR_VER_EQUAL(m->pReg->u32Version, VBOXEXTPACKREG_VERSION)1369 if ( VBOXEXTPACK_IS_MAJOR_VER_EQUAL(m->pReg->u32Version, uVersion) 1333 1370 && m->pReg->u32EndMarker == m->pReg->u32Version) 1334 1371 { 1372 #ifndef VBOX_COM_INPROC 1335 1373 if ( (!m->pReg->pfnInstalled || RT_VALID_PTR(m->pReg->pfnInstalled)) 1336 1374 && (!m->pReg->pfnUninstall || RT_VALID_PTR(m->pReg->pfnUninstall)) 1337 1375 && (!m->pReg->pfnVirtualBoxReady || RT_VALID_PTR(m->pReg->pfnVirtualBoxReady)) 1338 && (!m->pReg->pfnConsoleReady || RT_VALID_PTR(m->pReg->pfnConsoleReady))1339 1376 && (!m->pReg->pfnUnload || RT_VALID_PTR(m->pReg->pfnUnload)) 1340 1377 && (!m->pReg->pfnVMCreated || RT_VALID_PTR(m->pReg->pfnVMCreated)) 1378 && (!m->pReg->pfnQueryObject || RT_VALID_PTR(m->pReg->pfnQueryObject)) 1379 ) 1380 { 1381 /* 1382 * We're good! 1383 */ 1384 m->fUsable = true; 1385 m->strWhyUnusable.setNull(); 1386 return; 1387 } 1388 #else 1389 if ( (!m->pReg->pfnConsoleReady || RT_VALID_PTR(m->pReg->pfnConsoleReady)) 1390 && (!m->pReg->pfnUnload || RT_VALID_PTR(m->pReg->pfnUnload)) 1341 1391 && (!m->pReg->pfnVMConfigureVMM || RT_VALID_PTR(m->pReg->pfnVMConfigureVMM)) 1342 1392 && (!m->pReg->pfnVMPowerOn || RT_VALID_PTR(m->pReg->pfnVMPowerOn)) … … 1352 1402 return; 1353 1403 } 1354 1355 m->strWhyUnusable = tr("The registration structure contains on or more invalid function pointers"); 1404 #endif 1405 1406 m->strWhyUnusable = tr("The registration structure contains one or more invalid function pointers"); 1356 1407 } 1357 1408 else … … 1361 1412 else 1362 1413 m->strWhyUnusable.printf(tr("%s returned %Rrc, pReg=%p ErrInfo='%s'"), 1363 VBOX_EXTPACK_MAIN_MOD_ENTRY_POINT, vrc, m->pReg, ErrInfo.Core.pszMsg);1414 pszMainEntryPoint, vrc, m->pReg, ErrInfo.Core.pszMsg); 1364 1415 m->pReg = NULL; 1365 1416 } 1366 1417 else 1367 1418 m->strWhyUnusable.printf(tr("Failed to resolve exported symbol '%s' in the main module: %Rrc"), 1368 VBOX_EXTPACK_MAIN_MOD_ENTRY_POINT, vrc);1419 pszMainEntryPoint, vrc); 1369 1420 1370 1421 RTLdrClose(m->hMainMod); … … 1904 1955 #else 1905 1956 RT_NOREF_PV(a_pVirtualBox); 1906 #endif1907 1908 /*1909 * Slurp in VBoxVMM which is used by VBoxPuelMain.1910 */1911 #if !defined(RT_OS_WINDOWS) && !defined(RT_OS_DARWIN)1912 if (a_enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON)1913 {1914 int vrc = SUPR3HardenedLdrLoadAppPriv("VBoxVMM", &m->hVBoxVMM, RTLDRLOAD_FLAGS_GLOBAL, NULL);1915 if (RT_FAILURE(vrc))1916 m->hVBoxVMM = NIL_RTLDRMOD;1917 /* cleanup in ::uninit()? */1918 }1919 1957 #endif 1920 1958 … … 2043 2081 AssertReturn(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON, E_UNEXPECTED); 2044 2082 2045 #if !defined(VBOX_COM_INPROC)2083 #ifndef VBOX_COM_INPROC 2046 2084 /* The API can optionally take a ::SHA-256=<hex-digest> attribute at the 2047 2085 end of the file name. This is just a temporary measure for … … 2077 2115 Assert(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON); 2078 2116 2079 #if !defined(VBOX_COM_INPROC)2117 #ifndef VBOX_COM_INPROC 2080 2118 2081 2119 HRESULT hrc; … … 2436 2474 } 2437 2475 2438 #if !defined(VBOX_COM_INPROC)2476 #ifndef VBOX_COM_INPROC 2439 2477 2440 2478 /** … … 2859 2897 #endif /* !VBOX_COM_INPROC */ 2860 2898 2899 #ifdef VBOX_COM_INPROC 2861 2900 /** 2862 2901 * Calls the pfnConsoleReady hook for all working extension packs. … … 2884 2923 } 2885 2924 } 2886 2887 #if !defined(VBOX_COM_INPROC) 2925 #endif 2926 2927 #ifndef VBOX_COM_INPROC 2888 2928 /** 2889 2929 * Calls the pfnVMCreated hook for all working extension packs. … … 2906 2946 #endif 2907 2947 2948 #ifdef VBOX_COM_INPROC 2908 2949 /** 2909 2950 * Calls the pfnVMConfigureVMM hook for all working extension packs. … … 2983 3024 (*it)->i_callVmPowerOffHook(a_pConsole, a_pVM, &autoLock); 2984 3025 } 3026 #endif 2985 3027 2986 3028 -
trunk/src/VBox/Main/src-all/ExtPackUtil.cpp
r65088 r68828 5 5 6 6 /* 7 * Copyright (C) 2010-201 6Oracle Corporation7 * Copyright (C) 2010-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 74 74 a_pExtPackDesc->uRevision = 0; 75 75 a_pExtPackDesc->strMainModule.setNull(); 76 a_pExtPackDesc->strMainVMModule.setNull(); 76 77 a_pExtPackDesc->strVrdeModule.setNull(); 77 78 a_pExtPackDesc->cPlugIns = 0; … … 164 165 165 166 /* 167 * The main VM module, optional. 168 * Accept both none and empty as tokens of no main VM module. 169 */ 170 const char *pszMainVMModule = NULL; 171 const xml::ElementNode *pMainVMModuleElm = pVBoxExtPackElm->findChildElement("MainVMModule"); 172 if (pMainVMModuleElm) 173 { 174 pszMainVMModule = pMainVMModuleElm->getValue(); 175 if (!pszMainVMModule || *pszMainVMModule == '\0') 176 pszMainVMModule = NULL; 177 else if (!VBoxExtPackIsValidModuleString(pszMainVMModule)) 178 return &(new RTCString("Invalid main VM module string: "))->append(pszMainVMModule); 179 } 180 181 /* 166 182 * The VRDE module, optional. 167 183 * Accept both none and empty as tokens of no VRDE module. … … 205 221 a_pExtPackDesc->uRevision = uRevision; 206 222 a_pExtPackDesc->strMainModule = pszMainModule; 223 a_pExtPackDesc->strMainVMModule = pszMainVMModule; 207 224 a_pExtPackDesc->strVrdeModule = pszVrdeModule; 208 225 a_pExtPackDesc->cPlugIns = cPlugIns; … … 362 379 a_pExtPackDesc->uRevision = 0; 363 380 a_pExtPackDesc->strMainModule.setNull(); 381 a_pExtPackDesc->strMainVMModule.setNull(); 364 382 a_pExtPackDesc->strVrdeModule.setNull(); 365 383 a_pExtPackDesc->cPlugIns = 0; -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r68804 r68828 825 825 // we don't perform uninit() as it's possible that some pending event refers to this source 826 826 unconst(mEventSource).setNull(); 827 828 #ifdef VBOX_WITH_EXTPACK 829 unconst(mptrExtPackManager).setNull(); 830 #endif 827 831 828 832 LogFlowThisFuncLeave();
Note:
See TracChangeset
for help on using the changeset viewer.