Changeset 11442 in vbox for trunk/src/VBox/Frontends/VBoxHeadless
- Timestamp:
- Aug 15, 2008 1:21:42 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
r11102 r11442 339 339 " -s, -startvm, --startvm <name|uuid> Start given VM (required argument)\n" 340 340 #ifdef VBOX_WITH_VRDP 341 " -v, -vrdp, --vrdp on|off|config Enable (default) or disable the VRDP\n" 342 " server or don't change the setting\n" 341 343 " -p, -vrdpport, --vrdpport <port> Port number the VRDP server will bind\n" 342 344 " to\n" … … 409 411 ULONG vrdpPort = ~0U; 410 412 const char *vrdpAddress = NULL; 413 const char *vrdpEnabled = NULL; 411 414 #endif 412 415 unsigned fRawR0 = ~0U; … … 455 458 OPT_CSAM, 456 459 OPT_NO_CSAM, 457 OPT_COMMENT 460 OPT_COMMENT, 458 461 }; 459 462 … … 467 470 { "-vrdpaddress", 'a', RTGETOPT_REQ_STRING }, 468 471 { "--vrdpaddress", 'a', RTGETOPT_REQ_STRING }, 472 { "-vrdp", 'v', RTGETOPT_REQ_STRING }, 473 { "--vrdp", 'v', RTGETOPT_REQ_STRING }, 469 474 #endif /* VBOX_WITH_VRDP defined */ 470 475 { "-rawr0", OPT_RAW_R0, 0 }, … … 522 527 vrdpAddress = ValueUnion.psz; 523 528 break; 529 case 'v': 530 vrdpEnabled = ValueUnion.psz; 531 break; 524 532 #endif /* VBOX_WITH_VRDP defined */ 525 533 case OPT_RAW_R0: … … 809 817 810 818 #ifdef VBOX_WITH_VRDP 811 Log (("VBoxHeadless: Enabling VRDP server...\n")); 812 819 /* default is to enable the RDP server (backward compatibility) */ 820 BOOL fVRDPEnable = true; 821 BOOL fVRDPEnabled; 813 822 ComPtr <IVRDPServer> vrdpServer; 814 823 CHECK_ERROR_BREAK(machine, COMGETTER (VRDPServer) (vrdpServer.asOutParam())); 815 816 /* set VRDP port if requested by the user */ 817 if (vrdpPort != ~0U) 818 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(Port)(vrdpPort)); 824 CHECK_ERROR_BREAK(vrdpServer, COMGETTER(Enabled) (&fVRDPEnabled)); 825 826 if (vrdpEnabled != NULL) 827 { 828 /* -vrdp on|off|config */ 829 if (!strcmp(vrdpEnabled, "off") || !strcmp(vrdpEnabled, "disable")) 830 fVRDPEnable = false; 831 else if (!strcmp(vrdpEnabled, "config")) 832 { 833 if (!fVRDPEnabled) 834 fVRDPEnable = false; 835 } 836 else if (strcmp(vrdpEnabled, "on") && strcmp(vrdpEnabled, "enable")) 837 { 838 RTPrintf("-vrdp requires an argument (on|off|config)\n"); 839 break; 840 } 841 } 842 843 if (fVRDPEnable) 844 { 845 Log (("VBoxHeadless: Enabling VRDP server...\n")); 846 847 /* set VRDP port if requested by the user */ 848 if (vrdpPort != ~0U) 849 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(Port)(vrdpPort)); 850 else 851 CHECK_ERROR_BREAK(vrdpServer, COMGETTER(Port)(&vrdpPort)); 852 /* set VRDP address if requested by the user */ 853 if (vrdpAddress != NULL) 854 { 855 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(NetAddress)(Bstr(vrdpAddress))); 856 } 857 /* enable VRDP server (only if currently disabled) */ 858 if (!fVRDPEnabled) 859 { 860 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(Enabled) (TRUE)); 861 } 862 } 819 863 else 820 CHECK_ERROR_BREAK(vrdpServer, COMGETTER(Port)(&vrdpPort)); 821 /* set VRDP address if requested by the user */ 822 if (vrdpAddress != NULL) 823 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(NetAddress)(Bstr(vrdpAddress))); 824 825 /* enable VRDP server (only if currently disabled) */ 826 BOOL fVRDPEnabled; 827 CHECK_ERROR_BREAK(vrdpServer, COMGETTER(Enabled) (&fVRDPEnabled)); 828 if (!fVRDPEnabled) 829 { 830 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(Enabled) (TRUE)); 864 { 865 /* disable VRDP server (only if currently enabled */ 866 if (fVRDPEnabled) 867 { 868 CHECK_ERROR_BREAK(vrdpServer, COMSETTER(Enabled) (FALSE)); 869 } 831 870 } 832 871 #endif 833 872 Log (("VBoxHeadless: Powering up the machine...\n")); 834 873 #ifdef VBOX_WITH_VRDP 835 RTPrintf("Listening on port %d\n", !vrdpPort ? VRDP_DEFAULT_PORT : vrdpPort); 874 if (fVRDPEnable) 875 RTPrintf("Listening on port %d\n", !vrdpPort ? VRDP_DEFAULT_PORT : vrdpPort); 836 876 #endif 837 877
Note:
See TracChangeset
for help on using the changeset viewer.