- Timestamp:
- May 2, 2015 2:36:57 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99965
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h
r55591 r55592 241 241 return RTEnvFreeUtf8Block(pszzBlock); 242 242 } 243 244 /** 245 * Applies a block on the format returned by queryUtf8Block. 246 * 247 * @returns IPRT status code. 248 * @param pszzBlock Pointer to the block. 249 * @param cbBlock The size of the block. 250 * @param fNoEqualMeansUnset Whether the lack of a '=' (equal) sign in a 251 * string means it should be unset (@c true), or if 252 * it means the variable should be defined with an 253 * empty value (@c false, the default). 254 * @todo move this to RTEnv! 255 */ 256 int copyUtf8Block(const char *pszzBlock, size_t cbBlock, bool fNoEqualMeansUnset = false) 257 { 258 int rc = VINF_SUCCESS; 259 while (cbBlock > 0 && *pszzBlock != '\0') 260 { 261 const char *pszEnd = (const char *)memchr(pszzBlock, '\0', cbBlock); 262 if (!pszEnd) 263 return VERR_BUFFER_UNDERFLOW; 264 int rc2; 265 if (fNoEqualMeansUnset || strchr(pszzBlock, '=')) 266 rc2 = RTEnvPutEx(m_hEnv, pszzBlock); 267 else 268 rc2 = RTEnvSetEx(m_hEnv, pszzBlock, ""); 269 if (RT_FAILURE(rc2) && RT_SUCCESS(rc)) 270 rc = rc2; 271 272 /* Advance. */ 273 cbBlock -= pszEnd - pszzBlock; 274 if (cbBlock < 2) 275 return VERR_BUFFER_UNDERFLOW; 276 cbBlock--; 277 pszzBlock = pszEnd + 1; 278 } 279 280 /* The remainder must be zero padded. */ 281 if (RT_SUCCESS(rc)) 282 { 283 if (ASMMemIsAll8(pszzBlock, cbBlock, 0)) 284 return VINF_SUCCESS; 285 return VERR_TOO_MUCH_DATA; 286 } 287 return rc; 288 } 289 243 290 244 291 /** -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r55591 r55592 515 515 , mRC(rThat.mRC) 516 516 { } 517 ~Data(void) 518 { 519 if (mpBaseEnvironment) 520 { 521 mpBaseEnvironment->releaseConst(); 522 mpBaseEnvironment = NULL; 523 } 524 } 517 525 } mData; 518 526 }; -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r55591 r55592 325 325 if (mData.mpBaseEnvironment) 326 326 { 327 GuestEnvironment *pBaseEnv = unconst(mData.mpBaseEnvironment);327 mData.mpBaseEnvironment->releaseConst(); 328 328 mData.mpBaseEnvironment = NULL; 329 pBaseEnv->release();330 329 } 331 330 … … 1571 1570 case GUEST_SESSION_NOTIFYTYPE_STARTED: 1572 1571 sessionStatus = GuestSessionStatus_Started; 1572 #if 0 /** @todo If we get some environment stuff along with this kind notification: */ 1573 const char *pszzEnvBlock = ...; 1574 uint32_t cbEnvBlock = ...; 1575 if (!mData.mpBaseEnvironment) 1576 { 1577 GuestEnvironment *pBaseEnv; 1578 try { pBaseEnv = new GuestEnvironment(); } catch (std::bad_alloc &) { pBaseEnv = NULL; } 1579 if (pBaseEnv) 1580 { 1581 int vrc = pBaseEnv->initNormal(); 1582 if (RT_SUCCESS(vrc)) 1583 vrc = pBaseEnv->copyUtf8Block(pszzEnvBlock, cbEnvBlock); 1584 if (RT_SUCCESS(vrc)) 1585 mData.mpBaseEnvironment = pBaseEnv; 1586 else 1587 pBaseEnv->release(); 1588 } 1589 } 1590 #endif 1573 1591 break; 1574 1592
Note:
See TracChangeset
for help on using the changeset viewer.