VirtualBox

Changeset 85489 in vbox


Ignore:
Timestamp:
Jul 28, 2020 2:51:29 PM (5 years ago)
Author:
vboxsync
Message:

Main: bugref:9784: Moved the call to CoInitializeSecurity into com::Initialize from UICommon.cpp and VirtualBoxClientImpl.cpp

Location:
trunk/src/VBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp

    r84964 r85489  
    40914091    }
    40924092
    4093 #ifdef VBOX_WITH_SDS
    4094     // setup Client COM Security to enable impersonation required by VBOX_SDS
    4095     HRESULT hrGUICoInitializeSecurity = CoInitializeSecurity(NULL,
    4096                                                              -1,
    4097                                                              NULL,
    4098                                                              NULL,
    4099                                                              RPC_C_AUTHN_LEVEL_DEFAULT,
    4100                                                              RPC_C_IMP_LEVEL_IMPERSONATE,
    4101                                                              NULL,
    4102                                                              EOAC_NONE,
    4103                                                              NULL);
    4104     NOREF(hrGUICoInitializeSecurity);
    4105     Assert(RPC_E_TOO_LATE != hrGUICoInitializeSecurity);
    4106     Assert(hrGUICoInitializeSecurity == S_OK);
    4107 #endif
    4108 
    41094093    /* Make sure VirtualBoxClient instance created: */
    41104094    m_comVBoxClient.createInstance(CLSID_VirtualBoxClient);
  • trunk/src/VBox/Main/Makefile.kmk

    r85365 r85489  
    12331233  VBoxCOM_DEFS.win      = VBOX_WITH_AUTO_COM_REG_UPDATE
    12341234 endif
     1235 ifdef VBOX_WITH_SDS
     1236  VBoxCOM_DEFS.win     += VBOX_WITH_SDS
     1237 endif
    12351238 VBoxCOM_DEFS.x86       = _WIN32_WINNT=0x0500
    12361239 VBoxCOM_DEFS.amd64     = _WIN32_WINNT=0x0510
  • trunk/src/VBox/Main/glue/initterm.cpp

    r85121 r85489  
    457457    AssertMsg(rc == S_OK || rc == S_FALSE, ("rc=%08X\n", rc));
    458458
     459#if defined(VBOX_WITH_SDS)
     460    // Setup COM Security to enable impersonation
     461    HRESULT hrGUICoInitializeSecurity = CoInitializeSecurity(NULL,
     462                                                             -1,
     463                                                             NULL,
     464                                                             NULL,
     465                                                             RPC_C_AUTHN_LEVEL_DEFAULT,
     466                                                             RPC_C_IMP_LEVEL_IMPERSONATE,
     467                                                             NULL,
     468                                                             EOAC_NONE,
     469                                                             NULL);
     470    NOREF(hrGUICoInitializeSecurity);
     471    Assert(SUCCEEDED(hrGUICoInitializeSecurity) || hrGUICoInitializeSecurity == RPC_E_TOO_LATE);
     472#endif
     473
    459474    /*
    460475     * IRundown has unsafe two methods we need to patch to prevent remote access.
  • trunk/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp

    r85300 r85489  
    7575HRESULT VirtualBoxClient::init()
    7676{
    77 
    78 #if defined(RT_OS_WINDOWS) && defined(VBOX_WITH_SDS)
    79     // setup COM Security to enable impersonation
    80     // This works for console VirtualBox clients, GUI has own security settings
    81     //  For GUI VirtualBox it will be second call so can return TOO_LATE error
    82     HRESULT hrGUICoInitializeSecurity = CoInitializeSecurity(NULL,
    83                                                              -1,
    84                                                              NULL,
    85                                                              NULL,
    86                                                              RPC_C_AUTHN_LEVEL_DEFAULT,
    87                                                              RPC_C_IMP_LEVEL_IMPERSONATE,
    88                                                              NULL,
    89                                                              EOAC_NONE,
    90                                                              NULL);
    91     NOREF(hrGUICoInitializeSecurity);
    92     Assert(SUCCEEDED(hrGUICoInitializeSecurity) || hrGUICoInitializeSecurity == RPC_E_TOO_LATE);
    93 #endif
    94 
    9577    LogFlowThisFuncEnter();
    9678
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