VirtualBox

儲存庫 vbox 的更動 56669


忽略:
時間撮記:
2015-6-28 下午11:01:01 (10 年 以前)
作者:
vboxsync
svn:sync-xref-src-repo-rev:
101311
訊息:

glue/vboxapi.py: Hacked the MSCOM version of setArray() so that we can modify the BSTR safearray IGuestSession::environmentChanges on windows.

檔案:
修改 1 筆資料

圖例:

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

    r55589 r56669  
    565565
    566566    def setArray(self, oInterface, sAttrib, aoArray):
    567         return oInterface.__setattr__(sAttrib, aoArray)
     567        #
     568        # HACK ALERT!
     569        #
     570        # With pywin32 build 218, we're seeing type mismatch errors here for
     571        # IGuestSession::environmentChanges (safearray of BSTRs). The Dispatch
     572        # object (_oleobj_) seems to get some type conversion wrong and COM
     573        # gets upset.  So, we redo some of the dispatcher work here, picking
     574        # the missing type information from the getter.
     575        #
     576        oOleObj     = getattr(oInterface, '_oleobj_');
     577        aPropMapGet = getattr(oInterface, '_prop_map_get_');
     578        aPropMapPut = getattr(oInterface, '_prop_map_put_');
     579        sComAttrib  = sAttrib if sAttrib in aPropMapGet else ComifyName(sAttrib);
     580        try:
     581            aArgs, aDefaultArgs = aPropMapPut[sComAttrib];
     582            aGetArgs            = aPropMapGet[sComAttrib];
     583        except KeyError: # fallback.
     584            return oInterface.__setattr__(sAttrib, aoArray);
     585
     586        import pythoncom;
     587        oOleObj.InvokeTypes(aArgs[0],                   # dispid
     588                            aArgs[1],                   # LCID
     589                            aArgs[2],                   # DISPATCH_PROPERTYPUT
     590                            (pythoncom.VT_HRESULT, 0),  # retType - or void?
     591                            (aGetArgs[2],),             # argTypes - trick: we get the type from the getter.
     592                            aoArray,);                  # The array
    568593
    569594    def initPerThread(self):
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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