Changeset 99120 in vbox for trunk/src/VBox/Main
- Timestamp:
- Mar 22, 2023 5:30:14 PM (22 months ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r99085 r99120 14814 14814 <interface 14815 14815 name="IGuestSession" extends="$unknown" 14816 uuid=" 234f0627-866d-48c2-91a5-4c9d50f04928"14816 uuid="5591bead-9c1d-4cbd-9669-2d0b04fac0a8" 14817 14817 wsmap="managed" 14818 14818 reservedMethods="8" reservedAttributes="12" … … 15947 15947 If ProcessCreateFlag_WaitForStdOut and/or ProcessCreateFlag_WaitForStdErr 15948 15948 are set, the guest process will not enter the terminated state until 15949 all data from the specified streams have been read read.15949 all data from the specified streams have been read. 15950 15950 </note> 15951 15951 … … 15961 15961 <desc> 15962 15962 Full path to the file to execute in the guest. The file has to 15963 exist sin the guest VM with executable right to the session user in15963 exist in the guest VM with executable right to the session user in 15964 15964 order to succeed. If empty/null, the first entry in the 15965 15965 @a arguments array will be used instead (i.e. argv[0]). 15966 </desc> 15967 </param> 15968 <param name="cwd" type="wstring" dir="in"> 15969 <desc> 15970 Path to the directory in which to execute in the guest. The 15971 directory has to exist in the guest VM with search rights to the 15972 session user in order to succeed. If empty/null, the session 15973 user's default (typically 'home') directory is used. If not a 15974 full path, it is interpreted relative to the default directory; 15975 e.g. 'work' means '$HOME/work' (according to the guest's '$HOME'- 15976 like concept). 15966 15977 </desc> 15967 15978 </param> … … 16017 16028 See <link to="IGuestSession::processCreate"/> for more information. 16018 16029 </desc> 16030 <param name="cwd" type="wstring" dir="in"> 16031 <desc> 16032 Path to the directory in which to execute in the guest. The 16033 directory has to exist in the guest VM with search rights to the 16034 session user in order to succeed. If empty/null, the session 16035 user's default (typically 'home') directory is used. If not a 16036 full path, it is interpreted relative to the default directory; 16037 e.g. 'work' means '$HOME/work' (according to the guest's '$HOME'- 16038 like concept). 16039 </desc> 16040 </param> 16019 16041 <param name="executable" type="wstring" dir="in"> 16020 16042 <desc> 16021 16043 Full path to the file to execute in the guest. The file has to 16022 exist sin the guest VM with executable right to the session user in16044 exist in the guest VM with executable right to the session user in 16023 16045 order to succeed. If empty/null, the first entry in the 16024 16046 @a arguments array will be used instead (i.e. argv[0]). -
trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h
r99085 r99120 945 945 /** The executable. */ 946 946 Utf8Str mExecutable; 947 /** The working directory. Optional, can be empty if not used. */ 948 Utf8Str mCwd; 947 949 /** Arguments vector (starting with argument \#0). */ 948 950 ProcessArguments mArguments; -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r98713 r99120 212 212 ULONG aMode); 213 213 HRESULT processCreate(const com::Utf8Str &aCommand, 214 const com::Utf8Str &aCwd, 214 215 const std::vector<com::Utf8Str> &aArguments, 215 216 const std::vector<com::Utf8Str> &aEnvironment, … … 218 219 ComPtr<IGuestProcess> &aGuestProcess); 219 220 HRESULT processCreateEx(const com::Utf8Str &aCommand, 221 const com::Utf8Str &aCwd, 220 222 const std::vector<com::Utf8Str> &aArguments, 221 223 const std::vector<com::Utf8Str> &aEnvironment, -
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r98666 r99120 1158 1158 int GuestProcess::i_startProcess(uint32_t cMsTimeout, int *pvrcGuest) 1159 1159 { 1160 LogFlowThisFunc(("cMsTimeout=%RU32, procExe=%s, procTimeoutMS=%RU32, procFlags=%x, sessionID=%RU32\n",1161 cMsTimeout, mData.mProcess.mExecutable.c_str(), mData.mProcess.m TimeoutMS, mData.mProcess.mFlags,1162 m Session->i_getId()));1160 LogFlowThisFunc(("cMsTimeout=%RU32, procExe=%s, cwd=%s, procTimeoutMS=%RU32, procFlags=%x, sessionID=%RU32\n", 1161 cMsTimeout, mData.mProcess.mExecutable.c_str(), mData.mProcess.mCwd.c_str(), 1162 mData.mProcess.mTimeoutMS, mData.mProcess.mFlags, mSession->i_getId())); 1163 1163 1164 1164 /* Wait until the caller function (if kicked off by a thread) … … 1215 1215 return VERR_BUFFER_OVERFLOW; 1216 1216 1217 Guest *pGuest = mSession->i_getParent(); 1218 AssertPtr(pGuest); 1219 const uint64_t fGuestControlFeatures0 = pGuest->i_getGuestControlFeatures0(); 1220 1221 /* Check if the Guest Additions support setting the current working directory for the new process 1222 * if the caller wants to set one, and bail out early if it doesn't. */ 1223 if ( !mData.mProcess.mCwd.isEmpty() 1224 && ( uProtocol < 2 1225 || !(fGuestControlFeatures0 & VBOX_GUESTCTRL_GF_0_PROCESS_CWD))) 1226 { 1227 LogRel2(("Guest Control: Installed Guest Addtions don't support setting the current working directory to '%s'!\n", 1228 mData.mProcess.mCwd.c_str())); 1229 return VERR_NOT_SUPPORTED; 1230 } 1231 1217 1232 size_t cbArgs = 0; 1218 1233 char *pszArgs = NULL; 1219 1234 int vrc = VINF_SUCCESS; 1235 1220 1236 if (cArgs) 1221 1237 { … … 1229 1245 } 1230 1246 papszArgv[cArgs] = NULL; 1231 1232 Guest *pGuest = mSession->i_getParent();1233 AssertPtr(pGuest);1234 1235 const uint64_t fGuestControlFeatures0 = pGuest->i_getGuestControlFeatures0();1236 1247 1237 1248 /* If the Guest Additions don't support using argv[0] correctly (< 6.1.x), don't supply it. */ … … 1299 1310 /* The actual CPU affinity blocks. */ 1300 1311 HGCMSvcSetPv(&paParms[i++], (void *)&mData.mProcess.mAffinity, sizeof(mData.mProcess.mAffinity)); 1312 /* Supply working directory, if guest supports it. */ 1313 if (fGuestControlFeatures0 & VBOX_GUESTCTRL_GF_0_PROCESS_CWD) 1314 HGCMSvcSetRTCStr(&paParms[i++], mData.mProcess.mCwd); 1301 1315 } 1302 1316 -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r98813 r99120 4943 4943 4944 4944 4945 HRESULT GuestSession::processCreate(const com::Utf8Str &aExecutable, const std::vector<com::Utf8Str> &aArguments, 4945 HRESULT GuestSession::processCreate(const com::Utf8Str &aExecutable, const com::Utf8Str &aCwd, 4946 const std::vector<com::Utf8Str> &aArguments, 4946 4947 const std::vector<com::Utf8Str> &aEnvironment, 4947 4948 const std::vector<ProcessCreateFlag_T> &aFlags, … … 4951 4952 4952 4953 std::vector<LONG> affinityIgnored; 4953 return processCreateEx(aExecutable, aArguments, aEnvironment, aFlags, aTimeoutMS, ProcessPriority_Default, 4954 affinityIgnored, aGuestProcess); 4955 } 4956 4957 HRESULT GuestSession::processCreateEx(const com::Utf8Str &aExecutable, const std::vector<com::Utf8Str> &aArguments, 4954 return processCreateEx(aExecutable, aCwd, aArguments, aEnvironment, aFlags, aTimeoutMS, 4955 ProcessPriority_Default, affinityIgnored, aGuestProcess); 4956 } 4957 4958 HRESULT GuestSession::processCreateEx(const com::Utf8Str &aExecutable, const com::Utf8Str &aCwd, 4959 const std::vector<com::Utf8Str> &aArguments, 4958 4960 const std::vector<com::Utf8Str> &aEnvironment, 4959 4961 const std::vector<ProcessCreateFlag_T> &aFlags, ULONG aTimeoutMS, … … 4978 4980 } 4979 4981 4982 uint32_t const uProtocol = i_getProtocolVersion(); 4983 uint64_t const fGuestControlFeatures0 = mParent->i_getGuestControlFeatures0(); 4984 4985 /* If a current working directory (CWD) is set, make sure that the installed Guest Additions actually 4986 * support this before doing anything else. */ 4987 if ( !aCwd.isEmpty() 4988 && ( uProtocol < 2 4989 || !(fGuestControlFeatures0 & VBOX_GUESTCTRL_GF_0_PROCESS_CWD))) 4990 return setError(VBOX_E_NOT_SUPPORTED, 4991 tr("Setting the current working directory is not supported by the installed Guest Addtions!")); 4992 4980 4993 /* The rest of the input is being validated in i_processCreateEx(). */ 4981 4994 … … 4996 5009 else /* If no arguments were given, add the executable as argv[0] by default. */ 4997 5010 procInfo.mArguments.push_back(procInfo.mExecutable); 5011 5012 /* Optional working directory */ 5013 procInfo.mCwd = aCwd; 4998 5014 4999 5015 /* Combine the environment changes associated with the ones passed in by
Note:
See TracChangeset
for help on using the changeset viewer.