Changeset 26753 in vbox for trunk/src/VBox/Main/ConsoleImpl.cpp
- Timestamp:
- Feb 24, 2010 4:24:33 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r26615 r26753 574 574 { 575 575 if (!enabledGuestPropertiesVRDP()) 576 {577 576 return; 578 } 577 578 Bstr bstrReadOnlyGuest(L"RDONLYGUEST"); 579 579 580 580 int rc; … … 584 584 if (RT_SUCCESS(rc)) 585 585 { 586 mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), Bstr("RDONLYGUEST"));586 mMachine->SetGuestProperty(Bstr(pszPropertyName), NULL, bstrReadOnlyGuest); 587 587 RTStrFree(pszPropertyName); 588 588 } … … 591 591 if (RT_SUCCESS(rc)) 592 592 { 593 mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), Bstr("RDONLYGUEST"));593 mMachine->SetGuestProperty(Bstr(pszPropertyName), NULL, bstrReadOnlyGuest); 594 594 RTStrFree(pszPropertyName); 595 595 } … … 598 598 if (RT_SUCCESS(rc)) 599 599 { 600 mMachine->SetGuestProperty(Bstr(pszPropertyName), Bstr(""), Bstr("RDONLYGUEST"));600 mMachine->SetGuestProperty(Bstr(pszPropertyName), NULL, bstrReadOnlyGuest); 601 601 RTStrFree(pszPropertyName); 602 602 } … … 606 606 if (RT_SUCCESS(rc)) 607 607 { 608 mMachine->SetGuestProperty(Bstr("/VirtualBox/HostInfo/VRDP/LastDisconnectedClient"), Bstr(pszClientId), Bstr("RDONLYGUEST"));608 mMachine->SetGuestProperty(Bstr("/VirtualBox/HostInfo/VRDP/LastDisconnectedClient"), Bstr(pszClientId), bstrReadOnlyGuest); 609 609 RTStrFree(pszClientId); 610 610 } … … 1190 1190 1191 1191 // static 1192 DECLCALLBACK(int) 1193 Console::doGuestPropNotification(void *pvExtension, uint32_t u32Function, 1194 void *pvParms, uint32_t cbParms) 1192 DECLCALLBACK(int) Console::doGuestPropNotification(void *pvExtension, 1193 uint32_t u32Function, 1194 void *pvParms, 1195 uint32_t cbParms) 1195 1196 { 1196 1197 using namespace guestProp; … … 1212 1213 Bstr value(pCBData->pcszValue); 1213 1214 Bstr flags(pCBData->pcszFlags); 1214 if ( !name.isNull() 1215 && (!value.isNull() || pCBData->pcszValue == NULL) 1216 && (!flags.isNull() || pCBData->pcszFlags == NULL) 1217 ) 1218 { 1219 ComObjPtr<Console> ptrConsole = reinterpret_cast<Console *>(pvExtension); 1220 HRESULT hrc = ptrConsole->mControl->PushGuestProperty(name, 1221 value, 1222 pCBData->u64Timestamp, 1223 flags); 1224 if (SUCCEEDED(hrc)) 1225 rc = VINF_SUCCESS; 1226 else 1227 { 1228 LogFunc(("Console::doGuestPropNotification: hrc=%Rhrc pCBData={.pcszName=%s, .pcszValue=%s, .pcszFlags=%s}\n", 1229 pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags)); 1230 rc = Global::vboxStatusCodeFromCOM(hrc); 1231 } 1232 } 1215 ComObjPtr<Console> ptrConsole = reinterpret_cast<Console *>(pvExtension); 1216 HRESULT hrc = ptrConsole->mControl->PushGuestProperty(name, 1217 value, 1218 pCBData->u64Timestamp, 1219 flags); 1220 if (SUCCEEDED(hrc)) 1221 rc = VINF_SUCCESS; 1233 1222 else 1234 rc = VERR_NO_MEMORY; 1223 { 1224 LogFunc(("Console::doGuestPropNotification: hrc=%Rhrc pCBData={.pcszName=%s, .pcszValue=%s, .pcszFlags=%s}\n", 1225 pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags)); 1226 rc = Global::vboxStatusCodeFromCOM(hrc); 1227 } 1235 1228 return rc; 1236 1229 } … … 1248 1241 Utf8Str utf8Patterns(aPatterns); 1249 1242 parm[0].type = VBOX_HGCM_SVC_PARM_PTR; 1243 // mutableRaw() returns NULL for an empty string 1244 // if ((parm[0].u.pointer.addr = utf8Patterns.mutableRaw())) 1245 // parm[0].u.pointer.size = (uint32_t)utf8Patterns.length() + 1; 1246 // else 1247 // { 1248 // parm[0].u.pointer.addr = (void*)""; 1249 // parm[0].u.pointer.size = 1; 1250 // } 1250 1251 parm[0].u.pointer.addr = utf8Patterns.mutableRaw(); 1251 1252 parm[0].u.pointer.size = (uint32_t)utf8Patterns.length() + 1; … … 1364 1365 try 1365 1366 { 1366 Bstr pattern(""); 1367 hrc = doEnumerateGuestProperties(pattern, ComSafeArrayAsOutParam(namesOut), 1367 Bstr pattern; 1368 hrc = doEnumerateGuestProperties(pattern, 1369 ComSafeArrayAsOutParam(namesOut), 1368 1370 ComSafeArrayAsOutParam(valuesOut), 1369 1371 ComSafeArrayAsOutParam(timestampsOut), … … 1371 1373 if (SUCCEEDED(hrc)) 1372 1374 { 1373 std::vector 1374 std::vector 1375 std::vector 1376 std::vector 1375 std::vector<BSTR> names; 1376 std::vector<BSTR> values; 1377 std::vector<ULONG64> timestamps; 1378 std::vector<BSTR> flags; 1377 1379 for (size_t i = 0; i < namesOut.size(); ++i) 1378 1380 { … … 1392 1394 com::SafeArray<ULONG64> timestampsIn(timestamps); 1393 1395 com::SafeArray<BSTR> flagsIn(flags); 1394 if ( namesIn.isNull()1395 || valuesIn.isNull()1396 || timestampsIn.isNull()1397 || flagsIn.isNull()1398 )1399 throw std::bad_alloc();1400 1396 /* PushGuestProperties() calls DiscardSettings(), which calls us back */ 1401 1397 mControl->PushGuestProperties(ComSafeArrayAsInParam(namesIn), … … 2594 2590 { 2595 2591 #ifdef VBOX_WITH_USB 2596 CheckComArg NotNull(aAddress);2592 CheckComArgStrNotEmptyOrNull(aAddress); 2597 2593 CheckComArgOutPointerValid(aDevice); 2598 2594 … … 2664 2660 Console::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable) 2665 2661 { 2666 CheckComArg NotNull(aName);2667 CheckComArg NotNull(aHostPath);2662 CheckComArgStrNotEmptyOrNull(aName); 2663 CheckComArgStrNotEmptyOrNull(aHostPath); 2668 2664 2669 2665 AutoCaller autoCaller(this); … … 2732 2728 STDMETHODIMP Console::RemoveSharedFolder(IN_BSTR aName) 2733 2729 { 2734 CheckComArg NotNull(aName);2730 CheckComArgStrNotEmptyOrNull(aName); 2735 2731 2736 2732 AutoCaller autoCaller(this); … … 2798 2794 LogFlowThisFunc(("aName='%ls' mMachineState=%08X\n", aName, mMachineState)); 2799 2795 2800 CheckComArg NotNull(aName);2796 CheckComArgStrNotEmptyOrNull(aName); 2801 2797 CheckComArgOutPointerValid(aProgress); 2802 2798 … … 7725 7721 * (i.e. creating a snapshot online) 7726 7722 */ 7727 ComAssertThrow( (!pTask->bstrSavedStateFile.is Null() &&pTask->fTakingSnapshotOnline)7728 || ( pTask->bstrSavedStateFile.isNull() && !pTask->fTakingSnapshotOnline),7723 ComAssertThrow( (!pTask->bstrSavedStateFile.isEmpty() && pTask->fTakingSnapshotOnline) 7724 || ( pTask->bstrSavedStateFile.isEmpty() && !pTask->fTakingSnapshotOnline), 7729 7725 rc = E_FAIL); 7730 7726 … … 8040 8036 task->mProgress->notifyComplete(rc, 8041 8037 COM_IIDOF(IConsole), 8042 Console::getComponentName(),8038 (CBSTR)Console::getComponentName(), 8043 8039 errMsg.c_str()); 8044 8040 else
Note:
See TracChangeset
for help on using the changeset viewer.