VirtualBox

Changeset 66619 in vbox


Ignore:
Timestamp:
Apr 20, 2017 5:53:05 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
114662
Message:

vboxapi.py: style adjustments

File:
1 edited

Legend:

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

    r66617 r66619  
    439439        self.winerror = winerror
    440440
    441         # Setup client impersonation in COM calls
     441        # Setup client impersonation in COM calls.
    442442        try:
    443443            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)
     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)
    451451        except:
    452452            # handle RPC_E_TOO_LATE (repeat call of CoInitializeSecurity)
    453453            print("Warning: CoInitializeSecurity was already called")
    454             pass
    455        
    456454
    457455        pid = GetCurrentProcess()
     
    482480        win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBoxClient')
    483481
    484         # instance of client used to support lifetime of VBoxSDS
    485         self.client = None
    486 
     482        self.oClient = None     ##< instance of client used to support lifetime of VBoxSDS
    487483        self.oIntCv = threading.Condition()
    488484        self.fInterrupted = False
     
    525521
    526522    def getVirtualBox(self):
    527         import win32com
    528         from win32com.client import Dispatch
    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
     523        # Caching self.oClient is the trick for SDS. It allows to keep the
     524        # VBoxSDS in the memory  until the end of PlatformMSCOM lifetme.
     525        if self.oClient is None:
     526            import win32com
     527            from win32com.client import Dispatch
     528            self.oClient = win32com.client.Dispatch("VirtualBox.VirtualBoxClient")
     529        return self.oClient.virtualBox
    535530
    536531    def getType(self):
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