VirtualBox

Changeset 69782 in vbox


Ignore:
Timestamp:
Nov 20, 2017 6:53:29 PM (7 years ago)
Author:
vboxsync
Message:

VBoxSDS: Plan B it is.

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

Legend:

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

    r69775 r69782  
    2437424374<if target="midl">
    2437524375
    24376   <!-- VBOX_SDS_PLAN_B start -->
    2437724376  <!--
    2437824377  // IVBoxSVC
     
    2440024399
    2440124400  </interface>
    24402   <!-- VBOX_SDS_PLAN_B end -->
    2440324401
    2440424402  <!--
     
    2440724405  -->
    2440824406
     24407  <!-- This is now an internal interface, it doesn't need to be dual either. -->
    2440924408  <interface
    2441024409    name="IVirtualBoxSDS" extends="$unknown"
    24411     uuid="28932695-fb72-4708-8904-e1077dac7f9a"
     24410    uuid="787d20ed-faf3-4170-6697-3a2a7de6e086"
    2441224411    wsmap="suppress"
    24413     reservedMethods="4" reservedAttributes="8"
     24412    reservedMethods="0" reservedAttributes="0"
    2441424413    >
    2441524414      <desc>
     
    2442224421      </desc>
    2442324422
    24424       <method name="getVirtualBox" >
    24425        <param name="result" type="IVirtualBox" dir="out" >
    24426         <desc>
    24427           Reference to the server-side API root object.
    24428         </desc>
    24429       </param>
    24430       <param name="token" type="IToken" dir="out">
    24431         <desc>
    24432           Reference to the token object given to client and linked with IVirtualBox.
    24433           Client should keep it till the end.
    24434         </desc>
    24435       </param>
    24436       </method>
    24437 
    24438       <!-- VBOX_SDS_PLAN_B start -->
    2443924423      <method name="registerVBoxSVC">
    2444024424        <desc>Registers a VBoxSVC instance with the SDS.</desc>
     
    2446124445        </param>
    2446224446      </method>
    24463       <!-- VBOX_SDS_PLAN_B end -->
    2446424447
    2446524448  </interface>
  • trunk/src/VBox/Main/include/VirtualBoxSDSImpl.h

    r69775 r69782  
    2626#endif
    2727
    28  /**
    29  * The MediumLockToken class automates cleanup of a Medium lock.
    30  */
    31 class ATL_NO_VTABLE VirtualBoxToken :
    32     public TokenWrap
    33 {
    34 public:
    3528
    36     DECLARE_EMPTY_CTOR_DTOR(VirtualBoxToken)
    37 
    38     HRESULT FinalConstruct();
    39     void FinalRelease();
    40 
    41     // public initializer/uninitializer for internal purposes only
    42     HRESULT init(const std::wstring& wstrUserName);
    43     void uninit();
    44 
    45     /**
    46     * Fabrique method to create and initialize COM token object.
    47     *
    48     * @param aToken         Pointer to result Token COM object.
    49     * @param wstrUserName   User name of client for that we create the token
    50     */
    51     static HRESULT CreateToken(ComPtr<IToken>& aToken, const std::wstring& wstrUserName);
    52 
    53     // Trace COM reference counting in debug mode
    54 #ifdef RT_STRICT
    55     virtual ULONG InternalAddRef();
    56     virtual ULONG InternalRelease();
    57 #endif
    58 
    59 private:
    60 
    61     // wrapped IToken methods
    62     HRESULT abandon(AutoCaller &aAutoCaller);
    63     HRESULT dummy();
    64 
    65     // data
    66     struct Data
    67     {
    68         std::wstring wstrUserName;
    69     };
    70 
    71     Data m;
    72 };
    73 
    74 #ifdef VBOX_WITH_SDS_PLAN_B
    7529/**
    7630 * Per user data.
     
    11266    }
    11367};
    114 #endif
    11568
    11669
     
    12174#endif
    12275{
    123 #ifdef VBOX_WITH_SDS_PLAN_B
    12476private:
    12577    typedef std::map<com::Utf8Str, VBoxSDSPerUserData *> UserDataMap_T;
     
    12880    /** Lock protecting m_UserDataMap.*/
    12981    RTCRITSECTRW        m_MapCritSect;
    130 #endif
    13182
    13283public:
     
    153104private:
    154105
    155     // Wrapped IVirtualBoxSDS properties
    156 
    157     /**
    158     *    Returns the instance of VirtualBox for client.
    159     *    It impersonates client and returns his VirtualBox instance
    160     *    either from cahce or makes new one.
    161     */
    162     HRESULT getVirtualBox(ComPtr<IVirtualBox> &aVirtualBox, ComPtr<IToken> &aToken);
    163 
    164     /* SDS plan B interfaces: */
     106    // Wrapped IVirtualBoxSDS methods
    165107    HRESULT registerVBoxSVC(const ComPtr<IVBoxSVCRegistration> &aVBoxSVC, LONG aPid, ComPtr<IUnknown> &aExistingVirtualBox);
    166108    HRESULT deregisterVBoxSVC(const ComPtr<IVBoxSVCRegistration> &aVBoxSVC, LONG aPid);
    167109
    168     // Wrapped IVirtualBoxSDS methods
    169110
    170111    // Private methods
    171112
    172113    /**
    173      * Gets the cliedt user SID of the
     114     * Gets the client user SID of the
    174115     */
    175     static bool i_getClientUserSID(com::Utf8Str *a_pStrSid, com::Utf8Str *a_pStrUsername);
     116    static bool i_getClientUserSid(com::Utf8Str *a_pStrSid, com::Utf8Str *a_pStrUsername);
    176117
    177 #ifdef VBOX_WITH_SDS_PLAN_B
    178118    /**
    179119     * Looks up the given user.
     
    192132     */
    193133    VBoxSDSPerUserData *i_lookupOrCreatePerUserData(com::Utf8Str const &a_rStrUserSid, com::Utf8Str const &a_rStrUsername);
    194 
    195 #else
    196     /**
    197     *  Gets the current user name of current thread
    198     */
    199     int GetCurrentUserName(std::wstring& wstrUserName);
    200 
    201     /**
    202     *  Prints current user name of this thread to the log
    203     *  @param prefix    string fragment that will be inserted at the beginning
    204     *                   of the logging line
    205     */
    206     void LogUserName(char *prefix);
    207 
    208     /**
    209      * Thread that periodically checks items in cache and cleans obsolete items
    210      */
    211     static DWORD WINAPI CheckCacheThread(LPVOID);
    212 
    213     // data fields
    214     class VirtualBoxCache;
    215     static VirtualBoxCache m_cache;
    216     friend VirtualBoxToken;
    217 #endif
    218134};
    219135
Note: See TracChangeset for help on using the changeset viewer.

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