VirtualBox

Ignore:
Timestamp:
Apr 21, 2010 11:18:32 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
60367
Message:

Guest Control: Update (first stuff for piping output).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestCtrl.cpp

    r28434 r28557  
    146146 * @returns VBox status code.
    147147 * @param   u32ClientId     The client id returned by VbglR3GuestCtrlConnect().
    148  * @param   ppvData
    149148 * @param   uNumParms
    150149 ** @todo Docs!
     
    223222
    224223
     224/**
     225 * Allocates and gets host data, based on the message id.
     226 *
     227 * This will block until data becomes available.
     228 *
     229 * @returns VBox status code.
     230 * @param   u32ClientId     The client id returned by VbglR3GuestCtrlConnect().
     231 * @param   uNumParms
     232 ** @todo Docs!
     233 */
     234VBGLR3DECL(int) VbglR3GuestCtrlExecGetHostCmdOutput(uint32_t  u32ClientId,    uint32_t  uNumParms,
     235                                                    uint32_t *puContext,      uint32_t *puPID,
     236                                                    uint32_t *puHandle,       uint32_t *puFlags)
     237{
     238    AssertPtr(puContext);
     239    AssertPtr(puPID);
     240
     241    VBoxGuestCtrlHGCMMsgExecOut Msg;
     242
     243    Msg.hdr.result = VERR_WRONG_ORDER;
     244    Msg.hdr.u32ClientID = u32ClientId;
     245    Msg.hdr.u32Function = GUEST_GET_HOST_MSG;
     246    Msg.hdr.cParms = uNumParms;
     247
     248    VbglHGCMParmUInt32Set(&Msg.context, 0); /** @todo Put this some header struct! */
     249    VbglHGCMParmUInt32Set(&Msg.pid, 0);
     250    VbglHGCMParmUInt32Set(&Msg.handle, 0);   
     251    VbglHGCMParmUInt32Set(&Msg.flags, 0);
     252
     253    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     254    if (RT_SUCCESS(rc))
     255    {
     256        int rc2 = Msg.hdr.result;
     257        if (RT_FAILURE(rc2))
     258        {
     259            rc = rc2;
     260        }
     261        else
     262        {
     263            Msg.context.GetUInt32(puContext);
     264            Msg.pid.GetUInt32(puPID);
     265            Msg.handle.GetUInt32(puHandle);
     266            Msg.flags.GetUInt32(puFlags);           
     267        }
     268    }
     269    return rc;
     270}
    225271
    226272
     
    262308}
    263309
     310
     311/**
     312 * Sends output (from stdout/stderr) from a running process.
     313 *
     314 * @returns VBox status code.
     315 ** @todo Docs!
     316 */
     317VBGLR3DECL(int) VbglR3GuestCtrlExecSendOut(uint32_t     u32ClientId,
     318                                           uint32_t     u32Context,
     319                                           uint32_t     u32PID,
     320                                           uint32_t     u32Handle,
     321                                           uint32_t     u32Flags,
     322                                           void        *pvData,
     323                                           uint32_t     cbData)
     324{
     325    VBoxGuestCtrlHGCMMsgExecOut Msg;
     326
     327    Msg.hdr.result = VERR_WRONG_ORDER;
     328    Msg.hdr.u32ClientID = u32ClientId;
     329    Msg.hdr.u32Function = GUEST_EXEC_SEND_OUTPUT;
     330    Msg.hdr.cParms = 5;
     331
     332    VbglHGCMParmUInt32Set(&Msg.context, u32Context);
     333    VbglHGCMParmUInt32Set(&Msg.pid, u32PID);
     334    VbglHGCMParmUInt32Set(&Msg.handle, u32Handle);
     335    VbglHGCMParmUInt32Set(&Msg.flags, u32Flags);
     336    VbglHGCMParmPtrSet(&Msg.data, pvData, cbData);
     337
     338    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     339    if (RT_SUCCESS(rc))
     340    {
     341        int rc2 = Msg.hdr.result;
     342        if (RT_FAILURE(rc2))
     343            rc = rc2;
     344    }
     345    return rc;
     346}
     347
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette