Changeset 42214 in vbox
- Timestamp:
- Jul 18, 2012 6:02:58 PM (13 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h
r42194 r42214 37 37 38 38 39 /* Builds a context ID out of the session ID, process ID and an 40 * increasing count. */ 39 /** Maximum number of guest sessions a VM can have. */ 40 #define VBOX_GUESTCTRL_MAX_SESSIONS 255 41 /** Maximum of guest processes a guest session can have. */ 42 #define VBOX_GUESTCTRL_MAX_PROCESSES 255 43 /** Maximum of callback contexts a guest process can have. */ 44 #define VBOX_GUESTCTRL_MAX_CONTEXTS _64K - 1 45 46 /** Builds a context ID out of the session ID, process ID and an 47 * increasing count. */ 41 48 #define VBOX_GUESTCTRL_CONTEXTID_MAKE(uSession, uProcess, uCount) \ 42 49 ( (uint32_t)((uSession) & 0xff) << 24 \ … … 44 51 | (uint32_t)((uCount) & 0xffff) \ 45 52 ) 53 /** Gets the session ID out of a context ID. */ 54 #define VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(uContextID) \ 55 ((uContextID) >> 24) 56 /** Gets the process ID out of a context ID. */ 57 #define VBOX_GUESTCTRL_CONTEXTID_GET_PROCESS(uContextID) \ 58 (((uContextID) >> 16) & 0xff) 59 /** Gets the conext count of a process out of a context ID. */ 60 #define VBOX_GUESTCTRL_CONTEXTID_GET_COUNT(uContextID) \ 61 ((uContextID) & 0xffff) 46 62 47 63 … … 67 83 public: 68 84 85 int Cancel(void); 86 87 bool Canceled(void); 88 69 89 int Init(eVBoxGuestCtrlCallbackType enmType); 70 90 … … 73 93 eVBoxGuestCtrlCallbackType Type(void); 74 94 75 int Wait( RTMSINTERVAL timeoutMS);95 int Wait(ULONG uTimeoutMS); 76 96 77 97 protected: … … 80 100 eVBoxGuestCtrlCallbackType mType; 81 101 /** Callback flags. */ 82 uint32_t mFlags; 102 uint32_t uFlags; 103 /** Was the callback canceled? */ 104 bool fCanceled; 83 105 /** Pointer to user-supplied data. */ 84 106 void *pvData; … … 86 108 size_t cbData; 87 109 /** The event semaphore triggering the*/ 88 RTSEMEVENT mEventSem;110 RTSEMEVENT hEventSem; 89 111 /** Extended error information, if any. */ 90 112 ErrorInfo mErrorInfo; 91 113 }; 92 typedef std::map < uint32_t, GuestCtrlCallback> GuestCtrlCallbacks;114 typedef std::map < uint32_t, GuestCtrlCallback* > GuestCtrlCallbacks; 93 115 94 116 /** … … 112 134 public: 113 135 114 int BuildEnvironmentBlock(void **ppvEnv, uint32_t *pcbEnv, uint32_t *pcEnvVars);136 int BuildEnvironmentBlock(void **ppvEnv, size_t *pcbEnv, uint32_t *pcEnvVars); 115 137 116 138 void Clear(void); … … 144 166 protected: 145 167 146 int appendToEnvBlock(const char *pszEnv, void **ppvList, uint32_t *pcbList, uint32_t *pcEnvVars);168 int appendToEnvBlock(const char *pszEnv, void **ppvList, size_t *pcbList, uint32_t *pcEnvVars); 147 169 148 170 protected: -
trunk/src/VBox/Main/include/GuestImpl.h
r42160 r42214 205 205 /** @name Public internal methods. 206 206 * @{ */ 207 int dispatchToSession(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData); 207 208 Console *getConsole(void) { return mParent; } 208 209 int sessionClose(ComObjPtr<GuestSession> pSession); -
trunk/src/VBox/Main/include/GuestProcessImpl.h
r42162 r42214 45 45 DECLARE_EMPTY_CTOR_DTOR(GuestProcess) 46 46 47 int init(Console *aConsole, GuestSession *aSession, uint32_taProcessID, const GuestProcessInfo &aProcInfo);47 int init(Console *aConsole, GuestSession *aSession, ULONG aProcessID, const GuestProcessInfo &aProcInfo); 48 48 void uninit(void); 49 49 HRESULT FinalConstruct(void); … … 69 69 /** @name Public internal methods. 70 70 * @{ */ 71 int callbackAdd(const GuestCtrlCallback& theCallback, uint32_t *puContextID); 72 bool callbackExists(uint32_t uContextID); 71 int callbackAdd(GuestCtrlCallback *pCallback, ULONG *puContextID); 72 int callbackDispatcher(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData); 73 bool callbackExists(ULONG uContextID); 73 74 bool isReady(void); 74 int prepareExecuteEnv(const char *pszEnv, void **ppvList, uint32_t *pcbList, uint32_t *pcEnvVars); 75 int readData(ULONG aHandle, ULONG aSize, ULONG aTimeoutMS, ComSafeArrayOut(BYTE, aData)); 75 ULONG getPID(void) { return mData.mPID; } 76 int onGuestDisconnected(void); 77 int onProcessInputStatus(uint32_t uStatus, uint32_t uFlags, uint32_t cbDataProcessed); 78 int onProcessStatusChange(uint32_t uStatus, uint32_t uFlags, uint32_t uPID); 79 int onProcessOutput(uint32_t uHandle, uint32_t uFlags, void *pvData, uint32_t cbData); 80 int prepareExecuteEnv(const char *pszEnv, void **ppvList, ULONG *pcbList, ULONG *pcEnvVars); 81 int readData(ULONG uHandle, ULONG uSize, ULONG uTimeoutMS, BYTE *pbData, size_t cbData); 76 82 int startProcess(void); 77 83 static DECLCALLBACK(int) startProcessThread(RTTHREAD Thread, void *pvUser); 78 84 int terminateProcess(void); 79 int waitFor( ComSafeArrayIn(ProcessWaitForFlag_T, aFlags), ULONG aTimeoutMS, ProcessWaitReason_T *aReason);80 int writeData(ULONG aHandle, ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten);85 int waitFor(uint32_t fFlags, ULONG uTimeoutMS, ProcessWaitReason_T *penmReason); 86 int writeData(ULONG uHandle, BYTE const *pbData, size_t cbData, ULONG uTimeoutMS, ULONG *puWritten); 81 87 /** @} */ 82 88 … … 99 105 ULONG mPID; 100 106 /** Internal, host-side process ID. */ 101 uint32_tmProcessID;107 ULONG mProcessID; 102 108 /** The current process status. */ 103 109 ProcessStatus_T mStatus; … … 105 111 bool mStarted; 106 112 /** The next upcoming context ID. */ 107 uint32_t mNextContextID; 113 ULONG mNextContextID; 114 /** The waiting event. */ 115 RTSEMEVENT mEvent; 108 116 } mData; 117 118 friend GuestSession; /* Let's be friends! */ 109 119 }; 110 120 -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r42194 r42214 48 48 DECLARE_EMPTY_CTOR_DTOR(GuestSession) 49 49 50 int init(Guest *aGuest, uint32_taSessionID, Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName);50 int init(Guest *aGuest, ULONG aSessionID, Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName); 51 51 void uninit(void); 52 52 HRESULT FinalConstruct(void); … … 113 113 typedef std::vector <ComObjPtr<GuestDirectory> > SessionDirectories; 114 114 typedef std::vector <ComObjPtr<GuestFile> > SessionFiles; 115 typedef std::map <uint32_t, ComObjPtr<GuestProcess> > SessionProcesses; 115 /** Map of guest processes. The key specifies the internal process number. 116 * To retrieve the process' guest PID use the Id() method of the IProgress interface. */ 117 typedef std::map <ULONG, ComObjPtr<GuestProcess> > SessionProcesses; 116 118 117 119 public: … … 119 121 * @{ */ 120 122 int directoryClose(ComObjPtr<GuestDirectory> pDirectory); 123 int dispatchToProcess(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData); 121 124 int fileClose(ComObjPtr<GuestFile> pFile); 122 125 const GuestCredentials &getCredentials(void); … … 124 127 int processClose(ComObjPtr<GuestProcess> pProcess); 125 128 int processCreateExInteral(GuestProcessInfo &aProcInfo, IGuestProcess **aProcess); 126 inline bool processExists(uint32_t uProcessID); 129 inline bool processExists(ULONG uProcessID, ComObjPtr<GuestProcess> *pProcess); 130 inline int processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess); 127 131 /** @} */ 128 132 -
trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp
r42194 r42214 684 684 * changes to the object state. 685 685 */ 686 #ifdef DEBUG_andy 687 LogFlowFunc(("pvExtension=%p, u32Function=%d, pvParms=%p, cbParms=%d\n", 686 LogFlowFunc(("pvExtension=%p, u32Function=%RU32, pvParms=%p, cbParms=%RU32\n", 688 687 pvExtension, u32Function, pvParms, cbParms)); 689 #endif690 688 ComObjPtr<Guest> pGuest = reinterpret_cast<Guest *>(pvExtension); 691 692 int rc = VINF_SUCCESS; 689 Assert(!pGuest.isNull()); 690 691 /* 692 * For guest control 2.0 using the legacy commands we need to do the following here: 693 * - Get the callback header to access the context ID 694 * - Get the context ID of the callback 695 * - Extract the session ID out of the context ID 696 * - Dispatch the whole stuff to the appropriate session (if still exists) 697 */ 698 699 PCALLBACKHEADER pHeader = (PCALLBACKHEADER)pvParms; 700 AssertPtr(pHeader); 701 702 int rc = pGuest->dispatchToSession(pHeader->u32ContextID, u32Function, pvParms, cbParms); 703 704 #ifdef VBOX_WITH_GUEST_CONTROL_LEGACY 705 if (RT_SUCCESS(rc)) 706 return rc; 707 708 /* Legacy handling. */ 693 709 switch (u32Function) 694 710 { 695 711 case GUEST_DISCONNECTED: 696 712 { 697 //LogFlowFunc(("GUEST_DISCONNECTED\n"));698 699 713 PCALLBACKDATACLIENTDISCONNECTED pCBData = reinterpret_cast<PCALLBACKDATACLIENTDISCONNECTED>(pvParms); 700 714 AssertPtr(pCBData); … … 708 722 case GUEST_EXEC_SEND_STATUS: 709 723 { 710 //LogFlowFunc(("GUEST_EXEC_SEND_STATUS\n"));711 712 724 PCALLBACKDATAEXECSTATUS pCBData = reinterpret_cast<PCALLBACKDATAEXECSTATUS>(pvParms); 713 725 AssertPtr(pCBData); … … 721 733 case GUEST_EXEC_SEND_OUTPUT: 722 734 { 723 //LogFlowFunc(("GUEST_EXEC_SEND_OUTPUT\n"));724 725 735 PCALLBACKDATAEXECOUT pCBData = reinterpret_cast<PCALLBACKDATAEXECOUT>(pvParms); 726 736 AssertPtr(pCBData); … … 734 744 case GUEST_EXEC_SEND_INPUT_STATUS: 735 745 { 736 //LogFlowFunc(("GUEST_EXEC_SEND_INPUT_STATUS\n"));737 738 746 PCALLBACKDATAEXECINSTATUS pCBData = reinterpret_cast<PCALLBACKDATAEXECINSTATUS>(pvParms); 739 747 AssertPtr(pCBData); … … 746 754 747 755 default: 748 AssertMsgFailed(("Unknown guest control notification received, u32Function=%u\n", u32Function));749 rc = VERR_ INVALID_PARAMETER;756 /* Silently ignore not implemented functions. */ 757 rc = VERR_NOT_IMPLEMENTED; 750 758 break; 751 759 } 760 #endif /* VBOX_WITH_GUEST_CONTROL_LEGACY */ 752 761 return rc; 753 762 } … … 2664 2673 ///////////////////////////////////////////////////////////////////////////// 2665 2674 2675 int Guest::dispatchToSession(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData) 2676 { 2677 AssertPtrReturn(pvData, VERR_INVALID_POINTER); 2678 AssertReturn(cbData, VERR_INVALID_PARAMETER); 2679 2680 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2681 2682 GuestSessions::const_iterator itSession 2683 = mData.mGuestSessions.find(VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(uContextID)); 2684 if (itSession != mData.mGuestSessions.end()) 2685 { 2686 ComObjPtr<GuestSession> pSession(itSession->second); 2687 Assert(!pSession.isNull()); 2688 2689 alock.release(); 2690 return pSession->dispatchToProcess(uContextID, uFunction, pvData, cbData); 2691 } 2692 return VERR_NOT_FOUND; 2693 } 2694 2666 2695 int Guest::sessionClose(ComObjPtr<GuestSession> pSession) 2667 2696 { … … 2749 2778 #else /* VBOX_WITH_GUEST_CONTROL */ 2750 2779 2751 /* Do not allow anonymous sessions (with system rights). */ 2780 LogFlowFuncEnter(); 2781 2782 /* Do not allow anonymous sessions (with system rights) with official API. */ 2752 2783 if (RT_UNLIKELY((aUser) == NULL || *(aUser) == '\0')) 2753 2784 return setError(E_INVALIDARG, tr("No user name specified")); 2754 2785 CheckComArgOutPointerValid(aGuestSession); 2786 /* Rest is optional. */ 2755 2787 2756 2788 AutoCaller autoCaller(this); … … 2758 2790 2759 2791 int rc = sessionCreate(aUser, aPassword, aDomain, aSessionName, aGuestSession); 2760 return RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR; 2792 2793 /** @todo Do setError() here. */ 2794 HRESULT hr = RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR; 2795 LogFlowFuncLeaveRC(hr); 2796 2797 return hr; 2761 2798 #endif /* VBOX_WITH_GUEST_CONTROL */ 2762 2799 } -
trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp
r42194 r42214 22 22 #include "GuestCtrlImplPrivate.h" 23 23 24 #include <iprt/asm.h> 24 25 #include <iprt/ctype.h> 25 26 #ifdef DEBUG … … 34 35 GuestCtrlCallback::GuestCtrlCallback(void) 35 36 : mType(VBOXGUESTCTRLCALLBACKTYPE_UNKNOWN), 37 uFlags(0), 38 fCanceled(false), 36 39 pvData(NULL), 37 40 cbData(0), 38 mEventSem(NIL_RTSEMEVENT)41 hEventSem(NIL_RTSEMEVENT) 39 42 { 40 43 } … … 42 45 GuestCtrlCallback::GuestCtrlCallback(eVBoxGuestCtrlCallbackType enmType) 43 46 : mType(VBOXGUESTCTRLCALLBACKTYPE_UNKNOWN), 47 uFlags(0), 48 fCanceled(false), 44 49 pvData(NULL), 45 50 cbData(0), 46 mEventSem(NIL_RTSEMEVENT)51 hEventSem(NIL_RTSEMEVENT) 47 52 { 48 53 int rc = Init(enmType); … … 53 58 { 54 59 Destroy(); 60 } 61 62 int GuestCtrlCallback::Cancel(void) 63 { 64 if (!ASMAtomicReadBool(&fCanceled)) 65 { 66 int rc = RTSemEventSignal(hEventSem); 67 if (RT_SUCCESS(rc)) 68 ASMAtomicXchgBool(&fCanceled, true); 69 } 70 return VINF_SUCCESS; 71 } 72 73 bool GuestCtrlCallback::Canceled(void) 74 { 75 return ASMAtomicReadBool(&fCanceled); 55 76 } 56 77 … … 97 118 if (RT_SUCCESS(rc)) 98 119 { 99 rc = RTSemEventCreate(& mEventSem);120 rc = RTSemEventCreate(&hEventSem); 100 121 if (RT_SUCCESS(rc)) 101 122 mType = enmType; … … 114 135 } 115 136 cbData = 0; 116 if ( mEventSem != NIL_RTSEMEVENT)117 RTSemEventDestroy( mEventSem);137 if (hEventSem != NIL_RTSEMEVENT) 138 RTSemEventDestroy(hEventSem); 118 139 } 119 140 … … 123 144 } 124 145 125 int GuestCtrlCallback::Wait(RTMSINTERVAL timeoutMS) 126 { 127 Assert(mEventSem != NIL_RTSEMEVENT); 128 return RTSemEventWait(mEventSem, timeoutMS); 146 int GuestCtrlCallback::Wait(ULONG uTimeoutMS) 147 { 148 Assert(hEventSem != NIL_RTSEMEVENT); 149 150 RTMSINTERVAL msInterval = uTimeoutMS; 151 if (!uTimeoutMS) 152 msInterval = RT_INDEFINITE_WAIT; 153 return RTSemEventWait(hEventSem, msInterval); 129 154 } 130 155 131 156 /////////////////////////////////////////////////////////////////////////////// 132 157 133 int GuestEnvironment::BuildEnvironmentBlock(void **ppvEnv, uint32_t *pcbEnv, uint32_t *pcEnvVars)158 int GuestEnvironment::BuildEnvironmentBlock(void **ppvEnv, size_t *pcbEnv, uint32_t *pcEnvVars) 134 159 { 135 160 AssertPtrReturn(ppvEnv, VERR_INVALID_POINTER); 136 161 /* Rest is optional. */ 137 162 138 uint32_t cbEnv = 0;163 size_t cbEnv = 0; 139 164 uint32_t cEnvVars = 0; 140 165 … … 338 363 * stored in the environment block. 339 364 */ 340 int GuestEnvironment::appendToEnvBlock(const char *pszEnv, void **ppvList, uint32_t *pcbList, uint32_t *pcEnvVars)365 int GuestEnvironment::appendToEnvBlock(const char *pszEnv, void **ppvList, size_t *pcbList, uint32_t *pcEnvVars) 341 366 { 342 367 int rc = VINF_SUCCESS; 343 uint32_t cchEnv = strlen(pszEnv); Assert(cchEnv >= 2);368 size_t cchEnv = strlen(pszEnv); Assert(cchEnv >= 2); 344 369 if (*ppvList) 345 370 { 346 uint32_t cbNewLen = *pcbList + cchEnv + 1; /* Include zero termination. */371 size_t cbNewLen = *pcbList + cchEnv + 1; /* Include zero termination. */ 347 372 char *pvTmp = (char *)RTMemRealloc(*ppvList, cbNewLen); 348 373 if (pvTmp == NULL) -
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r42199 r42214 91 91 ///////////////////////////////////////////////////////////////////////////// 92 92 93 int GuestProcess::init(Console *aConsole, GuestSession *aSession, uint32_taProcessID, const GuestProcessInfo &aProcInfo)93 int GuestProcess::init(Console *aConsole, GuestSession *aSession, ULONG aProcessID, const GuestProcessInfo &aProcInfo) 94 94 { 95 95 AssertPtrReturn(aSession, VERR_INVALID_POINTER); … … 103 103 mData.mConsole = aConsole; 104 104 mData.mParent = aSession; 105 mData.mPID = 0; /* Will be assigned by the guest OS later. */ 105 106 mData.mProcessID = aProcessID; 106 107 mData.mStatus = ProcessStatus_Starting; … … 150 151 ReturnComNotImplemented(); 151 152 #else 153 LogFlowThisFuncEnter(); 154 152 155 AutoCaller autoCaller(this); 153 156 if (FAILED(autoCaller.rc())) return autoCaller.rc(); … … 169 172 collection.detachTo(ComSafeArrayOutArg(aArguments)); 170 173 174 LogFlowFuncLeaveRC(S_OK); 171 175 return S_OK; 172 176 #endif /* VBOX_WITH_GUEST_CONTROL */ … … 178 182 ReturnComNotImplemented(); 179 183 #else 184 LogFlowThisFuncEnter(); 185 180 186 AutoCaller autoCaller(this); 181 187 if (FAILED(autoCaller.rc())) return autoCaller.rc(); … … 193 199 arguments.detachTo(ComSafeArrayOutArg(aEnvironment)); 194 200 201 LogFlowFuncLeaveRC(S_OK); 195 202 return S_OK; 196 203 #endif /* VBOX_WITH_GUEST_CONTROL */ … … 202 209 ReturnComNotImplemented(); 203 210 #else 211 LogFlowThisFuncEnter(); 212 204 213 AutoCaller autoCaller(this); 205 214 if (FAILED(autoCaller.rc())) return autoCaller.rc(); … … 209 218 mData.mProcess.mCommand.cloneTo(aExecutablePath); 210 219 220 LogFlowFuncLeaveRC(S_OK); 211 221 return S_OK; 212 222 #endif /* VBOX_WITH_GUEST_CONTROL */ … … 218 228 ReturnComNotImplemented(); 219 229 #else 230 LogFlowThisFuncEnter(); 231 220 232 AutoCaller autoCaller(this); 221 233 if (FAILED(autoCaller.rc())) return autoCaller.rc(); … … 225 237 *aExitCode = mData.mExitCode; 226 238 239 LogFlowFuncLeaveRC(S_OK); 227 240 return S_OK; 228 241 #endif /* VBOX_WITH_GUEST_CONTROL */ … … 234 247 ReturnComNotImplemented(); 235 248 #else 249 LogFlowThisFuncEnter(); 250 236 251 AutoCaller autoCaller(this); 237 252 if (FAILED(autoCaller.rc())) return autoCaller.rc(); … … 241 256 *aPID = mData.mPID; 242 257 258 LogFlowFuncLeaveRC(S_OK); 243 259 return S_OK; 244 260 #endif /* VBOX_WITH_GUEST_CONTROL */ … … 250 266 ReturnComNotImplemented(); 251 267 #else 268 LogFlowThisFuncEnter(); 269 252 270 AutoCaller autoCaller(this); 253 271 if (FAILED(autoCaller.rc())) return autoCaller.rc(); … … 257 275 *aStatus = mData.mStatus; 258 276 277 LogFlowFuncLeaveRC(S_OK); 259 278 return S_OK; 260 279 #endif /* VBOX_WITH_GUEST_CONTROL */ … … 276 295 */ 277 296 278 int GuestProcess::callbackAdd( const GuestCtrlCallback& theCallback, uint32_t*puContextID)297 int GuestProcess::callbackAdd(GuestCtrlCallback *pCallback, ULONG *puContextID) 279 298 { 280 299 const ComObjPtr<GuestSession> pSession(mData.mParent); … … 286 305 /* Create a new context ID and assign it. */ 287 306 int rc = VERR_NOT_FOUND; 288 uint32_tuNewContextID = 0;289 uint32_tuTries = 0;307 ULONG uNewContextID = 0; 308 ULONG uTries = 0; 290 309 for (;;) 291 310 { 292 311 /* Create a new context ID ... */ 293 312 uNewContextID = VBOX_GUESTCTRL_CONTEXTID_MAKE(uSessionID, 294 mData.mProcessID, ASMAtomicIncU32(&mData.mNextContextID));313 mData.mProcessID, mData.mNextContextID++); 295 314 if (uNewContextID == UINT32_MAX) 296 ASMAtomicUoWriteU32(&mData.mNextContextID, 0);315 mData.mNextContextID = 0; 297 316 /* Is the context ID already used? Try next ID ... */ 298 317 if (!callbackExists(uNewContextID)) … … 312 331 { 313 332 /* Add callback with new context ID to our callback map. */ 314 mData.mCallbacks[uNewContextID] = theCallback;333 mData.mCallbacks[uNewContextID] = pCallback; 315 334 Assert(mData.mCallbacks.size()); 316 335 … … 323 342 } 324 343 325 bool GuestProcess::callbackExists(uint32_t uContextID) 344 int GuestProcess::callbackDispatcher(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData) 345 { 346 AssertPtrReturn(pvData, VERR_INVALID_POINTER); 347 AssertReturn(cbData, VERR_INVALID_PARAMETER); 348 349 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 350 351 GuestCtrlCallbacks::const_iterator it 352 = mData.mCallbacks.find(VBOX_GUESTCTRL_CONTEXTID_GET_COUNT(uContextID)); 353 if (it != mData.mCallbacks.end()) 354 { 355 std::auto_ptr<GuestCtrlCallback> pCallback = it->second; 356 AssertPtr(pCallback.get()); 357 358 int rc; 359 360 switch (uFunction) 361 { 362 case GUEST_DISCONNECTED: 363 { 364 PCALLBACKDATACLIENTDISCONNECTED pCBData = reinterpret_cast<PCALLBACKDATACLIENTDISCONNECTED>(pvData); 365 AssertPtr(pCBData); 366 AssertReturn(sizeof(CALLBACKDATACLIENTDISCONNECTED) == cbData, VERR_INVALID_PARAMETER); 367 AssertReturn(CALLBACKDATAMAGIC_CLIENT_DISCONNECTED == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER); 368 369 rc = onGuestDisconnected(); /* Affects all callbacks. */ 370 break; 371 } 372 373 case GUEST_EXEC_SEND_STATUS: 374 { 375 PCALLBACKDATAEXECSTATUS pCBData = reinterpret_cast<PCALLBACKDATAEXECSTATUS>(pvData); 376 AssertPtr(pCBData); 377 AssertReturn(sizeof(CALLBACKDATAEXECSTATUS) == cbData, VERR_INVALID_PARAMETER); 378 AssertReturn(CALLBACKDATAMAGIC_EXEC_STATUS == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER); 379 380 rc = onProcessStatusChange(pCBData->u32Status, pCBData->u32Flags, pCBData->u32PID); 381 break; 382 } 383 384 case GUEST_EXEC_SEND_OUTPUT: 385 { 386 PCALLBACKDATAEXECOUT pCBData = reinterpret_cast<PCALLBACKDATAEXECOUT>(pvData); 387 AssertPtr(pCBData); 388 AssertReturn(sizeof(CALLBACKDATAEXECOUT) == cbData, VERR_INVALID_PARAMETER); 389 AssertReturn(CALLBACKDATAMAGIC_EXEC_OUT == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER); 390 391 Assert(mData.mPID == pCBData->u32PID); 392 rc = onProcessOutput(pCBData->u32HandleId, pCBData->u32Flags, pCBData->pvData, pCBData->cbData); 393 break; 394 } 395 396 case GUEST_EXEC_SEND_INPUT_STATUS: 397 { 398 PCALLBACKDATAEXECINSTATUS pCBData = reinterpret_cast<PCALLBACKDATAEXECINSTATUS>(pvData); 399 AssertPtr(pCBData); 400 AssertReturn(sizeof(CALLBACKDATAEXECINSTATUS) == cbData, VERR_INVALID_PARAMETER); 401 AssertReturn(CALLBACKDATAMAGIC_EXEC_IN_STATUS == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER); 402 403 Assert(mData.mPID == pCBData->u32PID); 404 rc = onProcessInputStatus(pCBData->u32Status, pCBData->u32Flags, pCBData->cbProcessed); 405 break; 406 } 407 408 default: 409 /* Silently ignore not implemented functions. */ 410 rc = VERR_NOT_IMPLEMENTED; 411 break; 412 } 413 414 return rc; 415 } 416 417 return VERR_NOT_FOUND; 418 } 419 420 bool GuestProcess::callbackExists(ULONG uContextID) 326 421 { 327 422 AssertReturn(uContextID, false); … … 344 439 } 345 440 346 int GuestProcess:: readData(ULONG aHandle, ULONG aSize, ULONG aTimeoutMS, ComSafeArrayOut(BYTE, aData))347 { 348 LogFlowFunc Enter();441 int GuestProcess::onGuestDisconnected(void) 442 { 443 LogFlowFunc(("uPID=%RU32", mData.mPID)); 349 444 350 445 LogFlowFuncLeave(); … … 352 447 } 353 448 449 int GuestProcess::onProcessInputStatus(uint32_t uStatus, uint32_t uFlags, uint32_t cbDataProcessed) 450 { 451 LogFlowFunc(("uPID=%RU32, uStatus=%RU32, uFlags=%RU32, cbDataProcessed=%RU32\n", 452 mData.mPID, uStatus, uFlags, cbDataProcessed)); 453 454 LogFlowFuncLeave(); 455 return 0; 456 } 457 458 int GuestProcess::onProcessStatusChange(uint32_t uStatus, uint32_t uFlags, uint32_t uPID) 459 { 460 LogFlowFunc(("uPID=%RU32, uStatus=%RU32, uFlags=%RU32\n", 461 uPID, uStatus, uFlags)); 462 463 LogFlowFuncLeave(); 464 return 0; 465 } 466 467 int GuestProcess::onProcessOutput(uint32_t uHandle, uint32_t uFlags, void *pvData, uint32_t cbData) 468 { 469 LogFlowFunc(("uPID=%RU32, uHandle=%RU32, uFlags=%RU32, pvData=%p, cbData=%RU32\n", 470 mData.mPID, uHandle, uFlags, pvData, cbData)); 471 472 LogFlowFuncLeave(); 473 return 0; 474 } 475 476 int GuestProcess::readData(ULONG uHandle, ULONG uSize, ULONG uTimeoutMS, BYTE *pbData, size_t cbData) 477 { 478 LogFlowFunc(("uPID=%RU32, uHandle=%RU32, uSize=%RU32, uTimeoutMS=%RU32, pbData=%p, cbData=%z\n", 479 mData.mPID, uHandle, uSize, uTimeoutMS, pbData, cbData)); 480 AssertReturn(uSize, VERR_INVALID_PARAMETER); 481 AssertPtrReturn(pbData, VERR_INVALID_POINTER); 482 AssertReturn(cbData >= uSize, VERR_INVALID_PARAMETER); 483 484 LogFlowFuncLeave(); 485 return 0; 486 } 487 354 488 int GuestProcess::startProcess(void) 355 489 { 356 LogFlowFuncEnter(); 490 LogFlowFunc(("aCmd=%s, aTimeoutMS=%RU32, fFlags=%x\n", 491 mData.mProcess.mCommand.c_str(), mData.mProcess.mTimeoutMS, mData.mProcess.mFlags)); 357 492 358 493 AssertReturn(!mData.mStarted, VERR_ALREADY_EXISTS); 359 494 360 495 int rc; 361 uint32_t uContextID; 496 ULONG uContextID; 497 GuestCtrlCallback *pCallbackStart = (GuestCtrlCallback *)RTMemAlloc(sizeof(GuestCtrlCallback)); 498 if (!pCallbackStart) 499 return VERR_NO_MEMORY; 362 500 363 501 { … … 367 505 368 506 /* Create callback and add it to the map. */ 369 GuestCtrlCallback callbackStart; 370 rc = callbackStart.Init(VBOXGUESTCTRLCALLBACKTYPE_EXEC_START); 371 if (RT_FAILURE(rc)) 372 return rc; 373 374 rc = callbackAdd(callbackStart, &uContextID); 507 rc = pCallbackStart->Init(VBOXGUESTCTRLCALLBACKTYPE_EXEC_START); 508 if (RT_SUCCESS(rc)) 509 rc = callbackAdd(pCallbackStart, &uContextID); 510 } 511 512 if (RT_SUCCESS(rc)) 513 { 375 514 Assert(uContextID); 376 } 377 378 if (RT_SUCCESS(rc)) 379 { 515 380 516 ComObjPtr<GuestSession> pSession(mData.mParent); 381 517 Assert(!pSession.isNull()); … … 397 533 rc = RTGetOptArgvToString(&pszArgs, papszArgv, RTGETOPTARGV_CNV_QUOTE_MS_CRT); 398 534 } 399 uint32_t cbArgs = pszArgs ? strlen(pszArgs) + 1 : 0; /* Include terminating zero. */535 size_t cbArgs = pszArgs ? strlen(pszArgs) + 1 : 0; /* Include terminating zero. */ 400 536 401 537 /* Prepare environment. */ 402 538 void *pvEnv = NULL; 403 uint32_t cbEnv = 0;539 size_t cbEnv = 0; 404 540 rc = mData.mProcess.mEnvironment.BuildEnvironmentBlock(&pvEnv, &cbEnv, NULL /* cEnv */); 405 541 … … 411 547 paParms[i++].setUInt32(uContextID); 412 548 paParms[i++].setPointer((void*)mData.mProcess.mCommand.c_str(), 413 ( uint32_t)mData.mProcess.mCommand.length() + 1);549 (ULONG)mData.mProcess.mCommand.length() + 1); 414 550 paParms[i++].setUInt32(mData.mProcess.mFlags); 415 551 paParms[i++].setUInt32(mData.mProcess.mArguments.size()); … … 418 554 paParms[i++].setUInt32(cbEnv); 419 555 paParms[i++].setPointer((void*)pvEnv, cbEnv); 420 paParms[i++].setPointer((void*)sessionCreds.mUser.c_str(), ( uint32_t)sessionCreds.mUser.length() + 1);421 paParms[i++].setPointer((void*)sessionCreds.mPassword.c_str(), ( uint32_t)sessionCreds.mPassword.length() + 1);556 paParms[i++].setPointer((void*)sessionCreds.mUser.c_str(), (ULONG)sessionCreds.mUser.length() + 1); 557 paParms[i++].setPointer((void*)sessionCreds.mPassword.c_str(), (ULONG)sessionCreds.mPassword.length() + 1); 422 558 423 559 /* … … 454 590 if (pszArgs) 455 591 RTStrFree(pszArgs); 592 593 if (RT_SUCCESS(rc)) 594 { 595 /* 596 * Let's wait for the process being started. 597 * Note: Be sure not keeping a AutoRead/WriteLock here. 598 */ 599 rc = pCallbackStart->Wait(mData.mProcess.mTimeoutMS); 600 } 456 601 } 457 602 … … 464 609 LogFlowFuncEnter(); 465 610 466 const ComObjPtr<GuestProcess> pProcess = static_cast<GuestProcess*>(pvUser); 611 std::auto_ptr<GuestProcessStartTask> pTask(static_cast<GuestProcessStartTask*>(pvUser)); 612 AssertPtr(pTask.get()); 613 614 const ComObjPtr<GuestProcess> pProcess(pTask->mProcess); 467 615 Assert(!pProcess.isNull()); 468 616 … … 483 631 } 484 632 485 int GuestProcess::waitFor(ComSafeArrayIn(ProcessWaitForFlag_T, aFlags), ULONG aTimeoutMS, ProcessWaitReason_T *aReason) 486 { 487 LogFlowFuncEnter(); 633 int GuestProcess::waitFor(uint32_t fFlags, ULONG uTimeoutMS, ProcessWaitReason_T *penmReason) 634 { 635 LogFlowFunc(("fFlags=%x, uTimeoutMS=%RU32, penmReason=%p\n", 636 fFlags, uTimeoutMS, penmReason)); 488 637 489 638 LogFlowFuncLeave(); … … 491 640 } 492 641 493 int GuestProcess::writeData(ULONG aHandle, ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten) 494 { 495 LogFlowFuncEnter(); 642 int GuestProcess::writeData(ULONG uHandle, const BYTE *pbData, size_t cbData, ULONG uTimeoutMS, ULONG *puWritten) 643 { 644 LogFlowFunc(("uPID=%RU32, uHandle=%RU32, pbData=%p, cbData=%z, uTimeoutMS=%RU32, puWritten=%p\n", 645 mData.mPID, uHandle, pbData, cbData, uTimeoutMS, puWritten)); 646 AssertPtrReturn(pbData, VERR_INVALID_POINTER); 647 AssertReturn(pbData, VERR_INVALID_PARAMETER); 648 /* Rest is optional. */ 496 649 497 650 LogFlowFuncLeave(); … … 507 660 ReturnComNotImplemented(); 508 661 #else 509 510 AutoCaller autoCaller(this); 511 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 512 513 int rc = readData(aHandle, aSize, aTimeoutMS, ComSafeArrayOutArg(aData)); 662 LogFlowThisFuncEnter(); 663 664 if (aSize == 0) 665 return setError(E_INVALIDARG, tr("Invalid size to read specified")); 666 CheckComArgOutSafeArrayPointerValid(aData); 667 668 AutoCaller autoCaller(this); 669 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 670 671 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 672 673 com::SafeArray<BYTE> data(aSize); 674 int rc = readData(aHandle, aSize, aTimeoutMS, data.raw(), aSize); 675 if (RT_SUCCESS(rc)) 676 data.detachTo(ComSafeArrayOutArg(aData)); 677 514 678 /** @todo Do setError() here. */ 515 return RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR; 679 HRESULT hr = RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR; 680 LogFlowFuncLeaveRC(hr); 681 682 return hr; 516 683 #endif /* VBOX_WITH_GUEST_CONTROL */ 517 684 } … … 522 689 ReturnComNotImplemented(); 523 690 #else 691 LogFlowThisFuncEnter(); 692 524 693 AutoCaller autoCaller(this); 525 694 if (FAILED(autoCaller.rc())) return autoCaller.rc(); … … 527 696 int rc = terminateProcess(); 528 697 /** @todo Do setError() here. */ 529 return RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR; 698 HRESULT hr = RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR; 699 LogFlowFuncLeaveRC(hr); 700 701 return hr; 530 702 #endif /* VBOX_WITH_GUEST_CONTROL */ 531 703 } … … 536 708 ReturnComNotImplemented(); 537 709 #else 538 AutoCaller autoCaller(this); 539 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 540 541 int rc = waitFor(ComSafeArrayInArg(aFlags), aTimeoutMS, aReason); 710 LogFlowThisFuncEnter(); 711 712 CheckComArgOutPointerValid(aReason); 713 714 AutoCaller autoCaller(this); 715 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 716 717 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 718 719 uint32_t fFlags = ProcessWaitForFlag_None; 720 com::SafeArray<ProcessWaitForFlag_T> flags(ComSafeArrayInArg(aFlags)); 721 for (size_t i = 0; i < flags.size(); i++) 722 fFlags |= flags[i]; 723 724 int rc = waitFor(fFlags, aTimeoutMS, aReason); 542 725 /** @todo Do setError() here. */ 543 return RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR; 726 HRESULT hr = RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR; 727 LogFlowFuncLeaveRC(hr); 728 729 return hr; 544 730 #endif /* VBOX_WITH_GUEST_CONTROL */ 545 731 } … … 550 736 ReturnComNotImplemented(); 551 737 #else 552 AutoCaller autoCaller(this); 553 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 554 555 int rc = writeData(aHandle, ComSafeArrayInArg(aData), aTimeoutMS, aWritten); 738 LogFlowThisFuncEnter(); 739 740 CheckComArgOutPointerValid(aWritten); 741 742 AutoCaller autoCaller(this); 743 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 744 745 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 746 747 com::SafeArray<BYTE> data(aData); 748 int rc = writeData(aHandle, data.raw(), data.size(), aTimeoutMS, aWritten); 556 749 /** @todo Do setError() here. */ 557 return RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR; 558 #endif /* VBOX_WITH_GUEST_CONTROL */ 559 } 560 750 HRESULT hr = RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR; 751 LogFlowFuncLeaveRC(hr); 752 753 return hr; 754 #endif /* VBOX_WITH_GUEST_CONTROL */ 755 } 756 -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r42194 r42214 55 55 ///////////////////////////////////////////////////////////////////////////// 56 56 57 int GuestSession::init(Guest *aGuest, uint32_taSessionID,57 int GuestSession::init(Guest *aGuest, ULONG aSessionID, 58 58 Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName) 59 59 { … … 347 347 } 348 348 349 return VERR_NOT_FOUND; 350 } 351 352 int GuestSession::dispatchToProcess(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData) 353 { 354 AssertPtrReturn(pvData, VERR_INVALID_POINTER); 355 AssertReturn(cbData, VERR_INVALID_PARAMETER); 356 357 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 358 359 SessionProcesses::const_iterator itProc 360 = mData.mProcesses.find(VBOX_GUESTCTRL_CONTEXTID_GET_PROCESS(uContextID)); 361 if (itProc != mData.mProcesses.end()) 362 { 363 ComObjPtr<GuestProcess> pProcess(itProc->second); 364 Assert(!pProcess.isNull()); 365 366 alock.release(); 367 return pProcess->callbackDispatcher(uContextID, uFunction, pvData, cbData); 368 } 349 369 return VERR_NOT_FOUND; 350 370 } … … 422 442 423 443 /* Create a new (host-based) process ID and assign it. */ 424 uint32_tuNewProcessID = 0;425 uint32_tuTries = 0;444 ULONG uNewProcessID = 0; 445 ULONG uTries = 0; 426 446 427 447 for (;;) 428 448 { 429 449 /* Is the context ID already used? Try next ID ... */ 430 if (!processExists(uNewProcessID++ ))450 if (!processExists(uNewProcessID++, NULL /* pProgress */)) 431 451 { 432 452 /* Callback with context ID was not found. This means … … 467 487 } 468 488 469 inline bool GuestSession::processExists( uint32_t uProcessID)489 inline bool GuestSession::processExists(ULONG uProcessID, ComObjPtr<GuestProcess> *pProcess) 470 490 { 471 491 AssertReturn(uProcessID, false); 472 492 473 SessionProcesses::const_iterator itProcesses = mData.mProcesses.find(uProcessID); 474 return (itProcesses == mData.mProcesses.end()) ? false : true; 493 SessionProcesses::const_iterator it = mData.mProcesses.find(uProcessID); 494 if (it != mData.mProcesses.end()) 495 { 496 if (pProcess) 497 *pProcess = it->second; 498 return true; 499 } 500 return false; 501 } 502 503 inline int GuestSession::processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess) 504 { 505 AssertReturn(uPID, false); 506 /* pProcess is optional. */ 507 508 SessionProcesses::iterator it = mData.mProcesses.begin(); 509 for (; it != mData.mProcesses.end(); it++) 510 { 511 ComObjPtr<GuestProcess> pCurProc = it->second; 512 AutoCaller procCaller(pCurProc); 513 if (procCaller.rc()) 514 return VERR_COM_INVALID_OBJECT_STATE; 515 516 if (it->second->getPID() == uPID) 517 { 518 if (pProcess) 519 *pProcess = pCurProc; 520 return VINF_SUCCESS; 521 } 522 } 523 524 return VERR_NOT_FOUND; 475 525 } 476 526 … … 897 947 LogFlowThisFuncEnter(); 898 948 899 AutoCaller autoCaller(this); 900 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 901 949 if (RT_UNLIKELY((aCommand) == NULL || *(aCommand) == '\0')) 950 return setError(E_INVALIDARG, tr("No command to execute specified")); 902 951 CheckComArgOutPointerValid(aProcess); 952 953 AutoCaller autoCaller(this); 954 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 903 955 904 956 GuestProcessInfo procInfo; … … 925 977 if (RT_SUCCESS(rc)) 926 978 { 927 928 979 com::SafeArray<ProcessCreateFlag_T> flags(ComSafeArrayInArg(aFlags)); 929 980 for (size_t i = 0; i < flags.size(); i++) … … 953 1004 ReturnComNotImplemented(); 954 1005 #else 955 LogFlowThisFuncEnter(); 956 957 AutoCaller autoCaller(this); 958 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 959 960 ReturnComNotImplemented(); 1006 LogFlowThisFunc(("aPID=%RU32\n", aPID)); 1007 1008 CheckComArgOutPointerValid(aProcess); 1009 if (aPID == 0) 1010 return setError(E_INVALIDARG, tr("No valid process ID (PID) specified")); 1011 1012 AutoCaller autoCaller(this); 1013 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1014 1015 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1016 1017 HRESULT hr = S_OK; 1018 1019 ComObjPtr<GuestProcess> pProcess; 1020 int rc = processGetByPID(aPID, &pProcess); 1021 if (RT_FAILURE(rc)) 1022 hr = setError(E_INVALIDARG, tr("No process with PID %RU32 found"), aPID); 1023 1024 /* This will set (*aProcess) to NULL if pProgress is NULL. */ 1025 HRESULT hr2 = pProcess.queryInterfaceTo(aProcess); 1026 if (SUCCEEDED(hr)) 1027 hr = hr2; 1028 1029 LogFlowThisFunc(("aProcess=%p, hr=%Rrc\n", *aProcess, hr)); 1030 return hr; 961 1031 #endif /* VBOX_WITH_GUEST_CONTROL */ 962 1032 } … … 972 1042 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 973 1043 974 ReturnComNotImplemented(); 1044 if (aTimeoutMS < 1000) 1045 return setError(E_INVALIDARG, tr("Invalid timeout value specified")); 1046 1047 mData.mTimeout = aTimeoutMS; 1048 1049 LogFlowThisFunc(("aTimeoutMS=%RU32\n", mData.mTimeout)); 1050 return S_OK; 975 1051 #endif /* VBOX_WITH_GUEST_CONTROL */ 976 1052 } -
trunk/src/VBox/Main/testcase/Makefile.kmk
r42160 r42214 29 29 $(if $(VBOX_WITH_XPCOM),tstVBoxAPILinux,tstVBoxAPIWin) \ 30 30 $(if $(VBOX_WITH_RESOURCE_USAGE_API),tstCollector,) \ 31 $(if $(VBOX_WITH_GUEST_CONTROL),tstGuestCtrlParseBuffer,) 31 $(if $(VBOX_WITH_GUEST_CONTROL),tstGuestCtrlParseBuffer,) \ 32 $(if $(VBOX_WITH_GUEST_CONTROL),tstGuestCtrlContextID,) 32 33 PROGRAMS.linux += \ 33 34 $(if $(VBOX_WITH_USB),tstUSBProxyLinux,) … … 160 161 else 161 162 tstGuestCtrlParseBuffer_DEPS = $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h 163 endif 164 165 166 # 167 # tstGuestCtrlContextID 168 # 169 tstGuestCtrlContextID_TEMPLATE = VBOXMAINCLIENTEXE 170 tstGuestCtrlContextID_DEFS += VBOX_WITH_HGCM VBOX_WITH_GUEST_CONTROL 171 tstGuestCtrlContextID_SOURCES = \ 172 tstGuestCtrlContextID.cpp \ 173 ../src-client/GuestCtrlPrivate.cpp 174 tstGuestCtrlContextID_INCS = ../include 175 ifeq ($(KBUILD_TARGET),win) ## @todo just add this to the template. 176 tstGuestCtrlContextID_DEPS = $(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h 177 else 178 tstGuestCtrlContextID_DEPS = $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h 162 179 endif 163 180 -
trunk/src/VBox/Main/testcase/tstGuestCtrlParseBuffer.cpp
r42197 r42214 205 205 if (iResult != aTestBlock[iTest].iResult) 206 206 { 207 RTTestFailed(hTest, "\tReturned %Rrc, expected %Rrc ",207 RTTestFailed(hTest, "\tReturned %Rrc, expected %Rrc\n", 208 208 iResult, aTestBlock[iTest].iResult); 209 209 } 210 210 else if (stream.GetOffset() != aTestBlock[iTest].uOffsetAfter) 211 211 { 212 RTTestFailed(hTest, "\tOffset %u wrong, expected %u ",212 RTTestFailed(hTest, "\tOffset %u wrong, expected %u\n", 213 213 stream.GetOffset(), aTestBlock[iTest].uOffsetAfter); 214 214 } … … 223 223 if (curBlock.GetCount() != aTestBlock[iTest].uMapElements) 224 224 { 225 RTTestFailed(hTest, "\tMap has %u elements, expected %u ",225 RTTestFailed(hTest, "\tMap has %u elements, expected %u\n", 226 226 curBlock.GetCount(), aTestBlock[iTest].uMapElements); 227 227 } … … 275 275 if (iResult != aTestStream[iTest].iResult) 276 276 { 277 RTTestFailed(hTest, "\tReturned %Rrc, expected %Rrc ",277 RTTestFailed(hTest, "\tReturned %Rrc, expected %Rrc\n", 278 278 iResult, aTestStream[iTest].iResult); 279 279 }
Note:
See TracChangeset
for help on using the changeset viewer.