VirtualBox

Changeset 69785 in vbox


Ignore:
Timestamp:
Nov 20, 2017 8:18:32 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
119190
Message:

VBoxSDS: Made VirtualBoxSDS internal and non-scriptable, dropping the API wrapping (sideeffect of either of those). The latter helps avoiding an annoying deadlock (requires reboot) when an API call goes south.

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r69782 r69785  
    2440224402  <!--
    2440324403  // IVirtualBoxSDS
     24404  // Note! This actually extends IUnknown rather than IDispatch, notdual=yes
     24405  //       sees to that.
    2440424406  //////////////////////////////////////////////////////////////////////////
    2440524407  -->
    2440624408
    24407   <!-- This is now an internal interface, it doesn't need to be dual either. -->
    2440824409  <interface
    24409     name="IVirtualBoxSDS" extends="$unknown"
     24410    name="IVirtualBoxSDS" extends="$unknown" notdual="yes"
    2441024411    uuid="787d20ed-faf3-4170-6697-3a2a7de6e086"
    24411     wsmap="suppress"
     24412    wsmap="suppress" internal="yes"
    2441224413    reservedMethods="0" reservedAttributes="0"
    2441324414    >
  • trunk/src/VBox/Main/include/VirtualBoxSDSImpl.h

    r69784 r69785  
    1919#define ____H_VIRTUALBOXSDSIMPL
    2020
    21 #include "VirtualBoxSDSWrap.h"
    22 #include "TokenWrap.h"
    23 
    24 #ifdef RT_OS_WINDOWS
    25 # include "win/resource.h"
    26 #endif
     21#include "VirtualBoxBase.h"
    2722
    2823
     
    6863
    6964
    70 class ATL_NO_VTABLE VirtualBoxSDS :
    71     public VirtualBoxSDSWrap
    72 #ifdef RT_OS_WINDOWS
     65/**
     66 * The IVirtualBoxSDS implementation.
     67 *
     68 * This class helps different VBoxSVC processes make sure a user only have a
     69 * single VirtualBox instance.
     70 *
     71 * @note This is a simple internal class living in a privileged process.  So, we
     72 *       do not use the API wrappers as they add complexity.  In particular,
     73 *       they add the auto caller logic, which is an excellent tool to create
     74 *       unkillable processes.  If an API method during development or product
     75 *       for instance triggers an NT exception like STATUS_ACCESS_VIOLATION, the
     76 *       caller will be unwound without releasing the caller.  When uninit is
     77 *       called during COM shutdown/whatever, the thread gets stuck waiting for
     78 *       the long gone caller and cannot be killed (Windows 10, build 16299),
     79 *       requiring a reboot to continue.
     80 *
     81 * @todo Would be very nice to get rid of the ATL cruft too here.
     82 */
     83class VirtualBoxSDS
     84    : public IVirtualBoxSDS
     85    , public ATL::CComObjectRootEx<ATL::CComMultiThreadModel>
    7386    , public ATL::CComCoClass<VirtualBoxSDS, &CLSID_VirtualBoxSDS>
    74 #endif
    7587{
    7688private:
     
    8294
    8395public:
     96    DECLARE_CLASSFACTORY_SINGLETON(VirtualBoxSDS)
     97    DECLARE_NOT_AGGREGATABLE(VirtualBoxSDS)
     98    DECLARE_PROTECT_FINAL_CONSTRUCT()
    8499
    85     DECLARE_CLASSFACTORY_SINGLETON(VirtualBoxSDS)
    86 
    87     //DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX)
    88 
    89     // Kind of redundant (VirtualBoxSDSWrap declares itself not aggregatable
    90     // and CComCoClass<VirtualBoxSDS, &CLSID_VirtualBoxSDS> as aggregatable,
    91     // the former is the first inheritance), but the C multiple inheritance
    92     // rules and the class factory in VBoxSDS.cpp needs this to disambiguate.
    93     DECLARE_NOT_AGGREGATABLE(VirtualBoxSDS)
     100    BEGIN_COM_MAP(VirtualBoxSDS)
     101        COM_INTERFACE_ENTRY(IVirtualBoxSDS)
     102    END_COM_MAP()
    94103
    95104    DECLARE_EMPTY_CTOR_DTOR(VirtualBoxSDS)
    96105
    97106    HRESULT FinalConstruct();
    98     void FinalRelease();
    99 
    100     // public initializers/uninitializers for internal purposes only
    101     HRESULT init();
    102     void uninit();
     107    void    FinalRelease();
    103108
    104109private:
    105110
    106     // Wrapped IVirtualBoxSDS methods
    107     HRESULT registerVBoxSVC(const ComPtr<IVBoxSVCRegistration> &aVBoxSVC, LONG aPid, ComPtr<IUnknown> &aExistingVirtualBox);
    108     HRESULT deregisterVBoxSVC(const ComPtr<IVBoxSVCRegistration> &aVBoxSVC, LONG aPid);
     111    // IVirtualBoxSDS methods
     112    HRESULT RegisterVBoxSVC(IVBoxSVCRegistration *aVBoxSVC, LONG aPid, IUnknown **aExistingVirtualBox);
     113    HRESULT DeregisterVBoxSVC(IVBoxSVCRegistration *aVBoxSVC, LONG aPid);
    109114
    110115
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette