Changeset 36733 in vbox
- Timestamp:
- Apr 19, 2011 4:03:27 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp
r36548 r36733 707 707 #ifdef VBOXSERVICE_TOOLBOX 708 708 /** 709 * Constructs the argv command line of a VBoxService program 710 * by first appending the full path of VBoxService along with the given 711 * tool name (e.g. "vbox_cat") + the tool's actual command line parameters. 709 * Constructs the argv command line by resolving environment variables 710 * and relative paths. 712 711 * 713 712 * @return IPRT status code. 714 * @param psz FileName File name (full path) of this process.715 * @param papszArgs Original argv command line from the host .713 * @param pszArgv0 First argument (argv0), either original or modified version. 714 * @param papszArgs Original argv command line from the host, starting at argv[1]. 716 715 * @param ppapszArgv Pointer to a pointer with the new argv command line. 717 716 * Needs to be freed with RTGetOptArgvFree. 718 717 */ 719 static int VBoxServiceControlExecPrepareArgv(const char *psz FileName,718 static int VBoxServiceControlExecPrepareArgv(const char *pszArgv0, 720 719 const char * const *papszArgs, char ***ppapszArgv) 721 720 { 722 AssertPtrReturn(pszFileName, VERR_INVALID_PARAMETER); 723 AssertPtrReturn(papszArgs, VERR_INVALID_PARAMETER); 721 AssertPtrReturn(pszArgv0, VERR_INVALID_PARAMETER); 724 722 AssertPtrReturn(ppapszArgv, VERR_INVALID_PARAMETER); 725 726 /** @todo r=bird: Obvious misdesign: argv[0] does NOT have to be the same as727 * the full path to the executable file name!! I thought we went thru728 * all that when you did the VBoxService toolbox stuff, i.e. how busybox729 * works? */730 723 731 724 /** @todo RTGetOptArgvToString converts to MSC quoted string, while … … 737 730 RTGETOPTARGV_CNV_QUOTE_MS_CRT); /* RTGETOPTARGV_CNV_QUOTE_BOURNE_SH */ 738 731 if ( RT_SUCCESS(rc) 739 && pszArgs) /**< @todo pszArg will never be NULL on a successfull return. Perhaps *pszArgs was meant? */732 && *pszArgs) 740 733 { 741 734 /* … … 748 741 { 749 742 char *pszNewArgs; 750 if (RTStrAPrintf(&pszNewArgs, "%s %s", psz FileName, szArgsExp))743 if (RTStrAPrintf(&pszNewArgs, "%s %s", pszArgv0, szArgsExp)) 751 744 { 752 745 #ifdef DEBUG … … 766 759 int iNumArgsIgnored; 767 760 rc = RTGetOptArgvFromString(ppapszArgv, &iNumArgsIgnored, 768 psz FileName, NULL /* Use standard separators. */);761 pszArgv0, NULL /* Use standard separators. */); 769 762 } 770 763 return rc; … … 829 822 { 830 823 char **papszArgsExp; 831 rc = VBoxServiceControlExecPrepareArgv(szSysprepCmd , papszArgs, &papszArgsExp);824 rc = VBoxServiceControlExecPrepareArgv(szSysprepCmd /* argv0 */, &papszArgs[1], &papszArgsExp); 832 825 if (RT_SUCCESS(rc)) 833 826 { … … 849 842 { 850 843 char **papszArgsExp; 851 rc = VBoxServiceControlExecPrepareArgv(szExecExp , papszArgs, &papszArgsExp);844 rc = VBoxServiceControlExecPrepareArgv(szExecExp /* argv0 */, &papszArgs[1], &papszArgsExp); 852 845 if (RT_SUCCESS(rc)) 853 846 { … … 870 863 #ifdef DEBUG 871 864 char *pszCmdLine; 872 865 rc = RTGetOptArgvToString(&pszCmdLine, papszArgsExp, 0 /* Default */); 873 866 AssertRC(rc); 874 867 VBoxServiceVerbose(3, "ControlExec: Executing: %s %s\n",
Note:
See TracChangeset
for help on using the changeset viewer.