Changeset 21647 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jul 16, 2009 12:46:21 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 50179
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r21639 r21647 470 470 LogFlowThisFuncLeave(); 471 471 } 472 473 #ifdef VBOX_WITH_GUEST_PROPS 474 bool Console::enabledGuestPropertiesVRDP (void) 475 { 476 Bstr value; 477 HRESULT hrc = mMachine->GetExtraData(Bstr("VBoxInternal2/EnableGuestPropertiesVRDP"), value.asOutParam()); 478 if (hrc == S_OK) 479 { 480 if (value == "1") 481 { 482 return true; 483 } 484 } 485 return false; 486 } 487 488 void Console::updateGuestPropertiesVRDPLogon (uint32_t u32ClientId, const char *pszUser, const char *pszDomain) 489 { 490 if (!enabledGuestPropertiesVRDP()) 491 { 492 return; 493 } 494 495 int rc; 496 char *pszPropertyName; 497 498 rc = RTStrAPrintf(&pszPropertyName, "/VirtualBox/HostInfo/VRDP/Client/%d/Name", u32ClientId); 499 if (RT_SUCCESS(rc)) 500 { 501 Bstr clientName; 502 mRemoteDisplayInfo->COMGETTER(ClientName)(clientName.asOutParam()); 503 504 mMachine->SetGuestPropertyValue(Bstr(pszPropertyName), clientName); 505 RTStrFree(pszPropertyName); 506 } 507 508 rc = RTStrAPrintf(&pszPropertyName, "/VirtualBox/HostInfo/VRDP/Client/%d/User", u32ClientId); 509 if (RT_SUCCESS(rc)) 510 { 511 mMachine->SetGuestPropertyValue(Bstr(pszPropertyName), Bstr(pszUser)); 512 RTStrFree(pszPropertyName); 513 } 514 515 rc = RTStrAPrintf(&pszPropertyName, "/VirtualBox/HostInfo/VRDP/Client/%d/Domain", u32ClientId); 516 if (RT_SUCCESS(rc)) 517 { 518 mMachine->SetGuestPropertyValue(Bstr(pszPropertyName), Bstr(pszDomain)); 519 RTStrFree(pszPropertyName); 520 } 521 522 char *pszClientId; 523 rc = RTStrAPrintf(&pszClientId, "%d", u32ClientId); 524 if (RT_SUCCESS(rc)) 525 { 526 mMachine->SetGuestPropertyValue(Bstr("/VirtualBox/HostInfo/VRDP/LastConnectedClient"), Bstr(pszClientId)); 527 RTStrFree(pszClientId); 528 } 529 530 return; 531 } 532 533 void Console::updateGuestPropertiesVRDPDisconnect (uint32_t u32ClientId) 534 { 535 if (!enabledGuestPropertiesVRDP()) 536 { 537 return; 538 } 539 540 int rc; 541 char *pszPropertyName; 542 543 rc = RTStrAPrintf(&pszPropertyName, "/VirtualBox/HostInfo/VRDP/Client/%d/Name", u32ClientId); 544 if (RT_SUCCESS(rc)) 545 { 546 mMachine->SetGuestPropertyValue(Bstr(pszPropertyName), Bstr("")); 547 RTStrFree(pszPropertyName); 548 } 549 550 rc = RTStrAPrintf(&pszPropertyName, "/VirtualBox/HostInfo/VRDP/Client/%d/User", u32ClientId); 551 if (RT_SUCCESS(rc)) 552 { 553 mMachine->SetGuestPropertyValue(Bstr(pszPropertyName), Bstr("")); 554 RTStrFree(pszPropertyName); 555 } 556 557 rc = RTStrAPrintf(&pszPropertyName, "/VirtualBox/HostInfo/VRDP/Client/%d/Domain", u32ClientId); 558 if (RT_SUCCESS(rc)) 559 { 560 mMachine->SetGuestPropertyValue(Bstr(pszPropertyName), Bstr("")); 561 RTStrFree(pszPropertyName); 562 } 563 564 char *pszClientId; 565 rc = RTStrAPrintf(&pszClientId, "%d", u32ClientId); 566 if (RT_SUCCESS(rc)) 567 { 568 mMachine->SetGuestPropertyValue(Bstr("/VirtualBox/HostInfo/VRDP/LastDisconnectedClient"), Bstr(pszClientId)); 569 RTStrFree(pszClientId); 570 } 571 572 return; 573 } 574 #endif /* VBOX_WITH_GUEST_PROPS */ 575 472 576 473 577 int Console::VRDPClientLogon (uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain) … … 659 763 } 660 764 661 /* Set guest properties. */ 662 int rc; 663 char *pszPropertyName; 664 rc = RTStrAPrintf(&pszPropertyName, "/VirtualBox/HostInfo/VRDP/Client/%d/Name", u32ClientId); 665 if (RT_SUCCESS(rc)) 666 { 667 Bstr clientName; 668 mRemoteDisplayInfo->COMGETTER(ClientName)(clientName.asOutParam()); 669 670 mMachine->SetGuestPropertyValue(Bstr(pszPropertyName), clientName); 671 RTStrFree(pszPropertyName); 672 } 673 674 char *pszClientId; 675 rc = RTStrAPrintf(&pszClientId, "%d", u32ClientId); 676 if (RT_SUCCESS(rc)) 677 { 678 mMachine->SetGuestPropertyValue(Bstr("/VirtualBox/HostInfo/VRDP/LastConnectedClient"), Bstr(pszClientId)); 679 RTStrFree(pszClientId); 680 } 765 #ifdef VBOX_WITH_GUEST_PROPS 766 updateGuestPropertiesVRDPLogon (u32ClientId, pszUser, pszDomain); 767 #endif /* VBOX_WITH_GUEST_PROPS */ 681 768 682 769 return VINF_SUCCESS; … … 771 858 mConsoleVRDPServer->AuthDisconnect (uuid, u32ClientId); 772 859 773 /* Reset guest properties for the client. */ 774 int rc; 775 char *pszPropertyName; 776 rc = RTStrAPrintf(&pszPropertyName, "/VirtualBox/HostInfo/VRDP/Client/%d/Name", u32ClientId); 777 if (RT_SUCCESS(rc)) 778 { 779 mMachine->SetGuestPropertyValue(Bstr(pszPropertyName), Bstr("")); 780 RTStrFree(pszPropertyName); 781 } 782 783 char *pszClientId; 784 rc = RTStrAPrintf(&pszClientId, "%d", u32ClientId); 785 if (RT_SUCCESS(rc)) 786 { 787 mMachine->SetGuestPropertyValue(Bstr("/VirtualBox/HostInfo/VRDP/LastDisconnectedClient"), Bstr(pszClientId)); 788 RTStrFree(pszClientId); 789 } 860 #ifdef VBOX_WITH_GUEST_PROPS 861 updateGuestPropertiesVRDPDisconnect (u32ClientId); 862 #endif /* VBOX_WITH_GUEST_PROPS */ 790 863 791 864 LogFlowFuncLeave(); -
trunk/src/VBox/Main/include/ConsoleImpl.h
r21622 r21647 508 508 ComSafeArrayOut(ULONG64, aTimestamps), 509 509 ComSafeArrayOut(BSTR, aFlags)); 510 511 bool enabledGuestPropertiesVRDP (void); 512 void updateGuestPropertiesVRDPLogon (uint32_t u32ClientId, const char *pszUser, const char *pszDomain); 513 void updateGuestPropertiesVRDPDisconnect (uint32_t u32ClientId); 510 514 #endif 511 515
Note:
See TracChangeset
for help on using the changeset viewer.