1 |
|
---|
2 | /* $Id: GuestProcessImpl.cpp 42095 2012-07-10 12:58:13Z vboxsync $ */
|
---|
3 | /** @file
|
---|
4 | * VirtualBox Main - XXX.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2012 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 |
|
---|
20 | /*******************************************************************************
|
---|
21 | * Header Files *
|
---|
22 | *******************************************************************************/
|
---|
23 | #include "GuestProcessImpl.h"
|
---|
24 |
|
---|
25 | #include "Global.h"
|
---|
26 | #include "AutoCaller.h"
|
---|
27 | #include "Logging.h"
|
---|
28 |
|
---|
29 |
|
---|
30 | // constructor / destructor
|
---|
31 | /////////////////////////////////////////////////////////////////////////////
|
---|
32 |
|
---|
33 | DEFINE_EMPTY_CTOR_DTOR(GuestProcess)
|
---|
34 |
|
---|
35 | HRESULT GuestProcess::FinalConstruct(void)
|
---|
36 | {
|
---|
37 | LogFlowThisFunc(("\n"));
|
---|
38 | return BaseFinalConstruct();
|
---|
39 | }
|
---|
40 |
|
---|
41 | void GuestProcess::FinalRelease(void)
|
---|
42 | {
|
---|
43 | LogFlowThisFuncEnter();
|
---|
44 | uninit();
|
---|
45 | BaseFinalRelease();
|
---|
46 | LogFlowThisFuncLeave();
|
---|
47 | }
|
---|
48 |
|
---|
49 | // public initializer/uninitializer for internal purposes only
|
---|
50 | /////////////////////////////////////////////////////////////////////////////
|
---|
51 |
|
---|
52 | HRESULT GuestProcess::init(void)
|
---|
53 | {
|
---|
54 | /* Enclose the state transition NotReady->InInit->Ready. */
|
---|
55 | AutoInitSpan autoInitSpan(this);
|
---|
56 | AssertReturn(autoInitSpan.isOk(), E_FAIL);
|
---|
57 |
|
---|
58 | /* Confirm a successful initialization when it's the case. */
|
---|
59 | autoInitSpan.setSucceeded();
|
---|
60 |
|
---|
61 | return S_OK;
|
---|
62 | }
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Uninitializes the instance.
|
---|
66 | * Called from FinalRelease().
|
---|
67 | */
|
---|
68 | void GuestProcess::uninit(void)
|
---|
69 | {
|
---|
70 | LogFlowThisFunc(("\n"));
|
---|
71 |
|
---|
72 | /* Enclose the state transition Ready->InUninit->NotReady. */
|
---|
73 | AutoUninitSpan autoUninitSpan(this);
|
---|
74 | if (autoUninitSpan.uninitDone())
|
---|
75 | return;
|
---|
76 | }
|
---|
77 |
|
---|
78 | // implementation of public getters/setters for attributes
|
---|
79 | /////////////////////////////////////////////////////////////////////////////
|
---|
80 |
|
---|
81 | STDMETHODIMP GuestProcess::COMGETTER(Arguments)(ComSafeArrayOut(BSTR, aArguments))
|
---|
82 | {
|
---|
83 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
84 | ReturnComNotImplemented();
|
---|
85 | #else
|
---|
86 | AutoCaller autoCaller(this);
|
---|
87 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
88 |
|
---|
89 | CheckComArgOutSafeArrayPointerValid(aArguments);
|
---|
90 |
|
---|
91 | ReturnComNotImplemented();
|
---|
92 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
93 | }
|
---|
94 |
|
---|
95 | STDMETHODIMP GuestProcess::COMGETTER(Environment)(ComSafeArrayOut(BSTR, aEnvironment))
|
---|
96 | {
|
---|
97 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
98 | ReturnComNotImplemented();
|
---|
99 | #else
|
---|
100 | AutoCaller autoCaller(this);
|
---|
101 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
102 |
|
---|
103 | CheckComArgOutSafeArrayPointerValid(aEnvironment);
|
---|
104 |
|
---|
105 | ReturnComNotImplemented();
|
---|
106 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
107 | }
|
---|
108 |
|
---|
109 | STDMETHODIMP GuestProcess::COMGETTER(ExecutablePath)(BSTR *aExecutablePath)
|
---|
110 | {
|
---|
111 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
112 | ReturnComNotImplemented();
|
---|
113 | #else
|
---|
114 | AutoCaller autoCaller(this);
|
---|
115 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
116 |
|
---|
117 | ReturnComNotImplemented();
|
---|
118 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
119 | }
|
---|
120 |
|
---|
121 | STDMETHODIMP GuestProcess::COMGETTER(ExitCode)(LONG *aExitCode)
|
---|
122 | {
|
---|
123 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
124 | ReturnComNotImplemented();
|
---|
125 | #else
|
---|
126 | AutoCaller autoCaller(this);
|
---|
127 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
128 |
|
---|
129 | ReturnComNotImplemented();
|
---|
130 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
131 | }
|
---|
132 |
|
---|
133 | STDMETHODIMP GuestProcess::COMGETTER(PID)(ULONG *aPID)
|
---|
134 | {
|
---|
135 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
136 | ReturnComNotImplemented();
|
---|
137 | #else
|
---|
138 | AutoCaller autoCaller(this);
|
---|
139 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
140 |
|
---|
141 | ReturnComNotImplemented();
|
---|
142 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
143 | }
|
---|
144 |
|
---|
145 | STDMETHODIMP GuestProcess::COMGETTER(Status)(ProcessStatus_T *aStatus)
|
---|
146 | {
|
---|
147 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
148 | ReturnComNotImplemented();
|
---|
149 | #else
|
---|
150 | AutoCaller autoCaller(this);
|
---|
151 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
152 |
|
---|
153 | ReturnComNotImplemented();
|
---|
154 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
155 | }
|
---|
156 |
|
---|
157 | // implementation of public methods
|
---|
158 | /////////////////////////////////////////////////////////////////////////////
|
---|
159 |
|
---|
160 | STDMETHODIMP GuestProcess::Read(ULONG aHandle, ULONG aSize, ULONG aTimeoutMS, ComSafeArrayOut(BYTE, aData))
|
---|
161 | {
|
---|
162 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
163 | ReturnComNotImplemented();
|
---|
164 | #else
|
---|
165 | AutoCaller autoCaller(this);
|
---|
166 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
167 |
|
---|
168 | ReturnComNotImplemented();
|
---|
169 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
170 | }
|
---|
171 |
|
---|
172 | STDMETHODIMP GuestProcess::Terminate(void)
|
---|
173 | {
|
---|
174 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
175 | ReturnComNotImplemented();
|
---|
176 | #else
|
---|
177 | AutoCaller autoCaller(this);
|
---|
178 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
179 |
|
---|
180 | ReturnComNotImplemented();
|
---|
181 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
182 | }
|
---|
183 |
|
---|
184 | STDMETHODIMP GuestProcess::WaitFor(ComSafeArrayOut(ProcessWaitForFlag_T, aFlags), ULONG aTimeoutMS, ProcessWaitReason_T *aReason)
|
---|
185 | {
|
---|
186 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
187 | ReturnComNotImplemented();
|
---|
188 | #else
|
---|
189 | AutoCaller autoCaller(this);
|
---|
190 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
191 |
|
---|
192 | ReturnComNotImplemented();
|
---|
193 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
194 | }
|
---|
195 |
|
---|
196 | STDMETHODIMP GuestProcess::Write(ULONG aHandle, ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten)
|
---|
197 | {
|
---|
198 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
199 | ReturnComNotImplemented();
|
---|
200 | #else
|
---|
201 | AutoCaller autoCaller(this);
|
---|
202 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
203 |
|
---|
204 | ReturnComNotImplemented();
|
---|
205 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
206 | }
|
---|
207 |
|
---|