Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 45425)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 45426)
@@ -9750,5 +9750,4 @@
       </desc>
     </attribute>
-
     <attribute name="domain" type="wstring" readonly="yes">
       <desc>Returns the domain name used by this session to impersonate
@@ -9756,13 +9755,10 @@
       </desc>
     </attribute>
-
     <attribute name="name" type="wstring" readonly="yes">
       <desc>Returns the session's friendly name.</desc>
     </attribute>
-
     <attribute name="id" type="unsigned long" readonly="yes">
       <desc>Returns the internal session ID.</desc>
     </attribute>
-
     <attribute name="timeout" type="unsigned long">
       <desc>
@@ -9773,9 +9769,7 @@
       </desc>
     </attribute>
-
     <attribute name="status" type="GuestSessionStatus" readonly="yes">
       <desc>Returns the current session status.</desc>
     </attribute>
-
     <attribute name="environment" type="wstring" safearray="yes">
       <desc>
@@ -9783,5 +9777,4 @@
       </desc>
     </attribute>
-
     <attribute name="processes" type="IGuestProcess" readonly="yes" safearray="yes">
       <desc>
@@ -9789,5 +9782,4 @@
       </desc>
     </attribute>
-
     <attribute name="directories" type="IGuestDirectory" readonly="yes" safearray="yes">
       <desc>
@@ -9795,5 +9787,4 @@
       </desc>
     </attribute>
-
     <attribute name="files" type="IGuestFile" readonly="yes" safearray="yes">
       <desc>
@@ -9801,5 +9792,4 @@
       </desc>
     </attribute>
-
     <attribute name="eventSource" type="IEventSource" readonly="yes">
       <desc>
@@ -10582,5 +10572,5 @@
   <interface
     name="IProcess" extends="$unknown"
-    uuid="08864d56-96ab-418b-adbc-5a679532aeb0"
+    uuid="5a4fe06d-8cb1-40ff-ac9e-9676e32f706e"
     wsmap="managed"
     >
@@ -10588,4 +10578,34 @@
       Abstract parent interface for processes handled by VirtualBox.
     </desc>
+
+    <attribute name="arguments" type="wstring" readonly="yes" safearray="yes">
+      <desc>
+        The arguments this process is using for execution.
+      </desc>
+    </attribute>
+    <attribute name="environment" type="wstring" readonly="yes" safearray="yes">
+      <desc>
+        The environment block this process is using during execution.
+      </desc>
+    </attribute>    
+    <attribute name="eventSource" type="IEventSource" readonly="yes">
+      <desc>
+        Event source for VirtualBox events.
+      </desc>
+    </attribute>
+    <attribute name="executablePath" type="wstring" readonly="yes">
+      <desc>Full path of the actual executable image.</desc>
+    </attribute>
+    <attribute name="exitCode" type="long" readonly="yes">
+      <desc>
+        The exit code. Only available when the process has been
+        terminated normally.
+      </desc>
+    </attribute>
+    <attribute name="name" type="wstring" readonly="yes">
+      <desc>
+        The friendly name of this process.
+      </desc>
+    </attribute>
     <attribute name="PID" type="unsigned long" readonly="yes">
       <desc>
@@ -10599,27 +10619,5 @@
       </desc>
     </attribute>
-    <attribute name="exitCode" type="long" readonly="yes">
-      <desc>
-        The exit code. Only available when the process has been
-        terminated normally.
-      </desc>
-    </attribute>
-    <attribute name="environment" type="wstring" readonly="yes" safearray="yes">
-      <desc>
-        The environment block this process is using during execution.
-      </desc>
-    </attribute>
-    <attribute name="arguments" type="wstring" readonly="yes" safearray="yes">
-      <desc>
-        The arguments this process is using for execution.
-      </desc>
-    </attribute>
-    <attribute name="executablePath" type="wstring" readonly="yes">
-      <desc>Full path of the actual executable image.</desc>
-    </attribute>
-    <attribute name="name" type="wstring" readonly="yes">
-      <desc>The friendly name of this process.</desc>
-    </attribute>
-
+    
     <method name="waitFor">
       <desc>
@@ -10824,5 +10822,5 @@
   <interface
     name="IFile" extends="$unknown"
-    uuid="0b45a95f-6267-499e-a7f2-efa5f8e081f2"
+    uuid="ceb895d7-8b2d-4a39-8f7c-7d2270f341d5"
     wsmap="managed"
     >
@@ -10830,37 +10828,42 @@
       Abstract parent interface for files handled by VirtualBox.
     </desc>
+    <attribute name="creationMode" type="unsigned long" readonly="yes">
+      <desc>
+        The creation mode.
+      </desc>
+    </attribute>
+    <attribute name="disposition" type="unsigned long" readonly="yes">
+      <desc>
+        The disposition mode.
+      </desc>
+    </attribute>
+    <attribute name="eventSource" type="IEventSource" readonly="yes">
+      <desc>
+        Event source for guest session events.
+      </desc>
+    </attribute>
+    <attribute name="fileName" type="wstring" readonly="yes">
+      <desc>
+        Full path of the actual file name of this file.
+      </desc>
+    </attribute>
+    <attribute name="initialSize" type="long long" readonly="yes">
+      <desc>
+        The initial size in bytes when opened.
+      </desc>
+    </attribute>
+    <attribute name="openMode" type="unsigned long" readonly="yes">
+      <desc>
+        The open mode.
+      </desc>
+    </attribute>
+    <attribute name="offset" type="long long" readonly="yes">
+      <desc>
+        Current read/write offset in bytes.
+      </desc>
+    </attribute>
     <attribute name="status" type="FileStatus" readonly="yes">
       <desc>
         TODO
-      </desc>
-    </attribute>
-    <attribute name="creationMode" type="unsigned long" readonly="yes">
-      <desc>
-        The creation mode.
-      </desc>
-    </attribute>
-    <attribute name="disposition" type="unsigned long" readonly="yes">
-      <desc>
-        The disposition mode.
-      </desc>
-    </attribute>
-    <attribute name="fileName" type="wstring" readonly="yes">
-      <desc>
-        Full path of the actual file name of this file.
-      </desc>
-    </attribute>
-    <attribute name="initialSize" type="long long" readonly="yes">
-      <desc>
-        The initial size in bytes when opened.
-      </desc>
-    </attribute>
-    <attribute name="openMode" type="unsigned long" readonly="yes">
-      <desc>
-        The open mode.
-      </desc>
-    </attribute>
-    <attribute name="offset" type="long long" readonly="yes">
-      <desc>
-        Current read/write offset in bytes.
       </desc>
     </attribute>
@@ -18696,5 +18699,5 @@
   <enum
     name="VBoxEventType"
-    uuid="83c03e4b-ffe5-421c-a0fb-0b27b2d56753"
+    uuid="c51645b3-7108-4dce-b5a3-bbf5e4f69ed2"
     >
 
@@ -19024,20 +19027,25 @@
       </desc>
     </const>
-    <const name="OnGuestFileStateChanged" value="86">
+    <const name="OnGuestFileRegistered" value="86">
       <desc>
         TODO
       </desc>
     </const>
-    <const name="OnGuestFileOffsetChanged" value="87">
+    <const name="OnGuestFileStateChanged" value="87">
       <desc>
         TODO
       </desc>
     </const>
-    <const name="OnGuestFileRead" value="88">
+    <const name="OnGuestFileOffsetChanged" value="88">
+      <desc>
+        TODO
+      </desc>
+    </const>
+    <const name="OnGuestFileRead" value="89">
       <desc>
         For performance reasons ... TODO
       </desc>
     </const>
-    <const name="OnGuestFileWrite" value="89">
+    <const name="OnGuestFileWrite" value="90">
       <desc>
         For performance reasons ... TODO
@@ -19045,5 +19053,5 @@
     </const>
     <!-- Last event marker -->
-    <const name="Last" value="90">
+    <const name="Last" value="91">
       <desc>
         Must be last event, used for iterations and structures relying on numerical event values.
@@ -20100,4 +20108,21 @@
   </interface>
 
+  <interface
+    name="IGuestFileRegisteredEvent" extends="IGuestFileEvent"
+    uuid="d0d93830-70a2-487e-895e-d3fc9679f7b3"
+    wsmap="managed" autogen="VBoxEvent" id="OnGuestFileRegistered"
+    >
+    <desc>
+      TODO
+    </desc>
+
+    <attribute name="registered" type="boolean" readonly="yes">
+      <desc>
+        TODO
+      </desc>
+    </attribute>
+
+  </interface>
+  
   <interface
     name="IGuestFileStateChangedEvent" extends="IGuestFileEvent"
Index: /trunk/src/VBox/Main/include/GuestFileImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/GuestFileImpl.h	(revision 45425)
+++ /trunk/src/VBox/Main/include/GuestFileImpl.h	(revision 45426)
@@ -60,4 +60,5 @@
     STDMETHOD(COMGETTER(CreationMode))(ULONG *aCreationMode);
     STDMETHOD(COMGETTER(Disposition))(ULONG *aDisposition);
+    STDMETHOD(COMGETTER(EventSource))(IEventSource ** aEventSource);
     STDMETHOD(COMGETTER(FileName))(BSTR *aFileName);
     STDMETHOD(COMGETTER(InitialSize))(LONG64 *aInitialSize);
Index: /trunk/src/VBox/Main/include/GuestImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/GuestImpl.h	(revision 45425)
+++ /trunk/src/VBox/Main/include/GuestImpl.h	(revision 45426)
@@ -81,4 +81,5 @@
     STDMETHOD(COMGETTER(AdditionsVersion))(BSTR *a_pbstrAdditionsVersion);
     STDMETHOD(COMGETTER(AdditionsRevision))(ULONG *a_puAdditionsRevision);
+    STDMETHOD(COMGETTER(EventSource))(IEventSource ** aEventSource);
     STDMETHOD(COMGETTER(Facilities)) (ComSafeArrayOut(IAdditionsFacility *, aFacilities));
     STDMETHOD(COMGETTER(Sessions)) (ComSafeArrayOut(IGuestSession *, aSessions));
@@ -101,4 +102,7 @@
     STDMETHOD(DragGHDropped)(IN_BSTR strFormat, DragAndDropAction_T action, IProgress **ppProgress);
     STDMETHOD(DragGHGetData)(ComSafeArrayOut(BYTE, data));
+    // Guest control.
+    STDMETHOD(CreateSession)(IN_BSTR aUser, IN_BSTR aPassword, IN_BSTR aDomain, IN_BSTR aSessionName, IGuestSession **aGuestSession);
+    STDMETHOD(FindSession)(IN_BSTR aSessionName, ComSafeArrayOut(IGuestSession *, aSessions));
     // Misc stuff
     STDMETHOD(InternalGetStatistics)(ULONG *aCpuUser, ULONG *aCpuKernel, ULONG *aCpuIdle,
@@ -106,6 +110,4 @@
                                      ULONG *aPageTotal, ULONG *aMemAllocTotal, ULONG *aMemFreeTotal, ULONG *aMemBalloonTotal, ULONG *aMemSharedTotal);
     STDMETHOD(UpdateGuestAdditions)(IN_BSTR aSource, ComSafeArrayIn(AdditionsUpdateFlag_T, aFlags), IProgress **aProgress);
-    STDMETHOD(CreateSession)(IN_BSTR aUser, IN_BSTR aPassword, IN_BSTR aDomain, IN_BSTR aSessionName, IGuestSession **aGuestSession);
-    STDMETHOD(FindSession)(IN_BSTR aSessionName, ComSafeArrayOut(IGuestSession *, aSessions));
 
 public:
Index: /trunk/src/VBox/Main/include/GuestProcessImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/GuestProcessImpl.h	(revision 45425)
+++ /trunk/src/VBox/Main/include/GuestProcessImpl.h	(revision 45426)
@@ -56,4 +56,5 @@
     STDMETHOD(COMGETTER(Arguments))(ComSafeArrayOut(BSTR, aArguments));
     STDMETHOD(COMGETTER(Environment))(ComSafeArrayOut(BSTR, aEnvironment));
+    STDMETHOD(COMGETTER(EventSource))(IEventSource ** aEventSource);
     STDMETHOD(COMGETTER(ExecutablePath))(BSTR *aExecutablePath);
     STDMETHOD(COMGETTER(ExitCode))(LONG *aExitCode);
Index: /trunk/src/VBox/Main/src-client/GuestFileImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestFileImpl.cpp	(revision 45425)
+++ /trunk/src/VBox/Main/src-client/GuestFileImpl.cpp	(revision 45426)
@@ -169,4 +169,17 @@
     return S_OK;
 #endif /* VBOX_WITH_GUEST_CONTROL */
+}
+
+STDMETHODIMP GuestFile::COMGETTER(EventSource)(IEventSource ** aEventSource)
+{
+    CheckComArgOutPointerValid(aEventSource);
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    // no need to lock - lifetime constant
+    mEventSource.queryInterfaceTo(aEventSource);
+
+    return S_OK;
 }
 
Index: /trunk/src/VBox/Main/src-client/GuestImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestImpl.cpp	(revision 45425)
+++ /trunk/src/VBox/Main/src-client/GuestImpl.cpp	(revision 45426)
@@ -489,4 +489,24 @@
 }
 
+STDMETHODIMP Guest::COMGETTER(EventSource)(IEventSource ** aEventSource)
+{
+#ifndef VBOX_WITH_GUEST_CONTROL
+    ReturnComNotImplemented();
+#else
+    LogFlowThisFuncEnter();
+
+    CheckComArgOutPointerValid(aEventSource);
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    // no need to lock - lifetime constant
+    mEventSource.queryInterfaceTo(aEventSource);
+
+    LogFlowFuncLeaveRC(S_OK);
+    return S_OK;
+#endif /* VBOX_WITH_GUEST_CONTROL */
+}
+
 STDMETHODIMP Guest::COMGETTER(Facilities)(ComSafeArrayOut(IAdditionsFacility *, aFacilities))
 {
Index: /trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp	(revision 45425)
+++ /trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp	(revision 45426)
@@ -90,10 +90,4 @@
 {
     LogFlowThisFuncEnter();
-
-    mData.mExitCode = 0;
-    mData.mPID = 0;
-    mData.mRC = VINF_SUCCESS;
-    mData.mStatus = ProcessStatus_Undefined;
-
     return BaseFinalConstruct();
 }
@@ -123,4 +117,8 @@
     AssertReturn(autoInitSpan.isOk(), VERR_OBJECT_DESTROYED);
 
+#ifndef VBOX_WITH_GUEST_CONTROL
+    autoInitSpan.setSucceeded();
+    return VINF_SUCCESS;
+#else
     int vrc = bindToSession(aConsole, aSession, aProcessID /* Object ID */);
     if (RT_SUCCESS(vrc))
@@ -136,4 +134,8 @@
     {
         mData.mProcess = aProcInfo;
+        mData.mExitCode = 0;
+        mData.mPID = 0;
+        mData.mRC = VINF_SUCCESS;
+        mData.mStatus = ProcessStatus_Undefined;
         /* Everything else will be set by the actual starting routine. */
 
@@ -146,4 +148,5 @@
     autoInitSpan.setFailed();
     return vrc;
+#endif
 }
 
@@ -226,4 +229,24 @@
     arguments.detachTo(ComSafeArrayOutArg(aEnvironment));
 
+    return S_OK;
+#endif /* VBOX_WITH_GUEST_CONTROL */
+}
+
+STDMETHODIMP GuestProcess::COMGETTER(EventSource)(IEventSource ** aEventSource)
+{
+#ifndef VBOX_WITH_GUEST_CONTROL
+    ReturnComNotImplemented();
+#else
+    LogFlowThisFuncEnter();
+
+    CheckComArgOutPointerValid(aEventSource);
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    // no need to lock - lifetime constant
+    mEventSource.queryInterfaceTo(aEventSource);
+
+    LogFlowFuncLeaveRC(S_OK);
     return S_OK;
 #endif /* VBOX_WITH_GUEST_CONTROL */
Index: /trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp	(revision 45425)
+++ /trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp	(revision 45426)
@@ -92,8 +92,4 @@
 {
     LogFlowThisFunc(("\n"));
-
-    mData.mRC = VINF_SUCCESS;
-    mData.mStatus = GuestSessionStatus_Undefined;
-
     return BaseFinalConstruct();
 }
@@ -123,9 +119,13 @@
                       pGuest, &ssInfo, &guestCreds));
 
-    AssertPtrReturn(pGuest, VERR_INVALID_POINTER);
-
     /* Enclose the state transition NotReady->InInit->Ready. */
     AutoInitSpan autoInitSpan(this);
     AssertReturn(autoInitSpan.isOk(), VERR_OBJECT_DESTROYED);
+
+#ifndef VBOX_WITH_GUEST_CONTROL
+    autoInitSpan.setSucceeded();
+    return VINF_SUCCESS;
+#else
+    AssertPtrReturn(pGuest, VERR_INVALID_POINTER);
 
     mParent = pGuest;
@@ -144,4 +144,5 @@
     mData.mCredentials.mDomain = guestCreds.mDomain;
 
+    mData.mRC = VINF_SUCCESS;
     mData.mStatus = GuestSessionStatus_Undefined;
     mData.mNumObjects = 0;
@@ -167,4 +168,5 @@
     LogFlowFuncLeaveRC(rc);
     return rc;
+#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
@@ -495,4 +497,9 @@
 STDMETHODIMP GuestSession::COMGETTER(EventSource)(IEventSource ** aEventSource)
 {
+#ifndef VBOX_WITH_GUEST_CONTROL
+    ReturnComNotImplemented();
+#else
+    LogFlowThisFuncEnter();
+
     CheckComArgOutPointerValid(aEventSource);
 
@@ -503,5 +510,7 @@
     mEventSource.queryInterfaceTo(aEventSource);
 
+    LogFlowFuncLeaveRC(S_OK);
     return S_OK;
+#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
