Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp	(revision 30955)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp	(revision 30956)
@@ -159,14 +159,9 @@
     if (machine)
     {
-        Bstr uuid;
-        machine->COMGETTER(Id)(uuid.asOutParam());
-        machine = NULL;
         SafeArray<BSTR> abstrFiles;
-        CHECK_ERROR(a->virtualBox, UnregisterMachine(uuid,
-                                                     false /* fDetachMedia */,
-                                                     ComSafeArrayAsOutParam(abstrFiles),
-                                                     machine.asOutParam()));
-        if (SUCCEEDED(rc) && machine && fDelete)
-            CHECK_ERROR(machine, DeleteSettings());
+        CHECK_ERROR(machine, Unregister(false /* fDetachMedia */,
+                                        ComSafeArrayAsOutParam(abstrFiles)));
+        if (SUCCEEDED(rc) && fDelete)
+            CHECK_ERROR(machine, Delete());
     }
     return SUCCEEDED(rc) ? 0 : 1;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp	(revision 30955)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp	(revision 30956)
@@ -790,14 +790,13 @@
 }
 
-void VBoxProblemReporter::cannotDeleteMachine (const CVirtualBox &vbox,
-                                               const CMachine &machine)
+void VBoxProblemReporter::cannotDeleteMachine(const CMachine &machine)
 {
     /* preserve the current error info before calling the object again */
     COMResult res (machine);
 
-    message (mainWindowShown(), Error,
-        tr ("Failed to remove the virtual machine <b>%1</b>.")
-            .arg (machine.GetName()),
-        !vbox.isOk() ? formatErrorInfo (vbox) : formatErrorInfo (res));
+    message(mainWindowShown(),
+            Error,
+            tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()),
+            !machine.isOk() ? formatErrorInfo(machine) : formatErrorInfo(res));
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h	(revision 30955)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h	(revision 30956)
@@ -204,5 +204,5 @@
     void cannotStopMachine (const CConsole &console);
     void cannotStopMachine (const CProgress &progress);
-    void cannotDeleteMachine (const CVirtualBox &vbox, const CMachine &machine);
+    void cannotDeleteMachine (const CMachine &machine);
     void cannotDiscardSavedState (const CConsole &console);
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp	(revision 30955)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp	(revision 30956)
@@ -679,11 +679,10 @@
         if (ok)
         {
-            QVector<QString> files;
-            CMachine machine;
-            vbox.UnregisterMachine(id, false /*fDetachMedia*/, files, machine);
-            if (vbox.isOk() && item->accessible())
+            CMachine machine = item->machine();
+            QVector<QString> files = machine.Unregister(false /*fDetachMedia*/);
+            if (machine.isOk() && item->accessible())
             {
                 /* delete machine settings */
-                machine.DeleteSettings();
+                machine.Delete();
                 /* remove the item shortly: cmachine it refers to is no longer valid! */
                 int row = mVMModel->rowById (item->id());
@@ -692,6 +691,6 @@
                 mVMListView->ensureSomeRowSelected (row);
             }
-            if (!vbox.isOk() || !machine.isOk())
-                vboxProblem().cannotDeleteMachine (vbox, machine);
+            if (!machine.isOk())
+                vboxProblem().cannotDeleteMachine(machine);
         }
     }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp	(revision 30955)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp	(revision 30956)
@@ -782,9 +782,7 @@
         {
             /* Unregister on failure */
-            QVector<QString> files;
-            CMachine machine;
-            vbox.UnregisterMachine(machineId, false /*fDetachMedia*/, files, machine);
+            QVector<QString> files = m_Machine.Unregister(false /*fDetachMedia*/);
             if (vbox.isOk())
-                m_Machine.DeleteSettings();
+                m_Machine.Delete();
             return false;
         }
Index: /trunk/src/VBox/Main/ApplianceImplImport.cpp
===================================================================
--- /trunk/src/VBox/Main/ApplianceImplImport.cpp	(revision 30955)
+++ /trunk/src/VBox/Main/ApplianceImplImport.cpp	(revision 30956)
@@ -1268,7 +1268,10 @@
             ComPtr<IMachine> failedMachine;
             SafeArray<BSTR> abstrPaths;
-            rc2 = mVirtualBox->UnregisterMachine(bstrGuid, false, ComSafeArrayAsOutParam(abstrPaths), failedMachine.asOutParam());
+            rc2 = mVirtualBox->GetMachine(bstrGuid, failedMachine.asOutParam());
             if (SUCCEEDED(rc2))
-                rc2 = failedMachine->DeleteSettings();
+            {
+                rc2 = failedMachine->Unregister(false, ComSafeArrayAsOutParam(abstrPaths));
+                rc2 = failedMachine->Delete();
+            }
         }
     }
Index: /trunk/src/VBox/Main/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/MachineImpl.cpp	(revision 30955)
+++ /trunk/src/VBox/Main/MachineImpl.cpp	(revision 30956)
@@ -3687,5 +3687,109 @@
 }
 
-STDMETHODIMP Machine::DeleteSettings()
+/** @note Locks objects! */
+STDMETHODIMP Machine::Unregister(BOOL fCloseMedia,
+                                 ComSafeArrayOut(BSTR, aFiles))
+{
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    MediaList llMedia;
+    if (mData->mSession.mState != SessionState_Closed)
+        return setError(VBOX_E_INVALID_OBJECT_STATE,
+                        tr("Cannot unregister the machine '%ls' because it has an open session"),
+                           mUserData->mName.raw());
+
+    // @todo optionally discard saved state
+    if (mData->mMachineState == MachineState_Saved)
+        return setError(VBOX_E_INVALID_VM_STATE,
+                        tr("Cannot unregister the machine '%ls' because it is in the Saved state"),
+                           mUserData->mName.raw());
+
+    // @todo optionally nuke snapshots
+    size_t snapshotCount = 0;
+    if (mData->mFirstSnapshot)
+        snapshotCount = mData->mFirstSnapshot->getAllChildrenCount() + 1;
+    if (snapshotCount)
+        return setError(VBOX_E_INVALID_OBJECT_STATE,
+                        tr("Cannot unregister the machine '%ls' because it has %d snapshots"),
+                           mUserData->mName.raw(), snapshotCount);
+
+    if (    !mMediaData.isNull()      // can be NULL if machine is inaccessible
+         && mMediaData->mAttachments.size()
+       )
+    {
+        // we have media attachments:
+        if (fCloseMedia)
+        {
+            // caller wants automatic detachment: then do that and report all media to the array
+
+            // make a temporary list because detachDevice invalidates iterators into
+            // mMediaData->mAttachments
+            MediaData::AttachmentList llAttachments2 = mMediaData->mAttachments;
+
+            for (MediaData::AttachmentList::iterator it = llAttachments2.begin();
+                 it != llAttachments2.end();
+                 ++it)
+            {
+                ComObjPtr<MediumAttachment> pAttach = *it;
+                ComObjPtr<Medium> pMedium = pAttach->getMedium();
+
+                if (!pMedium.isNull())
+                    llMedia.push_back(pMedium);
+
+                detachDevice(pAttach,
+                             alock,
+                             NULL /* pfNeedsSaveSettings */);
+            };
+        }
+        else
+            return setError(VBOX_E_INVALID_OBJECT_STATE,
+                            tr("Cannot unregister the machine '%ls' because it has %d media attachments"),
+                               mMediaData->mAttachments.size());
+    }
+
+    // commit all the media changes made above
+    commitMedia();
+
+    mData->mRegistered = false;
+
+    // machine lock no longer needed
+    alock.release();
+
+    if (fCloseMedia)
+    {
+        // now go thru the list of attached media reported by prepareUnregister() and close them all
+        SafeArray<BSTR> sfaFiles(llMedia.size());
+        size_t u = 0;
+        for (MediaList::const_iterator it = llMedia.begin();
+             it != llMedia.end();
+             ++it)
+        {
+            ComObjPtr<Medium> pMedium = *it;
+            Bstr bstrFile = pMedium->getLocationFull();
+
+            AutoCaller autoCaller2(pMedium);
+            if (FAILED(autoCaller2.rc())) return autoCaller2.rc();
+
+            pMedium->close(NULL /*fNeedsSaveSettings*/,     // we'll call saveSettings() in any case below
+                           autoCaller2);
+                // this uninitializes the medium
+
+            // report the path to the caller
+            bstrFile.detachTo(&sfaFiles[u]);
+            ++u;
+        }
+        // report all paths to the caller
+        sfaFiles.detachTo(ComSafeArrayOutArg(aFiles));
+    }
+
+    mParent->unregisterMachine(this);
+
+    return S_OK;
+}
+
+STDMETHODIMP Machine::Delete()
 {
     AutoCaller autoCaller(this);
@@ -5943,82 +6047,4 @@
 
     return rc;
-}
-
-/**
- * Called from VirtualBox::UnregisterMachine() with the flags given there to
- * give the machine a chance to clean up for itself.
- * @param fDetachMedia As passed to VirtualBox::UnregisterMachine(). If true, all
- *                     media are detached from the machine and its snapshots.
- * @param llFiles
- * @return
- */
-HRESULT Machine::prepareUnregister(bool fCloseMedia,
-                                   MediaList &llMedia)
-{
-    AutoLimitedCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    if (mData->mSession.mState != SessionState_Closed)
-        return setError(VBOX_E_INVALID_OBJECT_STATE,
-                        tr("Cannot unregister the machine '%ls' because it has an open session"),
-                        mUserData->mName.raw());
-
-    // @todo optionally discard saved state
-    if (mData->mMachineState == MachineState_Saved)
-        return setError(VBOX_E_INVALID_VM_STATE,
-                        tr("Cannot unregister the machine '%ls' because it is in the Saved state"),
-                        mUserData->mName.raw());
-
-    // @todo optionally nuke snapshots
-    size_t snapshotCount = 0;
-    if (mData->mFirstSnapshot)
-        snapshotCount = mData->mFirstSnapshot->getAllChildrenCount() + 1;
-    if (snapshotCount)
-        return setError(VBOX_E_INVALID_OBJECT_STATE,
-                        tr("Cannot unregister the machine '%ls' because it has %d snapshots"),
-                        mUserData->mName.raw(), snapshotCount);
-
-    if (    !mMediaData.isNull()      // can be NULL if machine is inaccessible
-         && mMediaData->mAttachments.size()
-       )
-    {
-        // we have media attachments:
-        if (fCloseMedia)
-        {
-            // caller wants automatic detachment: then do that and report all media to the array
-
-            // make a temporary list because detachDevice invalidates iterators into
-            // mMediaData->mAttachments
-            MediaData::AttachmentList llAttachments2 = mMediaData->mAttachments;
-
-            for (MediaData::AttachmentList::iterator it = llAttachments2.begin();
-                 it != llAttachments2.end();
-                 ++it)
-            {
-                ComObjPtr<MediumAttachment> pAttach = *it;
-                ComObjPtr<Medium> pMedium = pAttach->getMedium();
-
-                if (!pMedium.isNull())
-                    llMedia.push_back(pMedium);
-
-                detachDevice(pAttach,
-                             alock,
-                             NULL /* pfNeedsSaveSettings */);
-            };
-        }
-        else
-            return setError(VBOX_E_INVALID_OBJECT_STATE,
-                            tr("Cannot unregister the machine '%ls' because it has %d media attachments"),
-                               mMediaData->mAttachments.size());
-    }
-
-    // commit all the media changes made above
-    commitMedia();
-
-    mData->mRegistered = false;
-
-    return S_OK;
 }
 
Index: /trunk/src/VBox/Main/VirtualBoxImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/VirtualBoxImpl.cpp	(revision 30955)
+++ /trunk/src/VBox/Main/VirtualBoxImpl.cpp	(revision 30956)
@@ -1369,75 +1369,4 @@
 }
 
-/** @note Locks objects! */
-STDMETHODIMP VirtualBox::UnregisterMachine(IN_BSTR aId,
-                                           BOOL fCloseMedia,
-                                           ComSafeArrayOut(BSTR, aFiles),
-                                           IMachine **aMachine)
-{
-    Guid id(aId);
-    if (id.isEmpty())
-        return E_INVALIDARG;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    // find machine from the given ID
-    ComObjPtr<Machine> pMachine;
-    HRESULT rc = findMachine(id,
-                             true /* fPermitInaccessible */,
-                             true /* setError */,
-                             &pMachine);
-    if (FAILED(rc)) return rc;
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    MediaList llMedia;
-    rc = pMachine->prepareUnregister(fCloseMedia, llMedia);
-    if (FAILED(rc)) return rc;
-
-    // remove from the collection of registered machines
-    m->allMachines.removeChild(pMachine);
-
-    if (fCloseMedia)
-    {
-        // now go thru the list of attached media reported by prepareUnregister() and close them all
-        SafeArray<BSTR> sfaFiles(llMedia.size());
-        size_t u = 0;
-        for (MediaList::const_iterator it = llMedia.begin();
-             it != llMedia.end();
-             ++it)
-        {
-            ComObjPtr<Medium> pMedium = *it;
-            Bstr bstrFile = pMedium->getLocationFull();
-
-            AutoCaller autoCaller2(pMedium);
-            if (FAILED(autoCaller2.rc())) return autoCaller2.rc();
-
-            pMedium->close(NULL /*fNeedsSaveSettings*/,     // we'll call saveSettings() in any case below
-                           autoCaller2);
-                // this uninitializes the medium
-
-            // report the path to the caller
-            bstrFile.detachTo(&sfaFiles[u]);
-            ++u;
-        }
-        // report all paths to the caller
-        sfaFiles.detachTo(ComSafeArrayOutArg(aFiles));
-    }
-
-    // save the global registry
-    rc = saveSettings();
-
-    alock.release();
-
-    /* return the unregistered machine to the caller */
-    pMachine.queryInterfaceTo(aMachine);
-
-    /* fire an event */
-    onMachineRegistered(id, FALSE);
-
-    return rc;
-}
-
 STDMETHODIMP VirtualBox::CreateHardDisk(IN_BSTR aFormat,
                                         IN_BSTR aLocation,
@@ -3823,4 +3752,30 @@
     if (pfNeedsSaveSettings)
         *pfNeedsSaveSettings = true;
+
+    return rc;
+}
+
+/**
+ * Removes the given machine object from the internal list of registered machines.
+ * Called from Machine::Unregister().
+ * @param pMachine
+ * @return
+ */
+HRESULT VirtualBox::unregisterMachine(Machine *pMachine)
+{
+    const Guid &id = pMachine->getId();
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    // remove from the collection of registered machines
+    m->allMachines.removeChild(pMachine);
+
+    // save the global registry
+    HRESULT rc = saveSettings();
+
+    alock.release();
+
+    /* fire an event */
+    onMachineRegistered(id, FALSE);
 
     return rc;
Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 30955)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 30956)
@@ -1105,5 +1105,5 @@
   <interface
      name="IVirtualBoxErrorInfo" extends="$errorinfo"
-     uuid="4b86d186-407e-4f9e-8be8-e50061be8725"
+     uuid="e053d3c0-f493-491b-a735-3a9f0b1feed4"
      supportsErrorInfo="no"
      wsmap="managed"
@@ -1706,62 +1706,4 @@
       <param name="name" type="wstring" dir="in"/>
       <param name="machine" type="IMachine" dir="return"/>
-    </method>
-
-    <method name="unregisterMachine">
-      <desc>
-        Unregisters the machine previously registered using
-        <link to="#registerMachine"/>. After successful method invocation, the
-        <link to="IMachineRegisteredEvent"/> event is fired.
-
-        <note>
-          The specified machine must not be in the Saved state, have an open
-          (or a spawning) direct session associated with it, have snapshots or
-          have any medium attached.
-        </note>
-
-        <note>
-          This method implicitly calls <link to="IMachine::saveSettings"/> to
-          save all current machine settings before unregistering it.
-        </note>
-
-        <note>
-          If the given machine is inaccessible (see
-          <link to="IMachine::accessible"/>), it will be unregistered and
-          fully uninitialized right afterwards. As a result, the returned
-          machine object will be unusable and an attempt to call
-          <b>any</b> method will return the "Object not ready" error.
-        </note>
-
-        <result name="VBOX_E_OBJECT_NOT_FOUND">
-          Could not find registered machine matching @a id.
-        </result>
-        <result name="VBOX_E_INVALID_VM_STATE">
-          Machine is in Saved state.
-        </result>
-        <result name="VBOX_E_INVALID_OBJECT_STATE">
-          Machine has snapshot or open session or medium attached.
-        </result>
-      </desc>
-
-      <param name="id" type="uuid" mod="string" dir="in">
-        <desc>UUID of the machine to unregister.</desc>
-      </param>
-      <param name="fCloseMedia" type="boolean" dir="in">
-        <desc>If true, the method will automatically detach all media from the
-          machine and its snapshots, call <link to="IMedium::close" /> on each
-          medium, and the paths of all media files involved will be reported to
-          the caller in the @a aFiles array so the caller can then delete the
-          image files.
-          If false, the method will fail if media attachments are present.</desc>
-      </param>
-      <param name="aFiles" type="wstring" safearray="yes" dir="out">
-        <desc>
-          List of all files detached from medium attachments of the machine, if
-          @a fDetachMedia is true.
-        </desc>
-      </param>
-      <param name="machine" type="IMachine" dir="out">
-        <desc>Unregistered machine object.</desc>
-      </param>
     </method>
 
@@ -3926,5 +3868,5 @@
   <interface
      name="IMachine" extends="$unknown"
-     uuid="6d9212cb-a5c0-48b7-bbc1-3fa2ba2ee6d2"
+     uuid="276e0f43-889b-4b87-b05f-35f1db814700"
      wsmap="managed"
      >
@@ -3998,5 +3940,5 @@
         The only possible action you can perform on an inaccessible
         machine is to unregister it using the
-        <link to="IVirtualBox::unregisterMachine"/> call (or, to check
+        <link to="#unregisterMachine"/> call (or, to check
         for the accessibility state once more by querying this
         property).
@@ -4269,5 +4211,5 @@
           by <link to="IVirtualBox::openMachine"/> but not
           yet registered, or on unregistered machines after calling
-          <link to="IVirtualBox::unregisterMachine"/>. For all other
+          <link to="#unregisterMachine"/>. For all other
           cases, the settings can never be modified.
         </note>
@@ -5228,5 +5170,5 @@
           created by <link to="IVirtualBox::createMachine"/> but not
           yet registered, or on unregistered machines after calling
-          <link to="IVirtualBox::unregisterMachine"/>.
+          <link to="#unregisterMachine"/>.
         </note>
 
@@ -5255,5 +5197,5 @@
           opened by <link to="IVirtualBox::openMachine"/> but not
           yet registered, or on unregistered machines after calling
-          <link to="IVirtualBox::unregisterMachine"/>.
+          <link to="#unregisterMachine"/>.
         </note>
 
@@ -5265,9 +5207,58 @@
     </method>
 
-    <method name="deleteSettings">
-      <desc>
-        Deletes the settings file of this machine from disk.
-        The machine must not be registered in order for this operation
-        to succeed.
+    <method name="unregister">
+      <desc>
+        Unregisters the machine, which must have been previously registered using
+        <link to="IVirtualBox::registerMachine"/>. After successful method invocation,
+        the <link to="IMachineRegisteredEvent"/> event is fired.
+
+        <note>
+          The specified machine must not be in the Saved state nor have an open
+          (or a spawning) direct session associated with it.
+        </note>
+
+        <note>
+          This method implicitly calls <link to="#saveSettings"/> to
+          save all current machine settings before unregistering it.
+        </note>
+
+        <note>
+          If the given machine is inaccessible (see <link to="#accessible"/>), it
+          will be unregistered and fully uninitialized right afterwards. As a result,
+          the returned machine object will be unusable and an attempt to call
+          <b>any</b> method will return the "Object not ready" error.
+        </note>
+
+        <result name="VBOX_E_OBJECT_NOT_FOUND">
+          Could not find registered machine matching @a id.
+        </result>
+        <result name="VBOX_E_INVALID_VM_STATE">
+          Machine is in Saved state.
+        </result>
+        <result name="VBOX_E_INVALID_OBJECT_STATE">
+          Machine has snapshot or open session or medium attached.
+        </result>
+      </desc>
+
+      <param name="fCloseMedia" type="boolean" dir="in">
+        <desc>If true, the method will automatically detach all media from the
+          machine and its snapshots, call <link to="IMedium::close" /> on each
+          medium, and the paths of all media files involved will be reported to
+          the caller in the @a aFiles array so the caller can then delete the
+          image files.
+          If false, the method will fail if media attachments are present.</desc>
+      </param>
+      <param name="aFiles" type="wstring" safearray="yes" dir="return">
+        <desc>
+          List of all files detached from medium attachments of the machine, if
+          @a fCloseMedia is true.
+        </desc>
+      </param>
+    </method>
+
+    <method name="delete">
+      <desc>
+        Deletes the settings (machine XML) file of this machine from disk. The machine
+        must not be registered in order for this operation to succeed.
         <note>
           <link to="#settingsModified"/> will return @c true after this
@@ -5280,5 +5271,5 @@
           opened by <link to="IVirtualBox::openMachine"/> but not
           yet registered, or on unregistered machines after calling
-          <link to="IVirtualBox::unregisterMachine"/>.
+          <link to="#unregisterMachine"/>.
         </note>
         <note>
Index: /trunk/src/VBox/Main/include/MachineImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/MachineImpl.h	(revision 30955)
+++ /trunk/src/VBox/Main/include/MachineImpl.h	(revision 30956)
@@ -481,5 +481,6 @@
     STDMETHOD(SaveSettings)();
     STDMETHOD(DiscardSettings)();
-    STDMETHOD(DeleteSettings)();
+    STDMETHOD(Unregister) (BOOL fCloseMedia, ComSafeArrayOut(BSTR, aFiles));
+    STDMETHOD(Delete)();
     STDMETHOD(Export)(IAppliance *aAppliance, IVirtualSystemDescription **aDescription);
     STDMETHOD(GetSnapshot)(IN_BSTR aId, ISnapshot **aSnapshot);
@@ -683,5 +684,4 @@
 
     HRESULT prepareRegister();
-    HRESULT prepareUnregister(bool fDetachMedia, MediaList &llMedia);
 
     HRESULT getSharedFolder(CBSTR aName,
Index: /trunk/src/VBox/Main/include/VirtualBoxImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/VirtualBoxImpl.h	(revision 30955)
+++ /trunk/src/VBox/Main/include/VirtualBoxImpl.h	(revision 30956)
@@ -128,5 +128,4 @@
     STDMETHOD(GetMachine) (IN_BSTR aId, IMachine **aMachine);
     STDMETHOD(FindMachine) (IN_BSTR aName, IMachine **aMachine);
-    STDMETHOD(UnregisterMachine) (IN_BSTR aId, BOOL fCloseMedia, ComSafeArrayOut(BSTR, aFiles), IMachine **aMachine);
     STDMETHOD(CreateAppliance) (IAppliance **anAppliance);
 
@@ -264,4 +263,6 @@
     HRESULT unregisterImage(Medium *aImage, DeviceType_T argType, bool *pfNeedsSaveSettings);
 
+    HRESULT unregisterMachine(Machine *pMachine);
+
     void rememberMachineNameChangeForMedia(const Utf8Str &strOldConfigDir,
                                            const Utf8Str &strNewConfigDir);
@@ -288,5 +289,5 @@
                                     Utf8Str &aConflictType);
 
-    HRESULT registerMachine (Machine *aMachine);
+    HRESULT registerMachine(Machine *aMachine);
 
     HRESULT registerDHCPServer(DHCPServer *aDHCPServer,
Index: /trunk/src/VBox/Main/testcase/tstOVF.cpp
===================================================================
--- /trunk/src/VBox/Main/testcase/tstOVF.cpp	(revision 30955)
+++ /trunk/src/VBox/Main/testcase/tstOVF.cpp	(revision 30956)
@@ -350,9 +350,7 @@
             RTPrintf("  Deleting machine %ls...\n", bstrUUID.raw());
             SafeArray<BSTR> sfaFiles;
-            rc = pVirtualBox->UnregisterMachine(bstrUUID,
-                                                true /* fDetachMedia */,
-                                                ComSafeArrayAsOutParam(sfaFiles),
-                                                pMachine.asOutParam());
-            if (FAILED(rc)) throw MyError(rc, "VirtualBox::UnregisterMachine() failed\n");
+            rc = pMachine->Unregister(true /* fDetachMedia */,
+                                      ComSafeArrayAsOutParam(sfaFiles));
+            if (FAILED(rc)) throw MyError(rc, "Machine::Unregister() failed\n");
 
             for (size_t u = 0;
@@ -364,5 +362,5 @@
             }
 
-            rc = pMachine->DeleteSettings();
+            rc = pMachine->Delete();
             if (FAILED(rc)) throw MyError(rc, "Machine::DeleteSettings() failed\n");
         }
