VirtualBox

vbox的更動 69117 路徑 trunk/src/VBox


忽略:
時間撮記:
2017-10-17 下午05:29:34 (7 年 以前)
作者:
vboxsync
訊息:

vboxapi.py: Check for RPC_E_TOO_LATE instead of blindly claiming this is the case. Documented the next step wrt to calling thread ID + handle.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Main/glue/vboxapi.py

    r67049 r69117  
    440440        # Setup client impersonation in COM calls.
    441441        try:
    442             pythoncom.CoInitializeSecurity(None, 
     442            pythoncom.CoInitializeSecurity(None,
    443443                                           None,
    444444                                           None,
     
    449449                                           None)
    450450        except:
    451             # handle RPC_E_TOO_LATE (repeat call of CoInitializeSecurity)
    452             print("Warning: CoInitializeSecurity was already called")
    453 
     451            _, oXcpt, _ = sys.exc_info();
     452            if isinstance(oXcpt, pythoncom.com_error) and self.xcptGetStatus(oXcpt) == -2147417831: # RPC_E_TOO_LATE
     453                print("Warning: CoInitializeSecurity was already called");
     454            else:
     455                print("Warning: CoInitializeSecurity failed: ", oXctp);
     456
     457        # Remember this thread ID and get its handle so we can wait on it in waitForEvents().
     458        self.tid = GetCurrentThreadId()
    454459        pid = GetCurrentProcess()
    455         self.tid = GetCurrentThreadId()
    456         handle = DuplicateHandle(pid, GetCurrentThread(), pid, 0, 0, DUPLICATE_SAME_ACCESS)
    457         self.handles = []
    458         self.handles.append(handle)
     460        self.handles = [DuplicateHandle(pid, GetCurrentThread(), pid, 0, 0, DUPLICATE_SAME_ACCESS),];
    459461
    460462        # Hack the COM dispatcher base class so we can modify method and
     
    603605        from win32api import GetCurrentThreadId
    604606        from win32event import INFINITE
    605         from win32event import MsgWaitForMultipleObjects, \
    606             QS_ALLINPUT, WAIT_TIMEOUT, WAIT_OBJECT_0
     607        from win32event import MsgWaitForMultipleObjects, QS_ALLINPUT, WAIT_TIMEOUT, WAIT_OBJECT_0
    607608        from pythoncom import PumpWaitingMessages
    608609        import types
     
    671672        oClient = None
    672673        pythoncom.CoUninitialize()
    673         pass
    674674
    675675    def queryInterface(self, oIUnknown, sClassName):
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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