Changeset 58183 in vbox for trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibVideo.cpp
- Timestamp:
- Oct 12, 2015 1:46:16 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibVideo.cpp
r58154 r58183 314 314 315 315 int rc, rc2 = VERR_UNRESOLVED_ERROR; 316 uint32_t u32ClientId= 0;316 HGCMCLIENTID idClient = 0; 317 317 const char *pszPattern = VIDEO_PROP_PREFIX"*"; 318 318 PVBGLR3GUESTPROPENUM pHandle = NULL; … … 321 321 322 322 AssertPtrReturn(pcScreen, VERR_INVALID_POINTER); 323 rc = VbglR3GuestPropConnect(&u32ClientId); 324 if (RT_SUCCESS(rc)) 325 rc = VbglR3GuestPropEnum(u32ClientId, &pszPattern, 1, &pHandle, 326 &pszName, NULL, NULL, NULL); 323 rc = VbglR3GuestPropConnect(&idClient); 324 if (RT_SUCCESS(rc)) 325 rc = VbglR3GuestPropEnum(idClient, &pszPattern, 1, &pHandle, &pszName, NULL, NULL, NULL); 327 326 if (u32ClientId != 0) 328 327 rc2 = VbglR3GuestPropDisconnect(u32ClientId); … … 333 332 uint32_t cScreen; 334 333 335 rc = RTStrToUInt32Full(pszName + sizeof(VIDEO_PROP_PREFIX) - 1, 10, 336 &cScreen); 334 rc = RTStrToUInt32Full(pszName + sizeof(VIDEO_PROP_PREFIX) - 1, 10, &cScreen); 337 335 if (RT_SUCCESS(rc)) /* There may be similar properties with text. */ 338 336 cHighestScreen = RT_MAX(cHighestScreen, cScreen); … … 366 364 using namespace guestProp; 367 365 368 uint32_t u32ClientId= 0;366 HGCMCLIENTID idClient = 0; 369 367 unsigned cx2, cy2, cBits2, x2, y2, cHighestScreen, cHighestScreen2; 370 368 bool fEnabled2; … … 374 372 rc = VbglR3VideoModeGetHighestSavedScreen(&cHighestScreen); 375 373 if (RT_SUCCESS(rc)) 376 rc = VbglR3GuestPropConnect(& u32ClientId);374 rc = VbglR3GuestPropConnect(&idClient); 377 375 if (RT_SUCCESS(rc)) 378 376 { … … 382 380 RTStrPrintf(szModeParms, sizeof(szModeParms), "%ux%ux%u,%ux%u,%u", cx, cy, cBits, x, y, (unsigned) fEnabled); 383 381 384 rc = VbglR3GuestPropWriteValue( u32ClientId, szModeName, szModeParms);382 rc = VbglR3GuestPropWriteValue(idClient, szModeName, szModeParms); 385 383 /* Write out the mode using the legacy name too, in case the user 386 384 * re-installs older Additions. */ … … 388 386 { 389 387 RTStrPrintf(szModeParms, sizeof(szModeParms), "%ux%ux%u", cx, cy, cBits); 390 VbglR3GuestPropWriteValue( u32ClientId, VIDEO_PROP_PREFIX "SavedMode", szModeParms);388 VbglR3GuestPropWriteValue(idClient, VIDEO_PROP_PREFIX "SavedMode", szModeParms); 391 389 } 392 390 } 393 if ( u32ClientId!= 0)394 rc2 = VbglR3GuestPropDisconnect( u32ClientId);391 if (idClient != 0) 392 rc2 = VbglR3GuestPropDisconnect(idClient); 395 393 if (rc == VINF_PERMISSION_DENIED) 396 394 return rc; … … 440 438 using namespace guestProp; 441 439 442 /*443 * First we retrieve the video mode which is saved as a string in the444 * guest property store.445 */440 /* 441 * First we retrieve the video mode which is saved as a string in the 442 * guest property store. 443 */ 446 444 /* The buffer for VbglR3GuestPropReadValue. If this is too small then 447 445 * something is wrong with the data stored in the property. */ 448 446 char szModeParms[1024]; 449 uint32_t u32ClientId= 0;447 HGCMCLIENTID idClient = 0; 450 448 int cMatches; 451 449 unsigned cx, cy, cBits; … … 456 454 int rc2 = VERR_UNRESOLVED_ERROR; 457 455 458 rc = VbglR3GuestPropConnect(& u32ClientId);456 rc = VbglR3GuestPropConnect(&idClient); 459 457 if (RT_SUCCESS(rc)) 460 458 { … … 462 460 char szModeName[MAX_NAME_LEN]; 463 461 RTStrPrintf(szModeName, sizeof(szModeName), VIDEO_PROP_PREFIX "%u", idScreen); 464 rc = VbglR3GuestPropReadValue(u32ClientId, szModeName, szModeParms, 465 sizeof(szModeParms), NULL); 462 rc = VbglR3GuestPropReadValue(idClient, szModeName, szModeParms, sizeof(szModeParms), NULL); 466 463 /* Try legacy single screen name. */ 467 464 if (rc == VERR_NOT_FOUND && idScreen == 0) 468 rc = VbglR3GuestPropReadValue( u32ClientId,465 rc = VbglR3GuestPropReadValue(idClient, 469 466 VIDEO_PROP_PREFIX"SavedMode", 470 467 szModeParms, sizeof(szModeParms), 471 468 NULL); 472 469 } 473 if ( u32ClientId!= 0)474 rc2 = VbglR3GuestPropDisconnect( u32ClientId);470 if (idClient != 0) 471 rc2 = VbglR3GuestPropDisconnect(idClient); 475 472 if (RT_SUCCESS(rc)) 476 473 rc = rc2; 477 474 478 /*479 * Now we convert the string returned to numeric values.480 */475 /* 476 * Now we convert the string returned to numeric values. 477 */ 481 478 if (RT_SUCCESS(rc)) 482 479 { 483 480 char c1, c2; 484 cMatches = sscanf(szModeParms, "%5ux%5ux%2u%c%5ux%5u,%1u%c", &cx, &cy, &cBits, 485 &c1, &x, &y, &fEnabled, &c2); 481 cMatches = sscanf(szModeParms, "%5ux%5ux%2u%c%5ux%5u,%1u%c", &cx, &cy, &cBits, &c1, &x, &y, &fEnabled, &c2); 486 482 if ((cMatches == 7 && c1 == ',') || cMatches == 3) 487 483 rc = VINF_SUCCESS; … … 491 487 rc = VERR_PARSE_ERROR; 492 488 } 493 /* 494 * And clean up and return the values if we successfully obtained them. 495 */ 489 490 /* 491 * And clean up and return the values if we successfully obtained them. 492 */ 496 493 if (RT_SUCCESS(rc)) 497 494 {
Note:
See TracChangeset
for help on using the changeset viewer.