儲存庫 vbox 的更動 18453
- 時間撮記:
- 2009-3-28 上午04:27:36 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/HostServices/GuestProperties/service.cpp
r15277 r18453 528 528 char *pchBuf; 529 529 uint32_t cchName, cchBuf; 530 uint32_t cchFlags, cchBufActual;531 530 char szFlags[MAX_FLAGS_LEN]; 532 531 … … 540 539 ) 541 540 rc = VERR_INVALID_PARAMETER; 542 if (RT_SUCCESS(rc))541 else 543 542 rc = validateName(pcszName, cchName); 544 543 … … 549 548 /* Get the value size */ 550 549 PropertyList::const_iterator it; 551 bool found = false; 552 if (RT_SUCCESS(rc)) 550 if (RT_SUCCESS(rc)) 551 { 552 rc = VERR_NOT_FOUND; 553 553 for (it = mProperties.begin(); it != mProperties.end(); ++it) 554 554 if (it->mName.compare(pcszName) == 0) 555 555 { 556 found = true;556 rc = VINF_SUCCESS; 557 557 break; 558 558 } 559 if (RT_SUCCESS(rc) && !found) 560 rc = VERR_NOT_FOUND; 559 } 561 560 if (RT_SUCCESS(rc)) 562 561 rc = writeFlags(it->mFlags, szFlags); 563 562 if (RT_SUCCESS(rc)) 564 cchFlags = strlen(szFlags); 565 /* Check that the buffer is big enough */ 566 if (RT_SUCCESS(rc)) 567 { 568 cchBufActual = it->mValue.size() + 1 + cchFlags; 569 paParms[3].setUInt32 (cchBufActual); 570 } 571 if (RT_SUCCESS(rc) && (cchBufActual > cchBuf)) 572 rc = VERR_BUFFER_OVERFLOW; 573 /* Write the value, flags and timestamp */ 574 if (RT_SUCCESS(rc)) 575 { 576 it->mValue.copy(pchBuf, cchBuf, 0); 577 pchBuf[it->mValue.size()] = '\0'; /* Terminate the value */ 578 strcpy(pchBuf + it->mValue.size() + 1, szFlags); 579 paParms[2].setUInt64 (it->mTimestamp); 580 } 581 582 /* 583 * Done! Do exit logging and return. 584 */ 585 if (RT_SUCCESS(rc)) 586 Log2(("Queried string %s, value=%s, timestamp=%lld, flags=%s\n", 587 pcszName, it->mValue.c_str(), it->mTimestamp, szFlags)); 563 { 564 /* Check that the buffer is big enough */ 565 size_t cchBufActual = it->mValue.size() + 1 + strlen(szFlags); 566 paParms[3].setUInt32 ((uint32_t)cchBufActual); 567 if (cchBufActual <= cchBuf) 568 { 569 /* Write the value, flags and timestamp */ 570 it->mValue.copy(pchBuf, cchBuf, 0); 571 pchBuf[it->mValue.size()] = '\0'; /* Terminate the value */ 572 strcpy(pchBuf + it->mValue.size() + 1, szFlags); 573 paParms[2].setUInt64 (it->mTimestamp); 574 575 /* 576 * Done! Do exit logging and return. 577 */ 578 Log2(("Queried string %s, value=%s, timestamp=%lld, flags=%s\n", 579 pcszName, it->mValue.c_str(), it->mTimestamp, szFlags)); 580 } 581 else 582 rc = VERR_BUFFER_OVERFLOW; 583 } 584 588 585 LogFlowThisFunc(("rc = %Rrc\n", rc)); 589 586 return rc; … … 839 836 if (RT_SUCCESS(rc)) 840 837 { 841 paParms[2].setUInt32 ( buffer.size());838 paParms[2].setUInt32 ((uint32_t)buffer.size()); 842 839 /* Copy the memory if it fits into the guest buffer */ 843 840 if (buffer.size() <= cchBuf) … … 908 905 { 909 906 paParms[1].setUInt64(u64Timestamp); 910 paParms[3].setUInt32( buffer.size());907 paParms[3].setUInt32((uint32_t)buffer.size()); 911 908 if (buffer.size() <= cchBuf) 912 909 buffer.copy(pchBuf, cchBuf); … … 1366 1363 return rc; 1367 1364 } 1365
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器