Changeset 38133 in vbox
- Timestamp:
- Jul 25, 2011 9:02:17 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/GuestControlSvc.h
r38085 r38133 4 4 5 5 /* 6 * Copyright (C) 201 0Oracle Corporation6 * Copyright (C) 2011 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 183 183 typedef CALLBACKDATAEXECINSTATUS *PCALLBACKDATAEXECINSTATUS; 184 184 185 typedef struct VBoxGuestCtrlCallbackDataDirOpen186 {187 /** Callback data header. */188 CALLBACKHEADER hdr;189 /** The native node id. */190 uint32_t u32Handle;191 } CALLBACKDATADIROPEN;192 typedef CALLBACKDATADIROPEN *PCALLBACKDATADIROPEN;193 194 typedef struct VBoxGuestCtrlCallbackDataDirRead195 {196 /** Callback data header. */197 CALLBACKHEADER hdr;198 /** The native node id. */199 uint64_t u64NodeId;200 /** The entry name. */201 char *pszName;202 /** Size (in bytes) of entry name. */203 uint32_t cbName;204 } CALLBACKDATADIRREAD;205 typedef CALLBACKDATADIRREAD *PCALLBACKDATADIRREAD;206 207 185 enum eVBoxGuestCtrlCallbackDataMagic 208 186 { … … 211 189 CALLBACKDATAMAGIC_EXEC_STATUS = 0x26011982, 212 190 CALLBACKDATAMAGIC_EXEC_OUT = 0x11061949, 213 CALLBACKDATAMAGIC_EXEC_IN_STATUS = 0x19091951, 214 215 CALLBACKDATAMAGIC_DIR_OPEN = 0x05031907, 216 CALLBACKDATAMAGIC_DIR_READ = 0x02041932 191 CALLBACKDATAMAGIC_EXEC_IN_STATUS = 0x19091951 217 192 }; 218 193 … … 223 198 VBOXGUESTCTRLCALLBACKTYPE_EXEC_START = 1, 224 199 VBOXGUESTCTRLCALLBACKTYPE_EXEC_OUTPUT = 2, 225 VBOXGUESTCTRLCALLBACKTYPE_EXEC_INPUT_STATUS = 3, 226 227 VBOXGUESTCTRLCALLBACKTYPE_DIR_OPEN = 100, 228 VBOXGUESTCTRLCALLBACKTYPE_DIR_READ = 105 200 VBOXGUESTCTRLCALLBACKTYPE_EXEC_INPUT_STATUS = 3 229 201 }; 230 202 … … 256 228 * new data on stdout/stderr, process terminated etc. 257 229 */ 258 HOST_EXEC_GET_OUTPUT = 102, 259 260 /* 261 * Directory handling. 262 */ 263 264 /** 265 * Opens a directory for reading. 266 */ 267 HOST_DIR_OPEN = 200, 268 /** 269 * Closes a formerly opened directory. 270 */ 271 HOST_DIR_CLOSE = 201, 272 /** 273 * Reads the next entry from an open directory. 274 */ 275 HOST_DIR_READ = 202 230 HOST_EXEC_GET_OUTPUT = 102 276 231 }; 277 232 … … 314 269 * Guests sends an input status notification to the host. 315 270 */ 316 GUEST_EXEC_SEND_INPUT_STATUS = 102, 317 318 /* 319 * Directory handling. 320 */ 321 322 /** 323 * Guest sends back the directory handle. 324 */ 325 GUEST_DIR_SEND_OPEN = 200, 326 /** 327 * Guest sends back the next directory entry. 328 */ 329 GUEST_DIR_SEND_READ = 202 271 GUEST_EXEC_SEND_INPUT_STATUS = 102 330 272 }; 331 273 … … 470 412 } VBoxGuestCtrlHGCMMsgExecStatusIn; 471 413 472 /**473 * Closes a formerly openend guest directory.474 */475 typedef struct VBoxGuestCtrlHGCMMsgDirClose476 {477 VBoxGuestHGCMCallInfo hdr;478 /** Context ID. */479 HGCMFunctionParameter context;480 /** Directory handle to close. */481 HGCMFunctionParameter handle;482 483 } VBoxGuestCtrlHGCMMsgDirClose;484 485 /**486 * Opens a guest directory for reading.487 */488 typedef struct VBoxGuestCtrlHGCMMsgDirOpen489 {490 VBoxGuestHGCMCallInfo hdr;491 /** Context ID. */492 HGCMFunctionParameter context;493 /** Directory (path) to open. */494 HGCMFunctionParameter directory;495 /** Filter (DOS style wildcard). */496 HGCMFunctionParameter filter;497 /** Open flags. */498 HGCMFunctionParameter flags;499 /** The user name to run the executed command under. */500 HGCMFunctionParameter username;501 /** The user's password. */502 HGCMFunctionParameter password;503 /** OUT: Handle for opened directory. */504 HGCMFunctionParameter handle;505 506 } VBoxGuestCtrlHGCMMsgDirOpen;507 508 /**509 * Reads next entry of an open guest directory.510 */511 typedef struct VBoxGuestCtrlHGCMMsgDirRead512 {513 VBoxGuestHGCMCallInfo hdr;514 /** Context ID. */515 HGCMFunctionParameter context;516 /** Directory handle to read from. */517 HGCMFunctionParameter handle;518 519 } VBoxGuestCtrlHGCMMsgDirRead;520 521 414 #pragma pack () 522 415 -
trunk/include/VBox/VBoxGuestLib.h
r37375 r38133 549 549 VBGLR3DECL(int) VbglR3GuestCtrlWaitForHostMsg(uint32_t u32ClientId, uint32_t *puMsg, uint32_t *puNumParms); 550 550 VBGLR3DECL(int) VbglR3GuestCtrlCancelPendingWaits(uint32_t u32ClientId); 551 552 VBGLR3DECL(int) VbglR3GuestCtrlGetCmdDirClose(uint32_t u32ClientId, uint32_t uNumParms,553 uint32_t *puContext, uint32_t *puHandle);554 VBGLR3DECL(int) VbglR3GuestCtrlGetCmdDirOpen(uint32_t u32ClientId, uint32_t uNumParms,555 uint32_t *puContext,556 char *pszDir, uint32_t cbDir,557 char *pszFilter, uint32_t cbFilter,558 uint32_t *puFlags,559 char *pszUser, uint32_t cbUser,560 char *pszPassword, uint32_t cbPassword);561 VBGLR3DECL(int) VbglR3GuestCtrlGetCmdDirRead(uint32_t u32ClientId, uint32_t uNumParms,562 uint32_t *puContext, uint32_t *puHandle);563 564 551 VBGLR3DECL(int) VbglR3GuestCtrlExecGetHostCmd(uint32_t u32ClientId, uint32_t uNumParms, 565 552 uint32_t *puContext, -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestCtrl.cpp
r37375 r38133 152 152 if (RT_FAILURE(rc2)) 153 153 rc = rc2; 154 }155 return rc;156 }157 158 159 /**160 * Closes a formerly opened guest directory.161 *162 * @return IPRT status code.163 ** @todo Docs!164 */165 VBGLR3DECL(int) VbglR3GuestCtrlGetCmdDirClose(uint32_t u32ClientId, uint32_t uNumParms,166 uint32_t *puContext, uint32_t *puHandle)167 {168 AssertPtrReturn(puContext, VERR_INVALID_PARAMETER);169 AssertPtrReturn(puHandle, VERR_INVALID_PARAMETER);170 171 VBoxGuestCtrlHGCMMsgDirClose Msg;172 173 Msg.hdr.result = VERR_WRONG_ORDER;174 Msg.hdr.u32ClientID = u32ClientId;175 Msg.hdr.u32Function = GUEST_GET_HOST_MSG;176 Msg.hdr.cParms = uNumParms;177 178 VbglHGCMParmUInt32Set(&Msg.context, 0);179 VbglHGCMParmUInt32Set(&Msg.handle, 0);180 181 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));182 if (RT_SUCCESS(rc))183 {184 int rc2 = Msg.hdr.result;185 if (RT_FAILURE(rc2))186 {187 rc = rc2;188 }189 else190 {191 Msg.context.GetUInt32(puContext);192 Msg.handle.GetUInt32(puHandle);193 }194 }195 return rc;196 }197 198 199 /**200 * Opens a guest directory for reading.201 *202 * @return IPRT status code.203 ** @todo Docs!204 */205 VBGLR3DECL(int) VbglR3GuestCtrlGetCmdDirOpen(uint32_t u32ClientId, uint32_t uNumParms,206 uint32_t *puContext,207 char *pszDir, uint32_t cbDir,208 char *pszFilter, uint32_t cbFilter,209 uint32_t *puFlags,210 char *pszUser, uint32_t cbUser,211 char *pszPassword, uint32_t cbPassword)212 {213 AssertPtrReturn(pszDir, VERR_INVALID_PARAMETER);214 AssertPtrReturn(pszFilter, VERR_INVALID_PARAMETER);215 AssertPtrReturn(puFlags, VERR_INVALID_PARAMETER);216 AssertPtrReturn(pszUser, VERR_INVALID_PARAMETER);217 AssertPtrReturn(pszPassword, VERR_INVALID_PARAMETER);218 219 VBoxGuestCtrlHGCMMsgDirOpen Msg;220 221 Msg.hdr.result = VERR_WRONG_ORDER;222 Msg.hdr.u32ClientID = u32ClientId;223 Msg.hdr.u32Function = GUEST_GET_HOST_MSG;224 Msg.hdr.cParms = uNumParms;225 226 VbglHGCMParmUInt32Set(&Msg.context, 0);227 VbglHGCMParmPtrSet(&Msg.directory, pszDir, cbDir);228 VbglHGCMParmPtrSet(&Msg.filter, pszFilter, cbFilter);229 VbglHGCMParmUInt32Set(&Msg.flags, 0);230 VbglHGCMParmPtrSet(&Msg.username, pszUser, cbUser);231 VbglHGCMParmPtrSet(&Msg.password, pszPassword, cbPassword);232 233 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));234 if (RT_SUCCESS(rc))235 {236 int rc2 = Msg.hdr.result;237 if (RT_FAILURE(rc2))238 {239 rc = rc2;240 }241 else242 {243 Msg.context.GetUInt32(puContext);244 Msg.flags.GetUInt32(puFlags);245 }246 }247 return rc;248 }249 250 251 /**252 * Opens a guest directory for reading.253 *254 * @return IPRT status code.255 ** @todo Docs!256 */257 VBGLR3DECL(int) VbglR3GuestCtrlGetCmdDirRead(uint32_t u32ClientId, uint32_t uNumParms,258 uint32_t *puContext, uint32_t *puHandle)259 {260 AssertPtrReturn(puContext, VERR_INVALID_PARAMETER);261 AssertPtrReturn(puHandle, VERR_INVALID_PARAMETER);262 263 VBoxGuestCtrlHGCMMsgDirRead Msg;264 265 Msg.hdr.result = VERR_WRONG_ORDER;266 Msg.hdr.u32ClientID = u32ClientId;267 Msg.hdr.u32Function = GUEST_GET_HOST_MSG;268 Msg.hdr.cParms = uNumParms;269 270 VbglHGCMParmUInt32Set(&Msg.context, 0);271 VbglHGCMParmUInt32Set(&Msg.handle, 0);272 273 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));274 if (RT_SUCCESS(rc))275 {276 int rc2 = Msg.hdr.result;277 if (RT_FAILURE(rc2))278 {279 rc = rc2;280 }281 else282 {283 Msg.context.GetUInt32(puContext);284 Msg.handle.GetUInt32(puHandle);285 }286 154 } 287 155 return rc; -
trunk/src/VBox/Additions/common/VBoxService/Makefile.kmk
r37375 r38133 69 69 VBoxService_SOURCES += \ 70 70 VBoxServiceControl.cpp \ 71 VBoxServiceControlDir.cpp \72 71 VBoxServiceControlExec.cpp \ 73 72 VBoxServiceControlExecThread.cpp \ -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp
r37375 r38133 162 162 case HOST_EXEC_GET_OUTPUT: 163 163 rc = VBoxServiceControlExecHandleCmdGetOutput(g_GuestControlSvcClientID, uNumParms); 164 break;165 166 case HOST_DIR_CLOSE:167 rc = VBoxServiceGCtrlDirClose(g_GuestControlSvcClientID, uNumParms);168 break;169 170 case HOST_DIR_OPEN:171 rc = VBoxServiceGCtrlDirOpen(g_GuestControlSvcClientID, uNumParms);172 break;173 174 case HOST_DIR_READ:175 rc = VBoxServiceGCtrlDirRead(g_GuestControlSvcClientID, uNumParms);176 164 break; 177 165 -
trunk/src/VBox/HostServices/GuestControl/service.cpp
r37375 r38133 762 762 (void *)(&data), sizeof(data)); 763 763 } 764 else if ( eFunction == GUEST_DIR_SEND_OPEN765 && cParms == 2)766 {767 CALLBACKDATADIROPEN data;768 data.hdr.u32Magic = CALLBACKDATAMAGIC_DIR_OPEN;769 paParms[0].getUInt32(&data.hdr.u32ContextID);770 771 paParms[1].getUInt32(&data.u32Handle);772 773 if (mpfnHostCallback)774 rc = mpfnHostCallback(mpvHostData, eFunction,775 (void *)(&data), sizeof(data));776 }777 else if ( eFunction == GUEST_DIR_SEND_READ778 && cParms == 3)779 {780 CALLBACKDATADIRREAD data;781 data.hdr.u32Magic = CALLBACKDATAMAGIC_DIR_READ;782 paParms[0].getUInt32(&data.hdr.u32ContextID);783 784 paParms[1].getUInt64(&data.u64NodeId);785 paParms[2].getString(&data.pszName, &data.cbName);786 787 if (mpfnHostCallback)788 rc = mpfnHostCallback(mpvHostData, eFunction,789 (void *)(&data), sizeof(data));790 }791 764 else 792 765 rc = VERR_NOT_SUPPORTED; -
trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp
r38085 r38133 3387 3387 */ 3388 3388 3389 /* We need to get output which is machine-readable in form 3390 * of "key=value\0..key=value\0\0". */ 3391 args.push_back(Bstr("--machinereadable").raw()); 3392 3389 3393 /* Only the actual file name to chekc is needed for now. */ 3390 3394 args.push_back(Bstr(Utf8File).raw()); … … 3548 3552 { 3549 3553 rc = this->GetProcessOutput(uPID, ProcessOutputFlag_None, 3550 30 * 1000 /* Timeout in ms */,3554 10 * 1000 /* Timeout in ms */, 3551 3555 _64K, ComSafeArrayAsOutParam(aOutputData)); 3552 3556 /** @todo Do stream header validation! */ … … 3557 3561 if (RT_UNLIKELY(RT_FAILURE(vrc))) 3558 3562 rc = setError(VBOX_E_IPRT_ERROR, 3559 tr("Error while adding guest output to stream buffer (%Rrc)"), vrc); 3563 tr("Query file size: Error while adding guest output to stream buffer for file \"%s\" (%Rrc)"), 3564 Utf8File.c_str(), vrc); 3560 3565 } 3561 else 3566 else /* No more output! */ 3562 3567 break; 3563 3568 } … … 3575 3580 else 3576 3581 rc = setError(VBOX_E_IPRT_ERROR, 3577 tr("Unable to retrieve file size (%Rrc)"), vrc); 3582 tr("Query file size: Unable to retrieve file size for file \"%s\" (%Rrc)"), 3583 Utf8File.c_str(), vrc); 3578 3584 } 3579 3585 else 3580 3586 rc = setError(VBOX_E_IPRT_ERROR, 3581 tr("Error while parsing guest output (%Rrc)"), vrc); 3587 tr("Query file size: Error while parsing guest output for file \"%s\" (%Rrc)"), 3588 Utf8File.c_str(), vrc); 3582 3589 } 3583 3590 } 3584 3591 else 3585 3592 rc = setError(VBOX_E_IPRT_ERROR, 3586 tr(" Error querying file size for file \"%s\" (exit code %u)"),3593 tr("Query file size: Error querying file size for file \"%s\" (exit code %u)"), 3587 3594 Utf8File.c_str(), uRetExitCode); 3588 3595 } … … 3591 3598 else if (fCanceled) 3592 3599 rc = setError(VBOX_E_IPRT_ERROR, 3593 tr(" Checking for file existence was aborted"));3600 tr("Query file size: Checking for file size was aborted")); 3594 3601 else 3595 AssertReleaseMsgFailed(("Checking for file existence neither completed nor canceled!?\n"));3602 AssertReleaseMsgFailed(("Checking for file size neither completed nor canceled!?\n")); 3596 3603 } 3597 3604 }
Note:
See TracChangeset
for help on using the changeset viewer.