Changeset 36183 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Mar 7, 2011 10:55:00 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp
r36182 r36183 138 138 " -f | --foreground Don't daemonize the program. For debugging.\n" 139 139 " -v | --verbose Increment the verbosity level. For debugging.\n" 140 " -V | --version Show version information.\n" 140 141 " -h | -? | --help Show this message and exit with status 1.\n" 141 142 ); … … 577 578 #endif 578 579 579 VBoxServiceReportStatus(VBoxGuestFacilityStatus_PreInit);580 581 /*582 * Do pre-init of services.583 */584 for (unsigned j = 0; j < RT_ELEMENTS(g_aServices); j++)585 {586 rc = g_aServices[j].pDesc->pfnPreInit();587 if (RT_FAILURE(rc))588 {589 VBoxServiceReportStatus(VBoxGuestFacilityStatus_Failed);590 return VBoxServiceError("Service '%s' failed pre-init: %Rrc\n", g_aServices[j].pDesc->pszName, rc);591 }592 }593 594 580 /* 595 581 * Parse the arguments. … … 615 601 else if (MATCHES("verbose")) 616 602 psz = "v"; 603 else if (MATCHES("version")) 604 psz = "V"; 617 605 else if (MATCHES("help")) 618 606 psz = "h"; … … 682 670 break; 683 671 672 case 'V': 673 RTPrintf("%sr%s\n", RTBldCfgVersion(), RTBldCfgRevisionStr()); 674 return RTEXITCODE_SUCCESS; 675 684 676 case 'h': 685 677 case '?': … … 699 691 for (unsigned j = 0; j < RT_ELEMENTS(g_aServices); j++) 700 692 { 701 rc = g_aServices[j].pDesc->pfnOption(&psz, argc, argv, &i); 702 fFound = rc == 0; 693 rc = g_aServices[j].pDesc->pfnPreInit(); 694 if (RT_FAILURE(rc)) 695 return VBoxServiceError("Service '%s' failed pre-init: %Rrc\n", g_aServices[j].pDesc->pszName, rc); 696 else 697 rc = g_aServices[j].pDesc->pfnOption(&psz, argc, argv, &i); 698 fFound = rc == VINF_SUCCESS; 703 699 if (fFound) 704 700 break; … … 781 777 #endif 782 778 { 779 VBoxServiceReportStatus(VBoxGuestFacilityStatus_PreInit); 780 783 781 /* 784 782 * Windows: We're running the service as a console application now. Start the … … 794 792 VBoxServiceMainWait(); 795 793 VBoxServiceStopServices(); 794 795 /* Only report the "terminated" status when we really did run the internal services -- 796 * otherwise we also wrongly would report "terminated" when a user simply 797 * wants to query the version or the command line help. */ 798 VBoxServiceReportStatus(VBoxGuestFacilityStatus_Terminated); 796 799 } 797 800 … … 808 811 809 812 VBoxServiceVerbose(0, "Ended.\n"); 810 VBoxServiceReportStatus(VBoxGuestFacilityStatus_Terminated);811 813 return rcExit; 812 814 }
Note:
See TracChangeset
for help on using the changeset viewer.