コード例 #1
0
ファイル: itpapi_i.py プロジェクト: bluewish/ProjectStudio
 def PutHardwareBreakPointer(self, index, addr, active=1, c_uiDID=0, privmask=0, slot=0,  
                             breaktype=u'Hardware', behavior=u'Execution', addrtype=u'IA32_PHY_PTR', dtsel=0, segsel=0, addrmask=0xffffffff):
     if self._itpBreakPointObj == None:
         return None
     
     if not self.DoesSupportBreakPointType('Hardware execution breakpoint'):
         return False
     
     #arr = [[VARIANT(0), VARIANT(1), ConvertToByteArray(addr, 8), VARIANT(1)]]
     
     arr = array.array('b')
     arr.fromlist([0L])
     bps = self._itpBreakPointObj.ReadBp(arr)
     print bps
     t = VARIANT()
     t.vt = comtypes.automation.VT_EMPTY
     t2 = VARIANT()
     t2.vt = comtypes.automation.VT_INT
     print self._itpBreakPointObj.QueryBpTypes(arr, 0x00000000L)
     self._itpBreakPointObj.WriteBp(bps)
     #arr = [0, 4, [segsel, ConvertToByteArray1(addr, 8), 0], 1]
     #try:
     #    arr = [[0, [5, 0], [segsel, addr, 0], 1]]
     #    self._itpBreakPointObj.WriteBp(arr)
     #except comtypes.COMError, hresult:
     #    print hresult
     #    return
     """
コード例 #2
0
ファイル: accessible_msaa.py プロジェクト: askalski/mats
def intToVariant(i):
    '''
    helper method, constructs Windows "VARIANT" object representing an integer
    '''
    v = VARIANT()
    v.vt = VT_I4
    v.value = i
    assert( isinstance(i, int) )
    return v
コード例 #3
0
ファイル: test_variant.py プロジェクト: nikmolnar/comtypes
    def test_BSTR(self):
        v = VARIANT()
        v.value = u"abc\x00123\x00"
        self.failUnlessEqual(v.value, "abc\x00123\x00")

        v.value = None
        # manually clear the variant
        v._.VT_I4 = 0

        # NULL pointer BSTR should be handled as empty string
        v.vt = VT_BSTR
        self.failUnless(v.value in ("", None))
コード例 #4
0
    def test_BSTR(self):
        v = VARIANT()
        v.value = u"abc\x00123\x00"
        self.failUnlessEqual(v.value, "abc\x00123\x00")

        v.value = None
        # manually clear the variant
        v._.VT_I4 = 0

        # NULL pointer BSTR should be handled as empty string
        v.vt = VT_BSTR
        self.failUnless(v.value in ("", None))
コード例 #5
0
    def test_decimal_as_decimal(self):
        v = VARIANT()
        v.vt = VT_DECIMAL
        v.decVal.Lo64 = 1234
        v.decVal.scale = 3
        self.assertEqual(v.value, decimal.Decimal('1.234'))

        v.decVal.sign = 0x80
        self.assertEqual(v.value, decimal.Decimal('-1.234'))

        v.decVal.scale = 28
        self.assertEqual(v.value, decimal.Decimal('-1.234e-25'))

        v.decVal.scale = 12
        v.decVal.Hi32 = 100
        self.assertEqual(v.value, decimal.Decimal('-1844674407.370955162834'))
コード例 #6
0
    def test_decimal_as_decimal(self):
        v = VARIANT()
        v.vt = VT_DECIMAL
        v.decVal.Lo64 = 1234
        v.decVal.scale = 3
        self.failUnlessEqual(v.value, decimal.Decimal('1.234'))

        v.decVal.sign = 0x80
        self.failUnlessEqual(v.value, decimal.Decimal('-1.234'))

        v.decVal.scale = 28
        self.failUnlessEqual(v.value, decimal.Decimal('-1.234e-25'))

        v.decVal.scale = 12
        v.decVal.Hi32 = 100
        self.failUnlessEqual(
            v.value, decimal.Decimal('-1844674407.370955162834'))
コード例 #7
0
 def set_variant_matrix(self, value):
     if not self.is_nested_iterable(value):
         raise TypeError('Input data is not nested list/tuple.')
         
     if self.is_ragged(value):
         raise TypeError('Input data should not be a ragged array.')
         
     num_row = len(value)
     num_col = len(value[0])
     
     variant = VARIANT()
     _VariantClear(variant) # Clear the original data
     rgsa = (_safearray.SAFEARRAYBOUND * 2)()
     rgsa[0].cElements = num_row
     rgsa[0].lBound = 0
     rgsa[1].cElements = num_col
     rgsa[1].lBound = 0
                                             
     pa = _safearray.SafeArrayCreateEx(
         VT_VARIANT,
         2,
         rgsa,  # rgsaBound
         None)  # pvExtra
                                             
                                             
     if not pa:
         raise MemoryError()
 
     ptr = POINTER(VARIANT)()  # container for the values
     _safearray.SafeArrayAccessData(pa, byref(ptr))
     try:
         # I have no idea why 2D safearray is column-major.                
         index = 0
         for n in range(num_col):            
             for m in range(num_row):            
                 ptr[index] = value[m][n]
                 index += 1
     finally:
         _safearray.SafeArrayUnaccessData(pa)
     
     memmove(byref(variant._), byref(pa), sizeof(pa))  
     variant.vt = VT_ARRAY | VT_VARIANT
     return variant
コード例 #8
0
ファイル: modelnode.py プロジェクト: xialulee/WaveSyn
 def set_variant_matrix(self, value):
     if not self.is_nested_iterable(value):
         raise TypeError('Input data is not nested list/tuple.')
         
     if self.is_ragged(value):
         raise TypeError('Input data should not be a ragged array.')
         
     num_row = len(value)
     num_col = len(value[0])
     
     variant = VARIANT()
     _VariantClear(variant) # Clear the original data
     rgsa = (_safearray.SAFEARRAYBOUND * 2)()
     rgsa[0].cElements = num_row
     rgsa[0].lBound = 0
     rgsa[1].cElements = num_col
     rgsa[1].lBound = 0
                                             
     pa = _safearray.SafeArrayCreateEx(VT_VARIANT,
                                       2,
                                       rgsa,  # rgsaBound
                                       None)  # pvExtra
                                             
                                             
     if not pa:
         raise MemoryError()
 
     ptr = POINTER(VARIANT)()  # container for the values
     _safearray.SafeArrayAccessData(pa, byref(ptr))
     try:
         # I have no idea why 2D safearray is column-major.                
         index = 0
         for n in range(num_col):            
             for m in range(num_row):            
                 ptr[index] = value[m][n]
                 index += 1
     finally:
         _safearray.SafeArrayUnaccessData(pa)
     
     memmove(byref(variant._), byref(pa), sizeof(pa))  
     variant.vt = VT_ARRAY | VT_VARIANT
     return variant