Changeset 104178 in vbox for trunk/src/VBox/Main/include
- Timestamp:
- Apr 5, 2024 12:23:48 PM (10 months ago)
- Location:
- trunk/src/VBox/Main/include
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h
r104003 r104178 968 968 }; 969 969 970 /** 971 * Generic class for handling a guest process output (i.e. stdout / stderr) stream. 972 */ 973 class GuestProcessOutputStream 974 { 975 public: 976 977 GuestProcessOutputStream(); 978 979 virtual ~GuestProcessOutputStream(); 980 981 public: 982 983 int AddData(const BYTE *pbData, size_t cbData); 984 985 void Destroy(); 986 987 #ifdef DEBUG 988 void Dump(const char *pszFile); 989 #endif 990 991 size_t GetOffset(void) const { return m_offBuf; } 992 993 size_t GetSize(void) const { return m_cbUsed; } 994 995 const BYTE *GetData(void) const { return m_pbBuffer; } 996 997 protected: 998 999 /** Maximum allowed size the stream buffer can grow to. 1000 * Defaults to 32 MB. */ 1001 size_t m_cbMax; 1002 /** Currently allocated size of internal stream buffer. */ 1003 size_t m_cbAllocated; 1004 /** Currently used size at m_offBuffer. */ 1005 size_t m_cbUsed; 1006 /** Current byte offset within the internal stream buffer. */ 1007 size_t m_offBuf; 1008 /** Internal stream buffer. */ 1009 BYTE *m_pbBuffer; 1010 }; 970 1011 971 1012 /** … … 1010 1051 * 1011 1052 * Only used for the busybox-like toolbox commands within VBoxService. 1053 * 1012 1054 * Deprecated, do not use anymore. 1013 1055 */ … … 1082 1124 * Deprecated, do not use anymore. 1083 1125 */ 1084 class GuestToolboxStream 1126 class GuestToolboxStream : public GuestProcessOutputStream 1085 1127 { 1086 1128 … … 1093 1135 public: 1094 1136 1095 int AddData(const BYTE *pbData, size_t cbData);1096 1097 void Destroy();1098 1099 #ifdef DEBUG1100 void Dump(const char *pszFile);1101 #endif1102 1103 size_t GetOffset(void) const { return m_offBuf; }1104 1105 size_t GetSize(void) const { return m_cbUsed; }1106 1107 1137 size_t GetBlocks(void) const { return m_cBlocks; } 1108 1138 … … 1111 1141 protected: 1112 1142 1113 /** Maximum allowed size the stream buffer can grow to.1114 * Defaults to 32 MB. */1115 size_t m_cbMax;1116 /** Currently allocated size of internal stream buffer. */1117 size_t m_cbAllocated;1118 /** Currently used size at m_offBuffer. */1119 size_t m_cbUsed;1120 /** Current byte offset within the internal stream buffer. */1121 size_t m_offBuf;1122 /** Internal stream buffer. */1123 BYTE *m_pbBuffer;1124 1143 /** How many completed stream blocks already were processed. */ 1125 1144 size_t m_cBlocks; -
trunk/src/VBox/Main/include/GuestProcessImpl.h
r98614 r104178 217 217 218 218 /** 219 * Wrapper class for running guest processes. 220 */ 221 class GuestProcessWrapper 222 { 223 public: 224 DECLARE_TRANSLATE_METHODS(GuestProcessWrapper) 225 226 GuestProcessWrapper(void); 227 228 virtual ~GuestProcessWrapper(void); 229 230 public: 231 232 int init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, bool fAsync, int *pvrcGuest); 233 234 void uninit(void); 235 236 /** Returns the stdout output from the guest process. */ 237 GuestProcessOutputStream &getStdOut(void) { return mStdOut; } 238 239 /** Returns the stderr output from the guest proces. */ 240 GuestProcessOutputStream &getStdErr(void) { return mStdErr; } 241 242 bool isRunning(void); 243 244 bool isTerminatedOk(void); 245 246 int getTerminationStatus(int32_t *piExitCode = NULL); 247 248 int terminate(uint32_t uTimeoutMS, int *pvrcGuest); 249 250 protected: 251 252 /** Pointer to session this toolbox object is bound to. */ 253 ComObjPtr<GuestSession> pSession; 254 /** Pointer to process object this object is bound to. */ 255 ComObjPtr<GuestProcess> pProcess; 256 /** The process startup info. */ 257 GuestProcessStartupInfo mStartupInfo; 258 /** Stream object for handling stdout data. */ 259 GuestProcessOutputStream mStdOut; 260 /** Stream object for handling stderr data. */ 261 GuestProcessOutputStream mStdErr; 262 }; 263 264 #ifdef VBOX_WITH_GSTCTL_TOOLBOX_SUPPORT 265 /** 219 266 * Internal class for handling the BusyBox-like tools built into VBoxService 220 267 * on the guest side. It's also called the VBoxService Toolbox (tm). … … 228 275 * Note! When implementing new functionality / commands, do *not* use this approach anymore! 229 276 * This class has to be kept to guarantee backwards-compatibility. 230 */ 231 class GuestProcessToolbox 277 * 278 * Deprecated, do not use anymore. 279 */ 280 class GuestProcessToolbox : public GuestProcessWrapper 232 281 { 233 282 public: 234 DECLARE_TRANSLATE_METHODS(GuestProcessTool )283 DECLARE_TRANSLATE_METHODS(GuestProcessToolbox) 235 284 236 285 GuestProcessToolbox(void); … … 240 289 public: 241 290 242 int init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, bool fAsync, int *pvrcGuest);243 244 void uninit(void);291 int wait(uint32_t fToolWaitFlags, int *pvrcGuest); 292 293 int waitEx(uint32_t fToolWaitFlags, GuestToolboxStreamBlock *strmBlockOut, int *pvrcGuest); 245 294 246 295 int getCurrentBlock(uint32_t uHandle, GuestToolboxStreamBlock &strmBlock); … … 253 302 /** Returns the stderr output from the guest process tool. */ 254 303 GuestToolboxStream &getStdErr(void) { return mStdErr; } 255 256 int wait(uint32_t fToolWaitFlags, int *pvrcGuest);257 258 int waitEx(uint32_t fToolWaitFlags, GuestToolboxStreamBlock *pStreamBlock, int *pvrcGuest);259 260 bool isRunning(void);261 262 bool isTerminatedOk(void);263 264 int getTerminationStatus(int32_t *piExitCode = NULL);265 266 int terminate(uint32_t uTimeoutMS, int *pvrcGuest);267 304 268 305 public: … … 282 319 * @{ */ 283 320 static int exitCodeToRc(const GuestProcessStartupInfo &startupInfo, int32_t iExitCode); 284 285 321 static int exitCodeToRc(const char *pszTool, int32_t iExitCode); 286 322 /** @} */ … … 293 329 protected: 294 330 295 /** Pointer to session this toolbox object is bound to. */296 ComObjPtr<GuestSession> pSession;297 /** Pointer to process object this toolbox object is bound to. */298 ComObjPtr<GuestProcess> pProcess;299 /** The toolbox' startup info. */300 GuestProcessStartupInfo mStartupInfo;301 331 /** Stream object for handling the toolbox' stdout data. */ 302 332 GuestToolboxStream mStdOut; … … 304 334 GuestToolboxStream mStdErr; 305 335 }; 336 #endif /* VBOX_WITH_GSTCTL_TOOLBOX_SUPPORT */ 306 337 307 338 #endif /* !MAIN_INCLUDED_GuestProcessImpl_h */ -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r102654 r104178 363 363 /** @} */ 364 364 365 #ifdef VBOX_WITH_GSTCTL_TOOLBOX_SUPPORT 365 366 /** @name Public internal methods for supporting older Guest Additions via 366 * VBoxService' built-in toolbox (< 7.1). 367 * VBoxService' built-in toolbox (< 7.1). Deprecated, do not use anymore. 367 368 * @{ */ 368 369 int i_directoryCreateViaToolbox(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pvrcGuest); … … 372 373 int i_fsObjQueryInfoViaToolbox(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest); 373 374 /** @} */ 375 #endif /* VBOX_WITH_GSTCTL_TOOLBOX_SUPPORT */ 374 376 375 377 public:
Note:
See TracChangeset
for help on using the changeset viewer.