Changeset 34794 in vbox for trunk/src/VBox
- Timestamp:
- Dec 7, 2010 3:28:17 PM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r34587 r34794 438 438 #ifdef VBOX_WITH_EXTPACK 439 439 unconst(mptrExtPackManager).createObject(); 440 rc = mptrExtPackManager->init (NULL, NULL, false, VBOXEXTPACKCTX_VM_PROCESS); /* Drop zone handling is VBoxSVC only. */440 rc = mptrExtPackManager->initExtPackManager(NULL, VBOXEXTPACKCTX_VM_PROCESS); 441 441 AssertComRCReturnRC(rc); 442 442 #endif -
trunk/src/VBox/Main/ExtPackManagerImpl.cpp
r34787 r34794 137 137 /** The directory where the extension packs are installed. */ 138 138 Utf8Str strBaseDir; 139 /** The directory where the extension packs can be dropped for automatic140 * installation. */141 Utf8Str strDropZoneDir;142 139 /** The directory where the certificates this installation recognizes are 143 140 * stored. */ … … 1452 1449 * @returns COM status code. 1453 1450 * @param a_pVirtualBox Pointer to the VirtualBox object. 1454 * @param a_pszDropZoneDir The path to the drop zone directory.1455 * @param a_fCheckDropZone Whether to check the drop zone for new1456 * extensions or not. Only VBoxSVC does this1457 * and then only when wanted.1458 1451 * @param a_enmContext The context we're in. 1459 1452 */ 1460 HRESULT ExtPackManager::init(VirtualBox *a_pVirtualBox, const char *a_pszDropZoneDir, bool a_fCheckDropZone, 1461 VBOXEXTPACKCTX a_enmContext) 1453 HRESULT ExtPackManager::initExtPackManager(VirtualBox *a_pVirtualBox, VBOXEXTPACKCTX a_enmContext) 1462 1454 { 1463 1455 AutoInitSpan autoInitSpan(this); … … 1485 1477 m->strBaseDir = szBaseDir; 1486 1478 m->strCertificatDirPath = szCertificatDir; 1487 m->strDropZoneDir = a_pszDropZoneDir;1488 1479 m->pVirtualBox = a_pVirtualBox; 1489 1480 m->enmContext = a_enmContext; … … 1548 1539 } 1549 1540 /* else: ignore, the directory probably does not exist or something. */ 1550 1551 #if 01552 /*1553 * Look for things in the drop zone.1554 */1555 if (SUCCEEDED(hrc) && a_fCheckDropZone)1556 processDropZone();1557 #else1558 NOREF(a_fCheckDropZone);1559 #endif1560 1541 1561 1542 if (SUCCEEDED(hrc)) … … 2216 2197 } 2217 2198 2218 #if 02219 /**2220 * Processes anything new in the drop zone.2221 */2222 void ExtPackManager::processDropZone(void)2223 {2224 AutoCaller autoCaller(this);2225 HRESULT hrc = autoCaller.rc();2226 if (FAILED(hrc))2227 return;2228 AutoWriteLock autoLock(this COMMA_LOCKVAL_SRC_POS);2229 2230 if (m->strDropZoneDir.isEmpty())2231 return;2232 2233 PRTDIR pDir;2234 int vrc = RTDirOpen(&pDir, m->strDropZoneDir.c_str());2235 if (RT_FAILURE(vrc))2236 return;2237 for (;;)2238 {2239 RTDIRENTRYEX Entry;2240 vrc = RTDirReadEx(pDir, &Entry, NULL /*pcbDirEntry*/, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK);2241 if (RT_FAILURE(vrc))2242 {2243 AssertMsg(vrc == VERR_NO_MORE_FILES, ("%Rrc\n", vrc));2244 break;2245 }2246 2247 /*2248 * We're looking for files with the right extension. Symbolic links2249 * will be ignored.2250 */2251 if ( RTFS_IS_FILE(Entry.Info.Attr.fMode)2252 && RTStrICmp(RTPathExt(Entry.szName), VBOX_EXTPACK_SUFFIX) == 0)2253 {2254 /* We create (and check for) a blocker file to prevent this2255 extension pack from being installed more than once. */2256 char szPath[RTPATH_MAX];2257 vrc = RTPathJoin(szPath, sizeof(szPath), m->strDropZoneDir.c_str(), Entry.szName);2258 if (RT_SUCCESS(vrc))2259 vrc = RTPathAppend(szPath, sizeof(szPath), "-done");2260 AssertRC(vrc);2261 if (RT_SUCCESS(vrc))2262 {2263 RTFILE hFile;2264 vrc = RTFileOpen(&hFile, szPath, RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE);2265 if (RT_SUCCESS(vrc))2266 {2267 /* Construct the full path to the extension pack and invoke2268 the Install method to install it. Write errors to the2269 done file. */2270 vrc = RTPathJoin(szPath, sizeof(szPath), m->strDropZoneDir.c_str(), Entry.szName); AssertRC(vrc);2271 Bstr strName;2272 hrc = Install(Bstr(szPath).raw(), strName.asOutParam());2273 if (SUCCEEDED(hrc))2274 RTFileWrite(hFile, "succeeded\n", sizeof("succeeded\n"), NULL);2275 else2276 {2277 Utf8Str strErr;2278 com::ErrorInfo Info;2279 if (Info.isFullAvailable())2280 strErr.printf("failed\n"2281 "%ls\n"2282 "Details: code %Rhrc (%#RX32), component %ls, interface %ls, callee %ls\n"2283 ,2284 Info.getText().raw(),2285 Info.getResultCode(),2286 Info.getResultCode(),2287 Info.getComponent().raw(),2288 Info.getInterfaceName().raw(),2289 Info.getCalleeName().raw());2290 else2291 strErr.printf("failed\n"2292 "hrc=%Rhrc (%#RX32)\n", hrc, hrc);2293 RTFileWrite(hFile, strErr.c_str(), strErr.length(), NULL);2294 }2295 RTFileClose(hFile);2296 }2297 }2298 }2299 } /* foreach dir entry */2300 RTDirClose(pDir);2301 }2302 #endif2303 2304 2199 2305 2200 /** -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r34634 r34794 505 505 if (SUCCEEDED(rc)) 506 506 /** @todo Define drop zone location. */ 507 rc = m->ptrExtPackManager->init(this, NULL /*a_pszDropZoneDir*/, false /*a_fCheckDropZone*/, 508 VBOXEXTPACKCTX_PER_USER_DAEMON); 507 rc = m->ptrExtPackManager->initExtPackManager(this, VBOXEXTPACKCTX_PER_USER_DAEMON); 509 508 if (FAILED(rc)) 510 509 throw rc; -
trunk/src/VBox/Main/include/ExtPackManagerImpl.h
r34787 r34794 193 193 HRESULT FinalConstruct(); 194 194 void FinalRelease(); 195 HRESULT init(VirtualBox *a_pVirtualBox, const char *a_pszDropZonePath, bool a_fCheckDropZone, 196 VBOXEXTPACKCTX a_enmContext); 195 HRESULT initExtPackManager(VirtualBox *a_pVirtualBox, VBOXEXTPACKCTX a_enmContext); 197 196 void uninit(); 198 197 RTMEMEF_NEW_AND_DELETE_OPERATORS(); … … 212 211 * @{ */ 213 212 HRESULT doInstall(ExtPackFile *a_pExtPackFile); 214 /*void processDropZone(void);*/215 213 void callAllVirtualBoxReadyHooks(void); 216 214 void callAllConsoleReadyHooks(IConsole *a_pConsole);
Note:
See TracChangeset
for help on using the changeset viewer.