Changeset 53407 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Nov 28, 2014 9:30:29 AM (10 years ago)
- Location:
- trunk/src/VBox/Main/src-client
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r53066 r53407 423 423 , mBusMgr(NULL) 424 424 , mpIfSecKey(NULL) 425 , mpIfSecKeyHlp(NULL) 425 426 , mVMStateChangeCallbackDisabled(false) 426 427 , mfUseHostClipboard(true) … … 467 468 pIfSecKey->pConsole = this; 468 469 mpIfSecKey = pIfSecKey; 470 471 MYPDMISECKEYHLP *pIfSecKeyHlp = (MYPDMISECKEYHLP *)RTMemAllocZ(sizeof(*mpIfSecKeyHlp) + sizeof(Console *)); 472 if (!pIfSecKeyHlp) 473 return E_OUTOFMEMORY; 474 pIfSecKeyHlp->pfnKeyMissingNotify = Console::i_pdmIfSecKeyHlp_KeyMissingNotify; 475 pIfSecKeyHlp->pConsole = this; 476 mpIfSecKeyHlp = pIfSecKeyHlp; 469 477 470 478 return BaseFinalConstruct(); … … 701 709 RTMemFree((void *)mpIfSecKey); 702 710 mpIfSecKey = NULL; 711 } 712 713 if (mpIfSecKeyHlp) 714 { 715 RTMemFree((void *)mpIfSecKeyHlp); 716 mpIfSecKeyHlp = NULL; 703 717 } 704 718 … … 4457 4471 if (pIMedium) 4458 4472 { 4459 rc = pIMedium->pfnSetSecKeyIf(pIMedium, NULL );4473 rc = pIMedium->pfnSetSecKeyIf(pIMedium, NULL, mpIfSecKeyHlp); 4460 4474 Assert(RT_SUCCESS(rc) || rc == VERR_NOT_SUPPORTED); 4461 4475 } … … 4574 4588 else 4575 4589 { 4576 rc = pIMedium->pfnSetSecKeyIf(pIMedium, mpIfSecKey );4590 rc = pIMedium->pfnSetSecKeyIf(pIMedium, mpIfSecKey, mpIfSecKeyHlp); 4577 4591 if (RT_FAILURE(rc)) 4578 4592 return setError(E_FAIL, tr("Failed to set the encryption key (%Rrc)"), rc); … … 8224 8238 } 8225 8239 8240 case VMSTATE_POWERING_ON: 8241 { 8242 /* 8243 * We have to set the secret key helper interface for the VD drivers to 8244 * get notified about missing keys. 8245 */ 8246 that->i_clearDiskEncryptionKeysOnAllAttachments(); 8247 break; 8248 } 8249 8226 8250 default: /* shut up gcc */ 8227 8251 break; … … 8893 8917 LogRel(("Console: VM runtime error: fatal=%RTbool, errorID=%s message=\"%s\"\n", 8894 8918 fFatal, pszErrorId, message.c_str())); 8895 8896 /* Set guest property if the reason of the error is a missing DEK for a disk. */8897 if (!RTStrCmp(pszErrorId, "DrvVD_DEKMISSING"))8898 {8899 that->mMachine->DeleteGuestProperty(Bstr("/VirtualBox/HostInfo/DekMissing").raw());8900 that->mMachine->SetGuestProperty(Bstr("/VirtualBox/HostInfo/DekMissing").raw(),8901 Bstr("1").raw(), Bstr("RDONLYGUEST").raw());8902 that->mMachine->SaveSettings();8903 }8904 8905 8919 8906 8920 that->i_onRuntimeError(BOOL(fFatal), Bstr(pszErrorId).raw(), Bstr(message).raw()); … … 10258 10272 } 10259 10273 10274 /** 10275 * @interface_method_impl{PDMISECKEYHLP,pfnKeyMissingNotify} 10276 */ 10277 /*static*/ DECLCALLBACK(int) 10278 Console::i_pdmIfSecKeyHlp_KeyMissingNotify(PPDMISECKEYHLP pInterface) 10279 { 10280 Console *pConsole = ((MYPDMISECKEYHLP *)pInterface)->pConsole; 10281 10282 /* Set guest property only, the VM is paused in the media driver calling us. */ 10283 pConsole->mMachine->DeleteGuestProperty(Bstr("/VirtualBox/HostInfo/DekMissing").raw()); 10284 pConsole->mMachine->SetGuestProperty(Bstr("/VirtualBox/HostInfo/DekMissing").raw(), 10285 Bstr("1").raw(), Bstr("RDONLYGUEST").raw()); 10286 pConsole->mMachine->SaveSettings(); 10287 10288 return VINF_SUCCESS; 10289 } 10260 10290 10261 10291 -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r53330 r53407 3968 3968 AssertRCReturn(rc, rc); 3969 3969 3970 /* 3971 * Make the secret key helper interface known to the VD driver if it is attached, 3972 * so we can get notified about missing keys. 3973 */ 3974 PPDMIBASE pIBase = NULL; 3975 rc = PDMR3QueryDriverOnLun(pUVM, pcszDevice, uInstance, uLUN, "VD", &pIBase); 3976 if (RT_SUCCESS(rc) && pIBase) 3977 { 3978 PPDMIMEDIA pIMedium = (PPDMIMEDIA)pIBase->pfnQueryInterface(pIBase, PDMIMEDIA_IID); 3979 if (pIMedium) 3980 { 3981 rc = pIMedium->pfnSetSecKeyIf(pIMedium, NULL, mpIfSecKeyHlp); 3982 Assert(RT_SUCCESS(rc) || rc == VERR_NOT_SUPPORTED); 3983 } 3984 } 3985 3970 3986 /* There is no need to handle removable medium mounting, as we 3971 3987 * unconditionally replace everthing including the block driver level.
Note:
See TracChangeset
for help on using the changeset viewer.