Changeset 28029 in vbox
- Timestamp:
- Apr 7, 2010 7:31:23 AM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestCtrl.cpp
r28014 r28029 157 157 uint32_t *puTimeLimit) 158 158 { 159 AssertPtr(pszCmd); 160 AssertPtr(puFlags); 161 AssertPtr(pszArgs); 162 AssertPtr(puNumArgs); 163 AssertPtr(pszEnv); 164 AssertPtr(pcbEnv); 165 AssertPtr(puNumEnvVars); 166 AssertPtr(pszStdIn); 167 AssertPtr(pszStdOut); 168 AssertPtr(pszStdOut); 169 AssertPtr(pszStdErr); 170 AssertPtr(pszUser); 171 AssertPtr(pszPassword); 172 AssertPtr(puTimeLimit); 173 159 174 VBoxGuestCtrlHGCMMsgExecCmd Msg; 160 175 … … 169 184 VbglHGCMParmPtrSet(&Msg.args, pszArgs, cbArgs); 170 185 VbglHGCMParmUInt32Set(&Msg.num_env, 0); 186 VbglHGCMParmUInt32Set(&Msg.cb_env, 0); 171 187 VbglHGCMParmPtrSet(&Msg.env, pszEnv, *pcbEnv); 172 188 VbglHGCMParmPtrSet(&Msg.std_in, pszStdIn, cbStdIn); … … 185 201 Msg.num_args.GetUInt32(puNumArgs); 186 202 Msg.num_env.GetUInt32(puNumEnvVars); 187 Msg.timeout.GetUInt32(puTimeLimit); 203 Msg.cb_env.GetUInt32(pcbEnv); 204 Msg.timeout.GetUInt32(puTimeLimit); 188 205 } 189 206 return rc; -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp
r28016 r28029 139 139 char *pcCur = execData.szEnv; 140 140 uint32_t i = 0; 141 while (pcCur < execData.szEnv + execData.cbEnv) 141 uint32_t cbLen = 0; 142 while (cbLen < execData.cbEnv) 142 143 { 143 144 if (RTStrAPrintf(&ppaEnv[i++], "%s", pcCur) < 0) … … 146 147 break; 147 148 } 148 pcCur += strlen(pcCur) + 1; /* Skip terminating zero. */ 149 cbLen += strlen(pcCur) + 1; /* Skip terminating zero. */ 150 pcCur += cbLen; 149 151 } 150 152 } … … 154 156 /* Do the actual execution. */ 155 157 rc = VBoxServiceControlExecProcess(&execData, ppaArg, ppaEnv); 156 for (uint32_t i = 0; i < execData.uNumEnvVars; i++) 157 RTStrFree(ppaEnv[i]); 158 RTMemFree(ppaEnv); 158 /* Cleanup. */ 159 if (execData.uNumEnvVars) 160 { 161 for (uint32_t i = 0; i < execData.uNumEnvVars; i++) 162 RTStrFree(ppaEnv[i]); 163 RTMemFree(ppaEnv); 164 } 159 165 } 160 166 RTGetOptArgvFree(ppaArg); -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp
r27926 r28029 515 515 for (i = 0; i < pExecData->uNumEnvVars; i++) 516 516 { 517 // @todo rc = RTEnvPutEx(hEnv, pExecData->[i]);517 rc = RTEnvPutEx(hEnv, papszEnv[i]); 518 518 if (RT_FAILURE(rc)) 519 519 break; -
trunk/src/VBox/Main/GuestImpl.cpp
r28012 r28029 493 493 494 494 void *pvEnv = NULL; 495 uint32_t uNumEnv = env.size();495 uint32_t uNumEnv = 0; 496 496 uint32_t cbEnv = 0; 497 497 498 for (unsigned i = 0; i < uNumEnv; i++)498 for (unsigned i = 0; i < env.size(); i++) 499 499 { 500 500 vrc = prepareExecuteEnv(Utf8Str(env[i]).raw(), &pvEnv, &cbEnv, &uNumEnv); … … 511 511 Utf8Str Utf8Password(aPassword); 512 512 513 VBOXHGCMSVCPARM paParms[1 3];513 VBOXHGCMSVCPARM paParms[14]; 514 514 int i = 0; 515 515 paParms[i++].setPointer((void*)Utf8Command.raw(), (uint32_t)strlen(Utf8Command.raw()) + 1); … … 518 518 paParms[i++].setPointer((void*)pszArgs, cbArgs); 519 519 paParms[i++].setUInt32(uNumEnv); 520 paParms[i++].setUInt32(cbEnv); 520 521 paParms[i++].setPointer((void*)pvEnv, cbEnv); 521 522 paParms[i++].setPointer((void*)Utf8StdIn.raw(), (uint32_t)strlen(Utf8StdIn.raw()) + 1);
Note:
See TracChangeset
for help on using the changeset viewer.