VirtualBox

Changeset 45109 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Mar 20, 2013 4:41:00 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
84401
Message:

GuestCtrl: More stuff for IGuestFile and IGuestSession handling (work in progress).

Location:
trunk/src/VBox/Additions/common
Files:
5 edited

Legend:

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

    r45018 r45109  
    186186
    187187
    188 VBGLR3DECL(int) VbglR3GuestCtrlSessionNotify(uint32_t uClientId, uint32_t uContext,
     188VBGLR3DECL(int) VbglR3GuestCtrlSessionNotify(PVBGLR3GUESTCTRLCMDCTX pCtx,
    189189                                             uint32_t uType, uint32_t uResult)
    190190{
     191    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     192
    191193    HGCMMsgSessionNotify Msg;
    192194
    193195    Msg.hdr.result      = VERR_WRONG_ORDER;
    194     Msg.hdr.u32ClientID = uClientId;
     196    Msg.hdr.u32ClientID = pCtx->uClientID;
    195197    Msg.hdr.u32Function = GUEST_SESSION_NOTIFY;
    196198    Msg.hdr.cParms      = 3;
    197199
    198     VbglHGCMParmUInt32Set(&Msg.context, uContext);
     200    VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID);
    199201    VbglHGCMParmUInt32Set(&Msg.type, uType);
    200202    VbglHGCMParmUInt32Set(&Msg.result, uResult);
     
    215217 *
    216218 * @return  IPRT status code.
    217  * @param   pHostCtx                    Host context.
     219 * @param   pCtx                    Host context.
    218220 ** @todo Docs!
    219221 */
    220 VBGLR3DECL(int) VbglR3GuestCtrlSessionGetOpen(PVBGLR3GUESTCTRLHOSTCTX pHostCtx,
     222VBGLR3DECL(int) VbglR3GuestCtrlSessionGetOpen(PVBGLR3GUESTCTRLCMDCTX pCtx,
    221223                                              uint32_t *puProtocol,
    222224                                              char     *pszUser,     uint32_t  cbUser,
     
    225227                                              uint32_t *puFlags,     uint32_t *puSessionID)
    226228{
    227     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    228     AssertReturn(pHostCtx->uNumParms == 6, VERR_INVALID_PARAMETER);
     229    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     230    AssertReturn(pCtx->uNumParms == 6, VERR_INVALID_PARAMETER);
    229231
    230232    AssertPtrReturn(puProtocol, VERR_INVALID_POINTER);
     
    237239
    238240    Msg.hdr.result      = VERR_WRONG_ORDER;
    239     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    240     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    241     Msg.hdr.cParms      = pHostCtx->uNumParms;
     241    Msg.hdr.u32ClientID = pCtx->uClientID;
     242    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     243    Msg.hdr.cParms      = pCtx->uNumParms;
    242244
    243245    VbglHGCMParmUInt32Set(&Msg.context, 0);
     
    258260        else
    259261        {
    260             Msg.context.GetUInt32(&pHostCtx->uContextID);
     262            Msg.context.GetUInt32(&pCtx->uContextID);
    261263            Msg.protocol.GetUInt32(puProtocol);
    262264            Msg.flags.GetUInt32(puFlags);
    263265
    264266            if (puSessionID)
    265                 *puSessionID = VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(pHostCtx->uContextID);
     267                *puSessionID = VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(pCtx->uContextID);
    266268        }
    267269    }
     
    275277 *
    276278 * @return  IPRT status code.
    277  * @param   pHostCtx                    Host context.
     279 * @param   pCtx                    Host context.
    278280 ** @todo Docs!
    279281 */
    280 VBGLR3DECL(int) VbglR3GuestCtrlSessionGetClose(PVBGLR3GUESTCTRLHOSTCTX pHostCtx, uint32_t *puFlags, uint32_t *puSessionID)
    281 {
    282     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    283     AssertReturn(pHostCtx->uNumParms == 2, VERR_INVALID_PARAMETER);
     282VBGLR3DECL(int) VbglR3GuestCtrlSessionGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puFlags, uint32_t *puSessionID)
     283{
     284    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     285    AssertReturn(pCtx->uNumParms == 2, VERR_INVALID_PARAMETER);
    284286
    285287    AssertPtrReturn(puFlags, VERR_INVALID_POINTER);
     
    288290
    289291    Msg.hdr.result      = VERR_WRONG_ORDER;
    290     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    291     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    292     Msg.hdr.cParms      = pHostCtx->uNumParms;
     292    Msg.hdr.u32ClientID = pCtx->uClientID;
     293    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     294    Msg.hdr.cParms      = pCtx->uNumParms;
    293295
    294296    VbglHGCMParmUInt32Set(&Msg.context, 0);
     
    305307        else
    306308        {
    307             Msg.context.GetUInt32(&pHostCtx->uContextID);
     309            Msg.context.GetUInt32(&pCtx->uContextID);
    308310            Msg.flags.GetUInt32(puFlags);
    309311
    310312            if (puSessionID)
    311                 *puSessionID = VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(pHostCtx->uContextID);
     313                *puSessionID = VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(pCtx->uContextID);
    312314        }
    313315    }
     
    326328 ** @todo Move the parameters in an own struct!
    327329 */
    328 VBGLR3DECL(int) VbglR3GuestCtrlProcGetStart(PVBGLR3GUESTCTRLHOSTCTX   pHostCtx,
     330VBGLR3DECL(int) VbglR3GuestCtrlProcGetStart(PVBGLR3GUESTCTRLCMDCTX   pCtx,
    329331                                            char     *pszCmd,         uint32_t  cbCmd,
    330332                                            uint32_t *puFlags,
     
    337339                                            uint64_t *puAffinity,     uint32_t  cbAffinity, uint32_t *pcAffinity)
    338340{
    339     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
     341    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
    340342
    341343    AssertPtrReturn(pszCmd, VERR_INVALID_POINTER);
     
    351353
    352354    Msg.hdr.result      = VERR_WRONG_ORDER;
    353     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    354     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    355     Msg.hdr.cParms      = pHostCtx->uNumParms;
     355    Msg.hdr.u32ClientID = pCtx->uClientID;
     356    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     357    Msg.hdr.cParms      = pCtx->uNumParms;
    356358
    357359    VbglHGCMParmUInt32Set(&Msg.context, 0);
     
    363365    VbglHGCMParmUInt32Set(&Msg.cb_env, 0);
    364366    VbglHGCMParmPtrSet(&Msg.env, pszEnv, *pcbEnv);
    365     if (pHostCtx->uProtocol < 2)
     367    if (pCtx->uProtocol < 2)
    366368    {
    367369        AssertPtrReturn(pszUser, VERR_INVALID_POINTER);
     
    395397        else
    396398        {
    397             Msg.context.GetUInt32(&pHostCtx->uContextID);
     399            Msg.context.GetUInt32(&pCtx->uContextID);
    398400            Msg.flags.GetUInt32(puFlags);
    399401            Msg.num_args.GetUInt32(pcArgs);
    400402            Msg.num_env.GetUInt32(pcEnvVars);
    401403            Msg.cb_env.GetUInt32(pcbEnv);
    402             if (pHostCtx->uProtocol < 2)
     404            if (pCtx->uProtocol < 2)
    403405            {
    404406                Msg.u.v1.timeout.GetUInt32(puTimeoutMS);
     
    424426 ** @todo Docs!
    425427 */
    426 VBGLR3DECL(int) VbglR3GuestCtrlProcGetOutput(PVBGLR3GUESTCTRLHOSTCTX pHostCtx,
     428VBGLR3DECL(int) VbglR3GuestCtrlProcGetOutput(PVBGLR3GUESTCTRLCMDCTX pCtx,
    427429                                             uint32_t *puPID, uint32_t *puHandle, uint32_t *puFlags)
    428430{
    429     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    430     AssertReturn(pHostCtx->uNumParms == 4, VERR_INVALID_PARAMETER);
     431    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     432    AssertReturn(pCtx->uNumParms == 4, VERR_INVALID_PARAMETER);
    431433
    432434    AssertPtrReturn(puPID, VERR_INVALID_POINTER);
     
    437439
    438440    Msg.hdr.result = VERR_WRONG_ORDER;
    439     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    440     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    441     Msg.hdr.cParms      = pHostCtx->uNumParms;
     441    Msg.hdr.u32ClientID = pCtx->uClientID;
     442    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     443    Msg.hdr.cParms      = pCtx->uNumParms;
    442444
    443445    VbglHGCMParmUInt32Set(&Msg.context, 0);
     
    456458        else
    457459        {
    458             Msg.context.GetUInt32(&pHostCtx->uContextID);
     460            Msg.context.GetUInt32(&pCtx->uContextID);
    459461            Msg.pid.GetUInt32(puPID);
    460462            Msg.handle.GetUInt32(puHandle);
     
    475477 ** @todo Docs!
    476478 */
    477 VBGLR3DECL(int) VbglR3GuestCtrlProcGetInput(PVBGLR3GUESTCTRLHOSTCTX pHostCtx,
     479VBGLR3DECL(int) VbglR3GuestCtrlProcGetInput(PVBGLR3GUESTCTRLCMDCTX pCtx,
    478480                                            uint32_t  *puPID,       uint32_t *puFlags,
    479481                                            void      *pvData,      uint32_t  cbData,
    480482                                            uint32_t  *pcbSize)
    481483{
    482     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    483     AssertReturn(pHostCtx->uNumParms == 5, VERR_INVALID_PARAMETER);
     484    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     485    AssertReturn(pCtx->uNumParms == 5, VERR_INVALID_PARAMETER);
    484486
    485487    AssertPtrReturn(puPID, VERR_INVALID_POINTER);
     
    491493
    492494    Msg.hdr.result      = VERR_WRONG_ORDER;
    493     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    494     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    495     Msg.hdr.cParms      = pHostCtx->uNumParms;
     495    Msg.hdr.u32ClientID = pCtx->uClientID;
     496    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     497    Msg.hdr.cParms      = pCtx->uNumParms;
    496498
    497499    VbglHGCMParmUInt32Set(&Msg.context, 0);
     
    511513        else
    512514        {
    513             Msg.context.GetUInt32(&pHostCtx->uContextID);
     515            Msg.context.GetUInt32(&pCtx->uContextID);
    514516            Msg.pid.GetUInt32(puPID);
    515517            Msg.flags.GetUInt32(puFlags);
     
    521523
    522524
    523 VBGLR3DECL(int) VbglR3GuestCtrlFileGetOpen(PVBGLR3GUESTCTRLHOSTCTX      pHostCtx,
     525VBGLR3DECL(int) VbglR3GuestCtrlFileGetOpen(PVBGLR3GUESTCTRLCMDCTX      pCtx,
    524526                                           char     *pszFileName,       uint32_t cbFileName,
    525527                                           char     *pszOpenMode,       uint32_t cbOpenMode,
     
    528530                                           uint64_t *puOffset)
    529531{
    530     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    531     AssertReturn(pHostCtx->uNumParms == 6, VERR_INVALID_PARAMETER);
     532    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     533    AssertReturn(pCtx->uNumParms == 6, VERR_INVALID_PARAMETER);
    532534
    533535    AssertPtrReturn(pszFileName, VERR_INVALID_POINTER);
     
    543545
    544546    Msg.hdr.result      = VERR_WRONG_ORDER;
    545     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    546     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    547     Msg.hdr.cParms      = pHostCtx->uNumParms;
     547    Msg.hdr.u32ClientID = pCtx->uClientID;
     548    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     549    Msg.hdr.cParms      = pCtx->uNumParms;
    548550
    549551    VbglHGCMParmUInt32Set(&Msg.context, 0);
     
    564566        else
    565567        {
    566             Msg.context.GetUInt32(&pHostCtx->uContextID);
     568            Msg.context.GetUInt32(&pCtx->uContextID);
    567569            Msg.creationmode.GetUInt32(puCreationMode);
    568570            Msg.offset.GetUInt64(puOffset);
     
    573575
    574576
    575 VBGLR3DECL(int) VbglR3GuestCtrlFileGetClose(PVBGLR3GUESTCTRLHOSTCTX pHostCtx, uint32_t *puHandle)
    576 {
    577     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    578 
    579     AssertReturn(pHostCtx->uNumParms == 2, VERR_INVALID_PARAMETER);
     577VBGLR3DECL(int) VbglR3GuestCtrlFileGetClose(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle)
     578{
     579    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     580
     581    AssertReturn(pCtx->uNumParms == 2, VERR_INVALID_PARAMETER);
    580582    AssertPtrReturn(puHandle, VERR_INVALID_POINTER);
    581583
     
    583585
    584586    Msg.hdr.result      = VERR_WRONG_ORDER;
    585     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    586     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    587     Msg.hdr.cParms      = pHostCtx->uNumParms;
     587    Msg.hdr.u32ClientID = pCtx->uClientID;
     588    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     589    Msg.hdr.cParms      = pCtx->uNumParms;
    588590
    589591    VbglHGCMParmUInt32Set(&Msg.context, 0);
     
    600602        else
    601603        {
    602             Msg.context.GetUInt32(&pHostCtx->uContextID);
     604            Msg.context.GetUInt32(&pCtx->uContextID);
    603605            Msg.handle.GetUInt32(puHandle);
    604606        }
     
    608610
    609611
    610 VBGLR3DECL(int) VbglR3GuestCtrlFileGetRead(PVBGLR3GUESTCTRLHOSTCTX pHostCtx,
     612VBGLR3DECL(int) VbglR3GuestCtrlFileGetRead(PVBGLR3GUESTCTRLCMDCTX pCtx,
    611613                                           uint32_t *puHandle, uint32_t *puToRead)
    612614{
    613     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    614 
    615     AssertReturn(pHostCtx->uNumParms == 4, VERR_INVALID_PARAMETER);
     615    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     616
     617    AssertReturn(pCtx->uNumParms == 3, VERR_INVALID_PARAMETER);
    616618    AssertPtrReturn(puHandle, VERR_INVALID_POINTER);
    617619    AssertPtrReturn(puToRead, VERR_INVALID_POINTER);
     
    620622
    621623    Msg.hdr.result      = VERR_WRONG_ORDER;
    622     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    623     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    624     Msg.hdr.cParms      = pHostCtx->uNumParms;
     624    Msg.hdr.u32ClientID = pCtx->uClientID;
     625    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     626    Msg.hdr.cParms      = pCtx->uNumParms;
    625627
    626628    VbglHGCMParmUInt32Set(&Msg.context, 0);
     
    638640        else
    639641        {
    640             Msg.context.GetUInt32(&pHostCtx->uContextID);
     642            Msg.context.GetUInt32(&pCtx->uContextID);
    641643            Msg.handle.GetUInt32(puHandle);
    642644            Msg.size.GetUInt32(puToRead);
     
    647649
    648650
    649 VBGLR3DECL(int) VbglR3GuestCtrlFileGetReadAt(PVBGLR3GUESTCTRLHOSTCTX pHostCtx,
     651VBGLR3DECL(int) VbglR3GuestCtrlFileGetReadAt(PVBGLR3GUESTCTRLCMDCTX pCtx,
    650652                                             uint32_t *puHandle, uint32_t *puToRead, uint64_t *puOffset)
    651653{
    652     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    653 
    654     AssertReturn(pHostCtx->uNumParms == 5, VERR_INVALID_PARAMETER);
     654    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     655
     656    AssertReturn(pCtx->uNumParms == 4, VERR_INVALID_PARAMETER);
    655657    AssertPtrReturn(puHandle, VERR_INVALID_POINTER);
    656658    AssertPtrReturn(puToRead, VERR_INVALID_POINTER);
    657659
    658     HGCMMsgFileRead Msg;
    659 
    660     Msg.hdr.result      = VERR_WRONG_ORDER;
    661     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    662     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    663     Msg.hdr.cParms      = pHostCtx->uNumParms;
     660    HGCMMsgFileReadAt Msg;
     661
     662    Msg.hdr.result      = VERR_WRONG_ORDER;
     663    Msg.hdr.u32ClientID = pCtx->uClientID;
     664    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     665    Msg.hdr.cParms      = pCtx->uNumParms;
    664666
    665667    VbglHGCMParmUInt32Set(&Msg.context, 0);
    666668    VbglHGCMParmUInt32Set(&Msg.handle, 0);
     669    VbglHGCMParmUInt32Set(&Msg.offset, 0);
    667670    VbglHGCMParmUInt32Set(&Msg.size, 0);
    668671
     
    677680        else
    678681        {
    679             Msg.context.GetUInt32(&pHostCtx->uContextID);
     682            Msg.context.GetUInt32(&pCtx->uContextID);
    680683            Msg.handle.GetUInt32(puHandle);
     684            Msg.offset.GetUInt64(puOffset);
    681685            Msg.size.GetUInt32(puToRead);
    682686        }
     
    686690
    687691
    688 VBGLR3DECL(int) VbglR3GuestCtrlFileGetWrite(PVBGLR3GUESTCTRLHOSTCTX pHostCtx, uint32_t *puHandle,
     692VBGLR3DECL(int) VbglR3GuestCtrlFileGetWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
    689693                                            void *pvData, uint32_t cbData, uint32_t *pcbSize)
    690694{
    691     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    692 
    693     AssertReturn(pHostCtx->uNumParms == 4, VERR_INVALID_PARAMETER);
     695    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     696
     697    AssertReturn(pCtx->uNumParms == 4, VERR_INVALID_PARAMETER);
    694698    AssertPtrReturn(puHandle, VERR_INVALID_POINTER);
    695699    AssertPtrReturn(pvData, VERR_INVALID_POINTER);
     
    700704
    701705    Msg.hdr.result      = VERR_WRONG_ORDER;
    702     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    703     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    704     Msg.hdr.cParms      = pHostCtx->uNumParms;
     706    Msg.hdr.u32ClientID = pCtx->uClientID;
     707    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     708    Msg.hdr.cParms      = pCtx->uNumParms;
    705709
    706710    VbglHGCMParmUInt32Set(&Msg.context, 0);
     
    719723        else
    720724        {
    721             Msg.context.GetUInt32(&pHostCtx->uContextID);
     725            Msg.context.GetUInt32(&pCtx->uContextID);
    722726            Msg.handle.GetUInt32(puHandle);
    723727            Msg.size.GetUInt32(pcbSize);
     
    728732
    729733
    730 VBGLR3DECL(int) VbglR3GuestCtrlFileGetWriteAt(PVBGLR3GUESTCTRLHOSTCTX pHostCtx, uint32_t *puHandle,
     734VBGLR3DECL(int) VbglR3GuestCtrlFileGetWriteAt(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle,
    731735                                              void *pvData, uint32_t cbData, uint32_t *pcbSize, uint64_t *puOffset)
    732736{
    733     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    734 
    735     AssertReturn(pHostCtx->uNumParms == 5, VERR_INVALID_PARAMETER);
     737    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     738
     739    AssertReturn(pCtx->uNumParms == 5, VERR_INVALID_PARAMETER);
    736740    AssertPtrReturn(puHandle, VERR_INVALID_POINTER);
    737741    AssertPtrReturn(pvData, VERR_INVALID_POINTER);
     
    742746
    743747    Msg.hdr.result      = VERR_WRONG_ORDER;
    744     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    745     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    746     Msg.hdr.cParms      = pHostCtx->uNumParms;
     748    Msg.hdr.u32ClientID = pCtx->uClientID;
     749    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     750    Msg.hdr.cParms      = pCtx->uNumParms;
    747751
    748752    VbglHGCMParmUInt32Set(&Msg.context, 0);
     
    762766        else
    763767        {
    764             Msg.context.GetUInt32(&pHostCtx->uContextID);
     768            Msg.context.GetUInt32(&pCtx->uContextID);
    765769            Msg.handle.GetUInt32(puHandle);
    766770            Msg.size.GetUInt32(pcbSize);
     
    771775
    772776
    773 VBGLR3DECL(int) VbglR3GuestCtrlFileGetSeek(PVBGLR3GUESTCTRLHOSTCTX pHostCtx,
     777VBGLR3DECL(int) VbglR3GuestCtrlFileGetSeek(PVBGLR3GUESTCTRLCMDCTX pCtx,
    774778                                           uint32_t *puHandle, uint32_t *puSeekMethod, uint64_t *puOffset)
    775779{
    776     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    777 
    778     AssertReturn(pHostCtx->uNumParms == 4, VERR_INVALID_PARAMETER);
     780    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     781
     782    AssertReturn(pCtx->uNumParms == 4, VERR_INVALID_PARAMETER);
    779783    AssertPtrReturn(puHandle, VERR_INVALID_POINTER);
    780784    AssertPtrReturn(puSeekMethod, VERR_INVALID_POINTER);
     
    784788
    785789    Msg.hdr.result      = VERR_WRONG_ORDER;
    786     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    787     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    788     Msg.hdr.cParms      = pHostCtx->uNumParms;
     790    Msg.hdr.u32ClientID = pCtx->uClientID;
     791    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     792    Msg.hdr.cParms      = pCtx->uNumParms;
    789793
    790794    VbglHGCMParmUInt32Set(&Msg.context, 0);
     
    803807        else
    804808        {
    805             Msg.context.GetUInt32(&pHostCtx->uContextID);
     809            Msg.context.GetUInt32(&pCtx->uContextID);
    806810            Msg.handle.GetUInt32(puHandle);
    807811            Msg.method.GetUInt32(puSeekMethod);
     
    813817
    814818
    815 VBGLR3DECL(int) VbglR3GuestCtrlFileGetTell(PVBGLR3GUESTCTRLHOSTCTX pHostCtx, uint32_t *puHandle)
    816 {
    817     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    818 
    819     AssertReturn(pHostCtx->uNumParms == 2, VERR_INVALID_PARAMETER);
     819VBGLR3DECL(int) VbglR3GuestCtrlFileGetTell(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle)
     820{
     821    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     822
     823    AssertReturn(pCtx->uNumParms == 2, VERR_INVALID_PARAMETER);
    820824    AssertPtrReturn(puHandle, VERR_INVALID_POINTER);
    821825
     
    823827
    824828    Msg.hdr.result      = VERR_WRONG_ORDER;
    825     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    826     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    827     Msg.hdr.cParms      = pHostCtx->uNumParms;
     829    Msg.hdr.u32ClientID = pCtx->uClientID;
     830    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     831    Msg.hdr.cParms      = pCtx->uNumParms;
    828832
    829833    VbglHGCMParmUInt32Set(&Msg.context, 0);
     
    840844        else
    841845        {
    842             Msg.context.GetUInt32(&pHostCtx->uContextID);
     846            Msg.context.GetUInt32(&pCtx->uContextID);
    843847            Msg.handle.GetUInt32(puHandle);
    844848        }
     
    848852
    849853
    850 VBGLR3DECL(int) VbglR3GuestCtrlProcGetTerminate(PVBGLR3GUESTCTRLHOSTCTX pHostCtx, uint32_t *puPID)
    851 {
    852     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    853 
    854     AssertReturn(pHostCtx->uNumParms == 2, VERR_INVALID_PARAMETER);
     854VBGLR3DECL(int) VbglR3GuestCtrlProcGetTerminate(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puPID)
     855{
     856    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     857
     858    AssertReturn(pCtx->uNumParms == 2, VERR_INVALID_PARAMETER);
    855859    AssertPtrReturn(puPID, VERR_INVALID_POINTER);
    856860
     
    858862
    859863    Msg.hdr.result      = VERR_WRONG_ORDER;
    860     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    861     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    862     Msg.hdr.cParms      = pHostCtx->uNumParms;
     864    Msg.hdr.u32ClientID = pCtx->uClientID;
     865    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     866    Msg.hdr.cParms      = pCtx->uNumParms;
    863867
    864868    VbglHGCMParmUInt32Set(&Msg.context, 0);
     
    875879        else
    876880        {
    877             Msg.context.GetUInt32(&pHostCtx->uContextID);
     881            Msg.context.GetUInt32(&pCtx->uContextID);
    878882            Msg.pid.GetUInt32(puPID);
    879883        }
     
    883887
    884888
    885 VBGLR3DECL(int) VbglR3GuestCtrlProcGetWaitFor(PVBGLR3GUESTCTRLHOSTCTX pHostCtx, uint32_t *puPID, uint32_t *puWaitFlags, uint32_t *puTimeoutMS)
    886 {
    887     AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    888 
    889     AssertReturn(pHostCtx->uNumParms == 5, VERR_INVALID_PARAMETER);
     889VBGLR3DECL(int) VbglR3GuestCtrlProcGetWaitFor(PVBGLR3GUESTCTRLCMDCTX pCtx,
     890                                              uint32_t *puPID, uint32_t *puWaitFlags, uint32_t *puTimeoutMS)
     891{
     892    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     893
     894    AssertReturn(pCtx->uNumParms == 5, VERR_INVALID_PARAMETER);
    890895    AssertPtrReturn(puPID, VERR_INVALID_POINTER);
    891896
     
    893898
    894899    Msg.hdr.result      = VERR_WRONG_ORDER;
    895     Msg.hdr.u32ClientID = pHostCtx->uClientID;
    896     Msg.hdr.u32Function = GUEST_MSG_WAIT;
    897     Msg.hdr.cParms      = pHostCtx->uNumParms;
     900    Msg.hdr.u32ClientID = pCtx->uClientID;
     901    Msg.hdr.u32Function = GUEST_MSG_WAIT;
     902    Msg.hdr.cParms      = pCtx->uNumParms;
    898903
    899904    VbglHGCMParmUInt32Set(&Msg.context, 0);
     
    912917        else
    913918        {
    914             Msg.context.GetUInt32(&pHostCtx->uContextID);
     919            Msg.context.GetUInt32(&pCtx->uContextID);
    915920            Msg.pid.GetUInt32(puPID);
    916921            Msg.flags.GetUInt32(puWaitFlags);
     
    922927
    923928
    924 VBGLR3DECL(int) VbglR3GuestCtrlFileNotify(uint32_t     uClientId,    uint32_t     uContext,
    925                                           uint32_t     uType,
    926                                           void        *pvPayload,    uint32_t     cbPayload)
    927 {
    928     AssertPtrReturn(pvPayload, VERR_INVALID_POINTER);
    929     AssertReturn(cbPayload, VERR_INVALID_PARAMETER);
    930 
    931     HGCMMsgFileNotify Msg;
    932 
    933     Msg.hdr.result      = VERR_WRONG_ORDER;
    934     Msg.hdr.u32ClientID = uClientId;
    935     //Msg.hdr.u32Function = GUEST_FILE_NOTIFY;
     929VBGLR3DECL(int) VbglR3GuestCtrlFileCbOpen(PVBGLR3GUESTCTRLCMDCTX pCtx,
     930                                          uint32_t uRc, uint32_t uFileHandle)
     931{
     932    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     933
     934    HGCMReplyFileNotify Msg;
     935
     936    Msg.hdr.result      = VERR_WRONG_ORDER;
     937    Msg.hdr.u32ClientID = pCtx->uClientID;
     938    Msg.hdr.u32Function = GUEST_FILE_NOTIFY;
     939    Msg.hdr.cParms      = 4;
     940
     941    VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID);
     942    VbglHGCMParmUInt32Set(&Msg.type, GUEST_FILE_NOTIFYTYPE_OPEN);
     943    VbglHGCMParmUInt32Set(&Msg.rc, uRc);
     944
     945    VbglHGCMParmUInt32Set(&Msg.u.open.handle, uFileHandle);
     946
     947    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     948    if (RT_SUCCESS(rc))
     949    {
     950        int rc2 = Msg.hdr.result;
     951        if (RT_FAILURE(rc2))
     952            rc = rc2;
     953    }
     954    return rc;
     955}
     956
     957
     958VBGLR3DECL(int) VbglR3GuestCtrlFileCbClose(PVBGLR3GUESTCTRLCMDCTX pCtx,
     959                                           uint32_t uRc)
     960{
     961    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     962
     963    HGCMReplyFileNotify Msg;
     964
     965    Msg.hdr.result      = VERR_WRONG_ORDER;
     966    Msg.hdr.u32ClientID = pCtx->uClientID;
     967    Msg.hdr.u32Function = GUEST_FILE_NOTIFY;
    936968    Msg.hdr.cParms      = 3;
    937969
    938     VbglHGCMParmUInt32Set(&Msg.context, uContext);
    939     VbglHGCMParmUInt32Set(&Msg.type, uType);
    940     VbglHGCMParmPtrSet(&Msg.payload, pvPayload, cbPayload);
     970    VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID);
     971    VbglHGCMParmUInt32Set(&Msg.type, GUEST_FILE_NOTIFYTYPE_CLOSE);
     972    VbglHGCMParmUInt32Set(&Msg.rc, uRc);
     973
     974    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     975    if (RT_SUCCESS(rc))
     976    {
     977        int rc2 = Msg.hdr.result;
     978        if (RT_FAILURE(rc2))
     979            rc = rc2;
     980    }
     981    return rc;
     982}
     983
     984
     985VBGLR3DECL(int) VbglR3GuestCtrlFileCbRead(PVBGLR3GUESTCTRLCMDCTX pCtx,
     986                                          uint32_t uRc,
     987                                          void *pvData, uint32_t cbData)
     988{
     989    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     990
     991    HGCMReplyFileNotify Msg;
     992
     993    Msg.hdr.result      = VERR_WRONG_ORDER;
     994    Msg.hdr.u32ClientID = pCtx->uClientID;
     995    Msg.hdr.u32Function = GUEST_FILE_NOTIFY;
     996    Msg.hdr.cParms      = 4;
     997
     998    VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID);
     999    VbglHGCMParmUInt32Set(&Msg.type, GUEST_FILE_NOTIFYTYPE_READ);
     1000    VbglHGCMParmUInt32Set(&Msg.rc, uRc);
     1001
     1002    VbglHGCMParmPtrSet(&Msg.u.read.data, pvData, cbData);
     1003
     1004    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     1005    if (RT_SUCCESS(rc))
     1006    {
     1007        int rc2 = Msg.hdr.result;
     1008        if (RT_FAILURE(rc2))
     1009            rc = rc2;
     1010    }
     1011    return rc;
     1012}
     1013
     1014
     1015VBGLR3DECL(int) VbglR3GuestCtrlFileCbWrite(PVBGLR3GUESTCTRLCMDCTX pCtx,
     1016                                           uint32_t uRc, uint32_t uWritten)
     1017{
     1018    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     1019
     1020    HGCMReplyFileNotify Msg;
     1021
     1022    Msg.hdr.result      = VERR_WRONG_ORDER;
     1023    Msg.hdr.u32ClientID = pCtx->uClientID;
     1024    Msg.hdr.u32Function = GUEST_FILE_NOTIFY;
     1025    Msg.hdr.cParms      = 4;
     1026
     1027    VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID);
     1028    VbglHGCMParmUInt32Set(&Msg.type, GUEST_FILE_NOTIFYTYPE_WRITE);
     1029    VbglHGCMParmUInt32Set(&Msg.rc, uRc);
     1030
     1031    VbglHGCMParmUInt32Set(&Msg.u.write.written, uWritten);
     1032
     1033    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     1034    if (RT_SUCCESS(rc))
     1035    {
     1036        int rc2 = Msg.hdr.result;
     1037        if (RT_FAILURE(rc2))
     1038            rc = rc2;
     1039    }
     1040    return rc;
     1041}
     1042
     1043
     1044VBGLR3DECL(int) VbglR3GuestCtrlFileCbSeek(PVBGLR3GUESTCTRLCMDCTX pCtx,
     1045                                          uint32_t uRc, uint64_t uOffActual)
     1046{
     1047    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     1048
     1049    HGCMReplyFileNotify Msg;
     1050
     1051    Msg.hdr.result      = VERR_WRONG_ORDER;
     1052    Msg.hdr.u32ClientID = pCtx->uClientID;
     1053    Msg.hdr.u32Function = GUEST_FILE_NOTIFY;
     1054    Msg.hdr.cParms      = 4;
     1055
     1056    VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID);
     1057    VbglHGCMParmUInt32Set(&Msg.type, GUEST_FILE_NOTIFYTYPE_SEEK);
     1058    VbglHGCMParmUInt32Set(&Msg.rc, uRc);
     1059
     1060    VbglHGCMParmUInt64Set(&Msg.u.seek.offset, uOffActual);
     1061
     1062    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     1063    if (RT_SUCCESS(rc))
     1064    {
     1065        int rc2 = Msg.hdr.result;
     1066        if (RT_FAILURE(rc2))
     1067            rc = rc2;
     1068    }
     1069    return rc;
     1070}
     1071
     1072
     1073VBGLR3DECL(int) VbglR3GuestCtrlFileCbTell(PVBGLR3GUESTCTRLCMDCTX pCtx,
     1074                                          uint32_t uRc, uint64_t uOffActual)
     1075{
     1076    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     1077
     1078    HGCMReplyFileNotify Msg;
     1079
     1080    Msg.hdr.result      = VERR_WRONG_ORDER;
     1081    Msg.hdr.u32ClientID = pCtx->uClientID;
     1082    Msg.hdr.u32Function = GUEST_FILE_NOTIFY;
     1083    Msg.hdr.cParms      = 4;
     1084
     1085    VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID);
     1086    VbglHGCMParmUInt32Set(&Msg.type, GUEST_FILE_NOTIFYTYPE_TELL);
     1087    VbglHGCMParmUInt32Set(&Msg.rc, uRc);
     1088
     1089    VbglHGCMParmUInt64Set(&Msg.u.tell.offset, uOffActual);
    9411090
    9421091    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     
    9571106 ** @todo Docs!
    9581107 */
    959 VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatus(uint32_t     u32ClientID,
    960                                             uint32_t     u32Context,
    961                                             uint32_t     u32PID,
    962                                             uint32_t     u32Status,
    963                                             uint32_t     u32Flags,
    964                                             void        *pvData,
    965                                             uint32_t     cbData)
    966 {
     1108VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatus(PVBGLR3GUESTCTRLCMDCTX pCtx,
     1109                                            uint32_t uPID, uint32_t uStatus, uint32_t uFlags,
     1110                                            void  *pvData, uint32_t cbData)
     1111{
     1112    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     1113
    9671114    HGCMMsgProcStatus Msg;
    9681115
    9691116    Msg.hdr.result = VERR_WRONG_ORDER;
    970     Msg.hdr.u32ClientID = u32ClientID;
     1117    Msg.hdr.u32ClientID = pCtx->uClientID;
    9711118    Msg.hdr.u32Function = GUEST_EXEC_STATUS;
    9721119    Msg.hdr.cParms = 5;
    9731120
    974     VbglHGCMParmUInt32Set(&Msg.context, u32Context);
    975     VbglHGCMParmUInt32Set(&Msg.pid, u32PID);
    976     VbglHGCMParmUInt32Set(&Msg.status, u32Status);
    977     VbglHGCMParmUInt32Set(&Msg.flags, u32Flags);
     1121    VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID);
     1122    VbglHGCMParmUInt32Set(&Msg.pid, uPID);
     1123    VbglHGCMParmUInt32Set(&Msg.status, uStatus);
     1124    VbglHGCMParmUInt32Set(&Msg.flags, uFlags);
    9781125    VbglHGCMParmPtrSet(&Msg.data, pvData, cbData);
    9791126
     
    9951142 ** @todo Docs!
    9961143 */
    997 VBGLR3DECL(int) VbglR3GuestCtrlProcCbOutput(uint32_t     u32ClientID,
    998                                             uint32_t     u32Context,
    999                                             uint32_t     u32PID,
    1000                                             uint32_t     u32Handle,
    1001                                             uint32_t     u32Flags,
    1002                                             void        *pvData,
    1003                                             uint32_t     cbData)
    1004 {
     1144VBGLR3DECL(int) VbglR3GuestCtrlProcCbOutput(PVBGLR3GUESTCTRLCMDCTX pCtx,
     1145                                            uint32_t uPID,uint32_t uHandle, uint32_t uFlags,
     1146                                            void *pvData, uint32_t cbData)
     1147{
     1148    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     1149
    10051150    HGCMMsgProcOutput Msg;
    10061151
    10071152    Msg.hdr.result = VERR_WRONG_ORDER;
    1008     Msg.hdr.u32ClientID = u32ClientID;
     1153    Msg.hdr.u32ClientID = pCtx->uClientID;
    10091154    Msg.hdr.u32Function = GUEST_EXEC_OUTPUT;
    10101155    Msg.hdr.cParms = 5;
    10111156
    1012     VbglHGCMParmUInt32Set(&Msg.context, u32Context);
    1013     VbglHGCMParmUInt32Set(&Msg.pid, u32PID);
    1014     VbglHGCMParmUInt32Set(&Msg.handle, u32Handle);
    1015     VbglHGCMParmUInt32Set(&Msg.flags, u32Flags);
     1157    VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID);
     1158    VbglHGCMParmUInt32Set(&Msg.pid, uPID);
     1159    VbglHGCMParmUInt32Set(&Msg.handle, uHandle);
     1160    VbglHGCMParmUInt32Set(&Msg.flags, uFlags);
    10161161    VbglHGCMParmPtrSet(&Msg.data, pvData, cbData);
    10171162
     
    10331178 ** @todo Docs!
    10341179 */
    1035 VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatusInput(uint32_t     u32ClientID,
    1036                                                  uint32_t     u32Context,
    1037                                                  uint32_t     u32PID,
    1038                                                  uint32_t     u32Status,
    1039                                                  uint32_t     u32Flags,
    1040                                                  uint32_t     cbWritten)
    1041 {
     1180VBGLR3DECL(int) VbglR3GuestCtrlProcCbStatusInput(PVBGLR3GUESTCTRLCMDCTX pCtx,
     1181                                                 uint32_t uPID, uint32_t uStatus,
     1182                                                 uint32_t uFlags, uint32_t cbWritten)
     1183{
     1184    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     1185
    10421186    HGCMMsgProcStatusInput Msg;
    10431187
    10441188    Msg.hdr.result = VERR_WRONG_ORDER;
    1045     Msg.hdr.u32ClientID = u32ClientID;
     1189    Msg.hdr.u32ClientID = pCtx->uClientID;
    10461190    Msg.hdr.u32Function = GUEST_EXEC_INPUT_STATUS;
    10471191    Msg.hdr.cParms = 5;
    10481192
    1049     VbglHGCMParmUInt32Set(&Msg.context, u32Context);
    1050     VbglHGCMParmUInt32Set(&Msg.pid, u32PID);
    1051     VbglHGCMParmUInt32Set(&Msg.status, u32Status);
    1052     VbglHGCMParmUInt32Set(&Msg.flags, u32Flags);
     1193    VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID);
     1194    VbglHGCMParmUInt32Set(&Msg.pid, uPID);
     1195    VbglHGCMParmUInt32Set(&Msg.status, uStatus);
     1196    VbglHGCMParmUInt32Set(&Msg.flags, uFlags);
    10531197    VbglHGCMParmUInt32Set(&Msg.written, cbWritten);
    10541198
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp

    r45010 r45109  
    6868*   Internal Functions                                                         *
    6969*******************************************************************************/
    70 static int  gstcntlHandleSessionOpen(PVBGLR3GUESTCTRLHOSTCTX pHostCtx);
    71 static int  gstcntlHandleSessionClose(PVBGLR3GUESTCTRLHOSTCTX pHostCtx);
     70static int  gstcntlHandleSessionOpen(PVBGLR3GUESTCTRLCMDCTX pHostCtx);
     71static int  gstcntlHandleSessionClose(PVBGLR3GUESTCTRLCMDCTX pHostCtx);
    7272static void VBoxServiceControlShutdown(void);
    7373
     
    198198    AssertPtrReturn(pvScratchBuf, VERR_NO_MEMORY);
    199199
    200     VBGLR3GUESTCTRLHOSTCTX ctxHost = { g_uControlSvcClientID,
    201                                        1 /* Default protocol version */ };
     200    VBGLR3GUESTCTRLCMDCTX ctxHost = { g_uControlSvcClientID };
     201    /* Set default protocol version to 1. */
     202    ctxHost.uProtocol = 1;
     203
    202204    for (;;)
    203205    {
     
    301303
    302304
    303 static int gstcntlHandleSessionOpen(PVBGLR3GUESTCTRLHOSTCTX pHostCtx)
     305static int gstcntlHandleSessionOpen(PVBGLR3GUESTCTRLCMDCTX pHostCtx)
    304306{
    305307    AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
     
    329331        /* Report back on failure. On success this will be done
    330332         * by the forked session thread. */
    331         int rc2 = VbglR3GuestCtrlSessionNotify(pHostCtx->uClientID, pHostCtx->uContextID,
     333        int rc2 = VbglR3GuestCtrlSessionNotify(pHostCtx,
    332334                                               GUEST_SESSION_NOTIFYTYPE_ERROR, rc /* uint32_t vs. int */);
    333335        if (RT_FAILURE(rc2))
     
    343345
    344346
    345 static int gstcntlHandleSessionClose(PVBGLR3GUESTCTRLHOSTCTX pHostCtx)
     347static int gstcntlHandleSessionClose(PVBGLR3GUESTCTRLCMDCTX pHostCtx)
    346348{
    347349    AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
     
    368370            /* Report back on failure. On success this will be done
    369371             * by the forked session thread. */
    370             int rc2 = VbglR3GuestCtrlSessionNotify(pHostCtx->uClientID, pHostCtx->uContextID,
     372            int rc2 = VbglR3GuestCtrlSessionNotify(pHostCtx,
    371373                                                   GUEST_SESSION_NOTIFYTYPE_ERROR, rc);
    372374            if (RT_FAILURE(rc2))
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.h

    r45010 r45109  
    385385extern int                      GstCntlSessionDestroy(PVBOXSERVICECTRLSESSION pSession);
    386386extern int                      GstCntlSessionInit(PVBOXSERVICECTRLSESSION pSession, uint32_t uFlags);
    387 extern int                      GstCntlSessionHandler(PVBOXSERVICECTRLSESSION pSession, uint32_t uMsg, PVBGLR3GUESTCTRLHOSTCTX pHostCtx, void *pvScratchBuf, size_t cbScratchBuf, volatile bool *pfShutdown);
     387extern int                      GstCntlSessionHandler(PVBOXSERVICECTRLSESSION pSession, uint32_t uMsg, PVBGLR3GUESTCTRLCMDCTX pHostCtx, void *pvScratchBuf, size_t cbScratchBuf, volatile bool *pfShutdown);
    388388extern int                      GstCntlSessionListSet(PVBOXSERVICECTRLSESSION pSession, PVBOXSERVICECTRLPROCESS pThread, VBOXSERVICECTRLTHREADLISTTYPE enmList);
    389389extern int                      GstCntlSessionProcessStartAllowed(const PVBOXSERVICECTRLSESSION pSession, bool *pbAllowed);
     
    401401extern void                     GstCntlProcessRequestFree(PVBOXSERVICECTRLREQUEST pReq);
    402402/* Per-session functions. */
    403 extern int gstcntlHandleFileOpen(uint32_t idClient, uint32_t cParms);
    404 extern int gstcntlHandleFileClose(uint32_t idClient, uint32_t cParms);
    405 extern int gstcntlHandleFileRead(uint32_t idClient, uint32_t cParms, void *pvScratchBuf, size_t cbScratchBuf);
    406 extern int gstcntlHandleFileReadAt(uint32_t idClient, uint32_t cParms, void *pvScratchBuf, size_t cbScratchBuf);
    407 extern int gstcntlHandleFileWrite(uint32_t idClient, uint32_t cParms, void *pvScratchBuf, size_t cbScratchBuf);
    408 extern int gstcntlHandleFileWriteAt(uint32_t idClient, uint32_t cParms, void *pvScratchBuf, size_t cbScratchBuf);
    409 extern int gstcntlHandleFileSeek(uint32_t idClient, uint32_t cParms);
    410 extern int gstcntlHandleFileTell(uint32_t idClient, uint32_t cParms);
    411 extern int                      GstCntlSessionHandleProcExec(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLHOSTCTX pHostCtx);
    412 extern int                      GstCntlSessionHandleProcInput(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLHOSTCTX pHostCtx, void *pvScratchBuf, size_t cbScratchBuf);
    413 extern int                      GstCntlSessionHandleProcOutput(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLHOSTCTX pHostCtx);
    414 extern int                      GstCntlSessionHandleProcTerminate(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLHOSTCTX pHostCtx);
    415 extern int                      GstCntlSessionHandleProcWaitFor(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLHOSTCTX pHostCtx);
     403extern int                      GstCntlSessionHandleProcExec(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
     404extern int                      GstCntlSessionHandleProcInput(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx, void *pvScratchBuf, size_t cbScratchBuf);
     405extern int                      GstCntlSessionHandleProcOutput(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
     406extern int                      GstCntlSessionHandleProcTerminate(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
     407extern int                      GstCntlSessionHandleProcWaitFor(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
    416408
    417409RT_C_DECLS_END
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp

    r45017 r45109  
    650650    VBoxServiceVerbose(2, "[PID %u]: Process \"%s\" started, CID=%u, User=%s\n",
    651651                       pThread->uPID, pThread->pszCmd, pThread->uContextID, pThread->pszUser);
    652     rc = VbglR3GuestCtrlProcCbStatus(pThread->uClientID, pThread->uContextID,
     652    VBGLR3GUESTCTRLCMDCTX ctx = { pThread->uClientID, pThread->uContextID };
     653    rc = VbglR3GuestCtrlProcCbStatus(&ctx,
    653654                                     pThread->uPID, PROC_STS_STARTED, 0 /* u32Flags */,
    654655                                     NULL /* pvData */, 0 /* cbData */);
     
    925926        if (!(pThread->uFlags & EXECUTEPROCESSFLAG_WAIT_START))
    926927        {
    927             rc2 = VbglR3GuestCtrlProcCbStatus(pThread->uClientID, pThread->uContextID,
     928            VBGLR3GUESTCTRLCMDCTX ctx = { pThread->uClientID, pThread->uContextID };
     929            rc2 = VbglR3GuestCtrlProcCbStatus(&ctx,
    928930                                              pThread->uPID, uStatus, uFlags,
    929931                                              NULL /* pvData */, 0 /* cbData */);
     
    17461748        if (RT_FAILURE(rc))
    17471749        {
    1748             rc2 = VbglR3GuestCtrlProcCbStatus(pProcess->uClientID, pProcess->uContextID, pProcess->uPID,
    1749                                               PROC_STS_ERROR, rc,
     1750            VBGLR3GUESTCTRLCMDCTX ctx = { pProcess->uClientID, pProcess->uContextID };
     1751            rc2 = VbglR3GuestCtrlProcCbStatus(&ctx,
     1752                                              pProcess->uPID, PROC_STS_ERROR, rc,
    17501753                                              NULL /* pvData */, 0 /* cbData */);
    17511754            if (RT_FAILURE(rc2))
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp

    r45076 r45109  
    5555static PVBOXSERVICECTRLFILE gstcntlSessionGetFile(const PVBOXSERVICECTRLSESSION pSession, uint32_t uHandle);
    5656static int                  gstcntlSessionGetOutput(const PVBOXSERVICECTRLSESSION pSession, uint32_t uPID, uint32_t uCID, uint32_t uHandleId, uint32_t cMsTimeout, void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead);
    57 static int                  gstcntlSessionHandleFileOpen(PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLHOSTCTX pHostCtx);
    58 static int                  gstcntlSessionHandleFileClose(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLHOSTCTX pHostCtx);
    59 static int                  gstcntlSessionHandleFileRead(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLHOSTCTX pHostCtx);
    60 static int                  gstcntlSessionHandleFileWrite(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLHOSTCTX pHostCtx, void *pvScratchBuf, size_t cbScratchBuf);
    61 static int                  gstcntlSessionHandleFileSeek(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLHOSTCTX pHostCtx);
    62 static int                  gstcntlSessionHandleFileTell(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLHOSTCTX pHostCtx);
     57static int                  gstcntlSessionHandleFileOpen(PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
     58static int                  gstcntlSessionHandleFileClose(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
     59static int                  gstcntlSessionHandleFileRead(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
     60static int                  gstcntlSessionHandleFileWrite(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx, void *pvScratchBuf, size_t cbScratchBuf);
     61static int                  gstcntlSessionHandleFileSeek(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
     62static int                  gstcntlSessionHandleFileTell(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
    6363static int                  gstcntlSessionSetInput(const PVBOXSERVICECTRLSESSION pSession, uint32_t uPID, uint32_t uCID, bool fPendingClose, void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten);
    6464static DECLCALLBACK(int)    gstcntlSessionThread(RTTHREAD ThreadSelf, void *pvUser);
     
    142142
    143143static int gstcntlSessionHandleFileOpen(PVBOXSERVICECTRLSESSION pSession,
    144                                         PVBGLR3GUESTCTRLHOSTCTX pHostCtx)
     144                                        PVBGLR3GUESTCTRLCMDCTX pHostCtx)
    145145{
    146146    AssertPtrReturn(pSession, VERR_INVALID_POINTER);
     
    208208
    209209        /* Report back in any case. */
    210         CALLBACKPAYLOAD_FILE_NOTIFY_OPEN cplOpen = { rc, uHandle };
    211         int rc2 = VbglR3GuestCtrlFileNotify(pHostCtx->uClientID, pHostCtx->uContextID,
    212                                             GUEST_FILE_NOTIFYTYPE_OPEN, &cplOpen, sizeof(cplOpen));
     210        int rc2 = VbglR3GuestCtrlFileCbOpen(pHostCtx, rc, uHandle);
    213211        if (RT_FAILURE(rc2))
    214212            VBoxServiceError("[File %s]: Failed to report file open status, rc=%Rrc\n",
     
    223221
    224222static int gstcntlSessionHandleFileClose(const PVBOXSERVICECTRLSESSION pSession,
    225                                          PVBGLR3GUESTCTRLHOSTCTX pHostCtx)
     223                                         PVBGLR3GUESTCTRLCMDCTX pHostCtx)
    226224{
    227225    AssertPtrReturn(pSession, VERR_INVALID_POINTER);
     
    242240
    243241        /* Report back in any case. */
    244         CALLBACKPAYLOAD_FILE_NOTIFY_CLOSE cplClose = { rc };
    245         int rc2 = VbglR3GuestCtrlFileNotify(pHostCtx->uClientID, pHostCtx->uContextID,
    246                                             GUEST_FILE_NOTIFYTYPE_CLOSE, &cplClose, sizeof(cplClose));
     242        int rc2 = VbglR3GuestCtrlFileCbClose(pHostCtx, rc);
    247243        if (RT_FAILURE(rc2))
    248244            VBoxServiceError("Failed to report file close status, rc=%Rrc\n", rc2);
     
    255251
    256252static int gstcntlSessionHandleFileRead(const PVBOXSERVICECTRLSESSION pSession,
    257                                         PVBGLR3GUESTCTRLHOSTCTX pHostCtx,
     253                                        PVBGLR3GUESTCTRLCMDCTX pHostCtx,
    258254                                        void *pvScratchBuf, size_t cbScratchBuf)
    259255{
     
    292288
    293289        /* Report back in any case. */
    294         CALLBACKPAYLOAD_FILE_NOTIFY_READ cplRead = { rc, (uint32_t)cbRead, pvDataRead };
    295         int rc2 = VbglR3GuestCtrlFileNotify(pHostCtx->uClientID, pHostCtx->uContextID,
    296                                             GUEST_FILE_NOTIFYTYPE_READ, &cplRead, sizeof(cplRead));
     290        int rc2 = VbglR3GuestCtrlFileCbRead(pHostCtx, rc, pvDataRead, (uint32_t)cbRead);
    297291        if (   cbToRead > cbScratchBuf
    298292            && pvDataRead)
     
    309303
    310304static int gstcntlSessionHandleFileReadAt(const PVBOXSERVICECTRLSESSION pSession,
    311                                           PVBGLR3GUESTCTRLHOSTCTX pHostCtx,
     305                                          PVBGLR3GUESTCTRLCMDCTX pHostCtx,
    312306                                          void *pvScratchBuf, size_t cbScratchBuf)
    313307{
     
    347341
    348342        /* Report back in any case. */
    349         CALLBACKPAYLOAD_FILE_NOTIFY_READ cplRead = { rc, (uint32_t)cbRead, pvDataRead };
    350         int rc2 = VbglR3GuestCtrlFileNotify(pHostCtx->uClientID, pHostCtx->uContextID,
    351                                             GUEST_FILE_NOTIFYTYPE_READ, &cplRead, sizeof(cplRead));
     343        int rc2 = VbglR3GuestCtrlFileCbRead(pHostCtx, rc, pvDataRead, (uint32_t)cbRead);
    352344        if (   cbToRead > cbScratchBuf
    353345            && pvDataRead)
     
    364356
    365357static int gstcntlSessionHandleFileWrite(const PVBOXSERVICECTRLSESSION pSession,
    366                                          PVBGLR3GUESTCTRLHOSTCTX pHostCtx,
     358                                         PVBGLR3GUESTCTRLCMDCTX pHostCtx,
    367359                                         void *pvScratchBuf, size_t cbScratchBuf)
    368360{
     
    390382
    391383        /* Report back in any case. */
    392         CALLBACKPAYLOAD_FILE_NOTIFY_WRITE cplWrite = { rc, (uint32_t)cbWritten };
    393         int rc2 = VbglR3GuestCtrlFileNotify(pHostCtx->uClientID, pHostCtx->uContextID,
    394                                             GUEST_FILE_NOTIFYTYPE_WRITE, &cplWrite, sizeof(cplWrite));
     384        int rc2 = VbglR3GuestCtrlFileCbWrite(pHostCtx, rc, (uint32_t)cbWritten);
    395385        if (RT_FAILURE(rc2))
    396386            VBoxServiceError("Failed to report file write status, rc=%Rrc\n", rc2);
     
    403393
    404394static int gstcntlSessionHandleFileWriteAt(const PVBOXSERVICECTRLSESSION pSession,
    405                                            PVBGLR3GUESTCTRLHOSTCTX pHostCtx,
     395                                           PVBGLR3GUESTCTRLCMDCTX pHostCtx,
    406396                                           void *pvScratchBuf, size_t cbScratchBuf)
    407397{
     
    430420
    431421        /* Report back in any case. */
    432         CALLBACKPAYLOAD_FILE_NOTIFY_WRITE cplWrite = { rc, (uint32_t)cbWritten };
    433         int rc2 = VbglR3GuestCtrlFileNotify(pHostCtx->uClientID, pHostCtx->uContextID,
    434                                             GUEST_FILE_NOTIFYTYPE_WRITE, &cplWrite, sizeof(cplWrite));
     422        int rc2 = VbglR3GuestCtrlFileCbWrite(pHostCtx, rc, (uint32_t)cbWritten);
    435423        if (RT_FAILURE(rc2))
    436424            VBoxServiceError("Failed to report file write status, rc=%Rrc\n", rc2);
     
    443431
    444432static int gstcntlSessionHandleFileSeek(const PVBOXSERVICECTRLSESSION pSession,
    445                                         PVBGLR3GUESTCTRLHOSTCTX pHostCtx)
     433                                        PVBGLR3GUESTCTRLCMDCTX pHostCtx)
    446434{
    447435    AssertPtrReturn(pSession, VERR_INVALID_POINTER);
     
    489477
    490478        /* Report back in any case. */
    491         CALLBACKPAYLOAD_FILE_NOTFIY_SEEK cplSeek = { rc, uOffsetActual };
    492         int rc2 = VbglR3GuestCtrlFileNotify(pHostCtx->uClientID, pHostCtx->uContextID,
    493                                             GUEST_FILE_NOTIFYTYPE_SEEK, &cplSeek, sizeof(cplSeek));
     479        int rc2 = VbglR3GuestCtrlFileCbSeek(pHostCtx, rc, uOffsetActual);
    494480        if (RT_FAILURE(rc2))
    495481            VBoxServiceError("Failed to report file seek status, rc=%Rrc\n", rc2);
     
    502488
    503489static int gstcntlSessionHandleFileTell(const PVBOXSERVICECTRLSESSION pSession,
    504                                         PVBGLR3GUESTCTRLHOSTCTX pHostCtx)
     490                                        PVBGLR3GUESTCTRLCMDCTX pHostCtx)
    505491{
    506492    AssertPtrReturn(pSession, VERR_INVALID_POINTER);
     
    522508
    523509        /* Report back in any case. */
    524         CALLBACKPAYLOAD_FILE_NOTFIY_TELL cplTell = { rc, uOffsetActual };
    525         int rc2 = VbglR3GuestCtrlFileNotify(pHostCtx->uClientID, pHostCtx->uContextID,
    526                                             GUEST_FILE_NOTIFYTYPE_TELL, &cplTell, sizeof(cplTell));
     510        int rc2 = VbglR3GuestCtrlFileCbTell(pHostCtx, rc, uOffsetActual);
    527511        if (RT_FAILURE(rc2))
    528512            VBoxServiceError("Failed to report file tell status, rc=%Rrc\n", rc2);
     
    542526 */
    543527int GstCntlSessionHandleProcExec(PVBOXSERVICECTRLSESSION pSession,
    544                                  PVBGLR3GUESTCTRLHOSTCTX pHostCtx)
     528                                 PVBGLR3GUESTCTRLCMDCTX pHostCtx)
    545529{
    546530    AssertPtrReturn(pSession, VERR_INVALID_POINTER);
     
    626610         *       from the host. The host in case has to deal with that!
    627611         */
    628         int rc2 = VbglR3GuestCtrlProcCbStatus(pHostCtx->uClientID, pHostCtx->uContextID,
    629                                               0 /* PID, invalid */,
     612        int rc2 = VbglR3GuestCtrlProcCbStatus(pHostCtx, 0 /* PID, invalid */,
    630613                                              PROC_STS_ERROR, rc,
    631614                                              NULL /* pvData */, 0 /* cbData */);
     
    651634 */
    652635int GstCntlSessionHandleProcInput(PVBOXSERVICECTRLSESSION pSession,
    653                                   PVBGLR3GUESTCTRLHOSTCTX pHostCtx,
     636                                  PVBGLR3GUESTCTRLCMDCTX pHostCtx,
    654637                                  void *pvScratchBuf, size_t cbScratchBuf)
    655638{
     
    732715     *       regardless whether we got data or not! Otherwise the progress object
    733716     *       on the host never will get completed! */
    734     rc = VbglR3GuestCtrlProcCbStatusInput(pHostCtx->uClientID, pHostCtx->uContextID, uPID,
     717    rc = VbglR3GuestCtrlProcCbStatusInput(pHostCtx, uPID,
    735718                                          uStatus, uFlags, (uint32_t)cbWritten);
    736719
     
    748731 */
    749732int GstCntlSessionHandleProcOutput(PVBOXSERVICECTRLSESSION pSession,
    750                                    PVBGLR3GUESTCTRLHOSTCTX pHostCtx)
     733                                   PVBGLR3GUESTCTRLCMDCTX pHostCtx)
    751734{
    752735    AssertPtrReturn(pSession, VERR_INVALID_POINTER);
     
    800783             *       regardless whether we got data or not! Otherwise the progress object
    801784             *       on the host never will get completed! */
    802             int rc2 = VbglR3GuestCtrlProcCbOutput(pHostCtx->uClientID, pHostCtx->uContextID, uPID, uHandleID, uFlags,
     785            int rc2 = VbglR3GuestCtrlProcCbOutput(pHostCtx, uPID, uHandleID, uFlags,
    803786                                                  pBuf, cbRead);
    804787            if (RT_SUCCESS(rc))
     
    821804
    822805int GstCntlSessionHandleProcTerminate(const PVBOXSERVICECTRLSESSION pSession,
    823                                       PVBGLR3GUESTCTRLHOSTCTX pHostCtx)
     806                                      PVBGLR3GUESTCTRLCMDCTX pHostCtx)
    824807{
    825808    AssertPtrReturn(pSession, VERR_INVALID_POINTER);
     
    853836
    854837int GstCntlSessionHandleProcWaitFor(const PVBOXSERVICECTRLSESSION pSession,
    855                                     PVBGLR3GUESTCTRLHOSTCTX pHostCtx)
     838                                    PVBGLR3GUESTCTRLCMDCTX pHostCtx)
    856839{
    857840    AssertPtrReturn(pSession, VERR_INVALID_POINTER);
     
    888871
    889872int GstCntlSessionHandler(PVBOXSERVICECTRLSESSION pSession,
    890                           uint32_t uMsg, PVBGLR3GUESTCTRLHOSTCTX pHostCtx,
     873                          uint32_t uMsg, PVBGLR3GUESTCTRLCMDCTX pHostCtx,
    891874                          void *pvScratchBuf, size_t cbScratchBuf,
    892875                          volatile bool *pfShutdown)
     
    11361119    /* Report final status. */
    11371120    Assert(uSessionStatus != GUEST_SESSION_NOTIFYTYPE_UNDEFINED);
    1138     rc2 = VbglR3GuestCtrlSessionNotify(uClientID,
    1139                                        VBOX_GUESTCTRL_CONTEXTID_MAKE_SESSION(uSessionID),
     1121    VBGLR3GUESTCTRLCMDCTX ctx = { uClientID, VBOX_GUESTCTRL_CONTEXTID_MAKE_SESSION(uSessionID) };
     1122    rc2 = VbglR3GuestCtrlSessionNotify(&ctx,
    11401123                                       uSessionStatus, uSessionRc);
    11411124    if (RT_FAILURE(rc2))
     
    11871170
    11881171    /* Report started status. */
    1189     int rc2 = VbglR3GuestCtrlSessionNotify(uClientID,
    1190                                            VBOX_GUESTCTRL_CONTEXTID_MAKE_SESSION(pSession->StartupInfo.uSessionID),
     1172    VBGLR3GUESTCTRLCMDCTX ctx = { uClientID, VBOX_GUESTCTRL_CONTEXTID_MAKE_SESSION(pSession->StartupInfo.uSessionID) };
     1173    int rc2 = VbglR3GuestCtrlSessionNotify(&ctx,
    11911174                                           GUEST_SESSION_NOTIFYTYPE_STARTED, VINF_SUCCESS);
    11921175    if (RT_FAILURE(rc2))
     
    12111194        bool fShutdown = false;
    12121195
    1213         VBGLR3GUESTCTRLHOSTCTX ctxHost = { uClientID,
    1214                                            pSession->StartupInfo.uProtocol };
     1196        VBGLR3GUESTCTRLCMDCTX ctxHost = { uClientID, 0 /* Context ID, zeroed */,
     1197                                          pSession->StartupInfo.uProtocol };
    12151198        for (;;)
    12161199        {
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