VirtualBox

Changeset 66617 in vbox


Ignore:
Timestamp:
Apr 20, 2017 1:00:29 AM (7 years ago)
Author:
vboxsync
Message:

VBox/Main: bugref:3300: VBoxSVC from terminal server session is not 'visible' - fixed issues in Python VirtualBox API

Location:
trunk/src/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/glue/vboxapi.py

    r62900 r66617  
    439439        self.winerror = winerror
    440440
     441        # Setup client impersonation in COM calls
     442        try:
     443            pythoncom.CoInitializeSecurity(None,
     444                                       None,
     445                                       None,
     446                                       pythoncom.RPC_C_AUTHN_LEVEL_DEFAULT,
     447                                       pythoncom.RPC_C_IMP_LEVEL_IMPERSONATE,
     448                                       None,
     449                                       pythoncom.EOAC_NONE,
     450                                       None)
     451        except:
     452            # handle RPC_E_TOO_LATE (repeat call of CoInitializeSecurity)
     453            print("Warning: CoInitializeSecurity was already called")
     454            pass
     455       
     456
    441457        pid = GetCurrentProcess()
    442458        self.tid = GetCurrentThreadId()
     
    465481        win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBox')
    466482        win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBoxClient')
     483
     484        # instance of client used to support lifetime of VBoxSDS
     485        self.client = None
    467486
    468487        self.oIntCv = threading.Condition()
     
    508527        import win32com
    509528        from win32com.client import Dispatch
    510         client = win32com.client.Dispatch("VirtualBox.VirtualBoxClient")
    511         return client.virtualBox
     529        # Caching self.client is the trick for SDS
     530        # It's allows to keep the VBoxSDS in the memory
     531        # until the end of PlatformMSCOM lifetme
     532        if self.client is None:
     533            self.client = win32com.client.Dispatch("VirtualBox.VirtualBoxClient")
     534        return self.client.virtualBox
    512535
    513536    def getType(self):
  • trunk/src/VBox/ValidationKit/testdriver/vboxinstaller.py

    r66478 r66617  
    308308                if sBase in [ 'vboxsvc', 'virtualbox', 'virtualboxvm', 'vboxheadless', 'vboxmanage', 'vboxsdl', 'vboxwebsrv',
    309309                              'vboxautostart', 'vboxballoonctrl', 'vboxbfe', 'vboxextpackhelperapp', 'vboxnetdhcp',
    310                               'vboxnetadpctl', 'vboxtestogl', 'vboxtunctl', 'vboxvmmpreload', 'vboxxpcomipcd', 'vmCreator', ]:
     310                              'vboxnetadpctl', 'vboxtestogl', 'vboxtunctl', 'vboxvmmpreload', 'vboxxpcomipcd', 'vmCreator', 'vboxsds' ]:
    311311                    aoTodo.append(oProcess);
    312312                if sBase.startswith('virtualbox-') and sBase.endswith('-multiarch.exe'):
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