Changeset 68526 in vbox
- Timestamp:
- Aug 24, 2017 7:11:40 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestCtrl.cpp
r68502 r68526 73 73 * @returns VBox status code. 74 74 * @param uClientId The client ID returned by VbglR3GuestCtrlConnect(). 75 * @param p uMsgWhere to store the message id.76 * @param p uNumParms Where to store the number of parameters which will be received77 * in a second call to the host.78 */ 79 VBGLR3DECL(int) VbglR3GuestCtrlMsgWaitFor(uint32_t uClientId, uint32_t *p uMsg, uint32_t *puNumParms)80 { 81 AssertPtrReturn(p uMsg, VERR_INVALID_POINTER);82 AssertPtrReturn(p uNumParms, VERR_INVALID_POINTER);75 * @param pidMsg Where to store the message id. 76 * @param pcParameters Where to store the number of parameters which will 77 * be received in a second call to the host. 78 */ 79 VBGLR3DECL(int) VbglR3GuestCtrlMsgWaitFor(uint32_t uClientId, uint32_t *pidMsg, uint32_t *pcParameters) 80 { 81 AssertPtrReturn(pidMsg, VERR_INVALID_POINTER); 82 AssertPtrReturn(pcParameters, VERR_INVALID_POINTER); 83 83 84 84 HGCMMsgCmdWaitFor Msg; … … 89 89 VbglHGCMParmUInt32Set(&Msg.num_parms, 0); 90 90 91 int rc = VbglR3HGCMCallRaw(&Msg.hdr, sizeof(Msg)); 92 if (RT_SUCCESS(rc)) 93 { 94 rc = VbglHGCMParmUInt32Get(&Msg.msg, puMsg); 95 if (RT_SUCCESS(rc)) 91 /* 92 * We should always get a VERR_TOO_MUCH_DATA response here, see 93 * guestControl::HostCommand::Peek() and its caller ClientState::SendReply(). 94 * We accept success too here, in case someone decide to make the protocol 95 * slightly more sane. 96 * 97 * Note! A really sane protocol design would have a separate call for getting 98 * info about a pending message (returning VINF_SUCCESS), and a separate 99 * one for retriving the actual message parameters. Not this weird 100 * stuff, to put it rather bluntly. 101 */ 102 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 103 if ( rc == VERR_TOO_MUCH_DATA 104 || RT_SUCCESS(rc)) 105 { 106 int rc2 = VbglHGCMParmUInt32Get(&Msg.msg, pidMsg); 107 if (RT_SUCCESS(rc2)) 96 108 { 97 rc = VbglHGCMParmUInt32Get(&Msg.num_parms, puNumParms);98 if (RT_SUCCESS(rc ))99 rc = Msg.hdr.result;109 rc2 = VbglHGCMParmUInt32Get(&Msg.num_parms, pcParameters); 110 if (RT_SUCCESS(rc2)) 111 { 100 112 /* Ok, so now we know what message type and how much parameters there are. */ 113 return rc; 114 } 101 115 } 102 } 116 rc = rc2; 117 } 118 *pidMsg = UINT32_MAX - 1; 119 *pcParameters = UINT32_MAX - 2; 103 120 return rc; 104 121 } … … 189 206 VBGL_HGCM_HDR_INIT(&Msg.hdr, uClientId, GUEST_MSG_SKIP, 1); 190 207 VbglHGCMParmUInt32Set(&Msg.flags, 0 /* Flags, unused */); 191 192 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 193 if (RT_SUCCESS(rc)) 194 rc = Msg.hdr.result; 195 196 return rc; 208 return VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 197 209 } 198 210
Note:
See TracChangeset
for help on using the changeset viewer.