当前位置: 首页>>代码示例>>Python>>正文


Python ctypes.c_uint64方法代码示例

本文整理汇总了Python中ctypes.c_uint64方法的典型用法代码示例。如果您正苦于以下问题:Python ctypes.c_uint64方法的具体用法?Python ctypes.c_uint64怎么用?Python ctypes.c_uint64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ctypes的用法示例。


在下文中一共展示了ctypes.c_uint64方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: approximateDiskSizes

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def approximateDiskSizes(self, *ranges):
        if self._snapshot is not None:
            raise TypeError("cannot calculate disk sizes on leveldb snapshot")
        assert len(ranges) > 0
        key_type = ctypes.c_void_p * len(ranges)
        len_type = ctypes.c_size_t * len(ranges)
        start_keys, start_lens = key_type(), len_type()
        end_keys, end_lens = key_type(), len_type()
        sizes = (ctypes.c_uint64 * len(ranges))()
        for i, range_ in enumerate(ranges):
            assert isinstance(range_, tuple) and len(range_) == 2
            assert isinstance(range_[0], str) and isinstance(range_[1], str)
            start_keys[i] = ctypes.cast(range_[0], ctypes.c_void_p)
            end_keys[i] = ctypes.cast(range_[1], ctypes.c_void_p)
            start_lens[i], end_lens[i] = len(range_[0]), len(range_[1])
        _ldb.leveldb_approximate_sizes(self._db.ref, len(ranges), start_keys,
                start_lens, end_keys, end_lens, sizes)
        return list(sizes) 
开发者ID:jtolio,项目名称:leveldb-py,代码行数:20,代码来源:leveldb.py

示例2: _ar_arsdk_encode_type_info

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def _ar_arsdk_encode_type_info(cls, ar_argtype):
        arsdk_encode_type_info_map = {
            arsdkparser.ArArgType.I8: (od.ARSDK_ARG_TYPE_I8, "i8", ctypes.c_int8),
            arsdkparser.ArArgType.U8: (od.ARSDK_ARG_TYPE_U8, "u8", ctypes.c_uint8),
            arsdkparser.ArArgType.I16: (od.ARSDK_ARG_TYPE_I16, "i16", ctypes.c_int16),
            arsdkparser.ArArgType.U16: (od.ARSDK_ARG_TYPE_U16, "u16", ctypes.c_uint16),
            arsdkparser.ArArgType.I32: (od.ARSDK_ARG_TYPE_I32, "i32", ctypes.c_int32),
            arsdkparser.ArArgType.U32: (od.ARSDK_ARG_TYPE_U32, "u32", ctypes.c_uint32),
            arsdkparser.ArArgType.I64: (od.ARSDK_ARG_TYPE_I64, "i64", ctypes.c_int64),
            arsdkparser.ArArgType.U64: (od.ARSDK_ARG_TYPE_U64, "u64", ctypes.c_uint64),
            arsdkparser.ArArgType.FLOAT: (od.ARSDK_ARG_TYPE_FLOAT, "f32", ctypes.c_float),
            arsdkparser.ArArgType.DOUBLE: (od.ARSDK_ARG_TYPE_DOUBLE, "f64", ctypes.c_double),
            arsdkparser.ArArgType.STRING: (od.ARSDK_ARG_TYPE_STRING, "cstr", od.char_pointer_cast),
            arsdkparser.ArArgType.ENUM: (od.ARSDK_ARG_TYPE_ENUM, "i32", ctypes.c_int32),
        }
        return arsdk_encode_type_info_map[ar_argtype] 
开发者ID:Parrot-Developers,项目名称:olympe,代码行数:18,代码来源:messages.py

示例3: get_modules

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def get_modules(self):
        """Return a list of (currModuleName, currImageName, currLoadedImageName)"""
        self.reload("")
        currModuleName = (c_char * 1024)()
        currImageName = (c_char * 1024)()
        currLoadedImageName = (c_char * 1024)()
        currModuleNameSize = DWORD(0)
        currImageNameSize = DWORD(0)
        currLoadedImageNameSize = DWORD(0)
        currModuleBase = ULONG64(0)
        numModulesLoaded = DWORD(0)
        numModulesUnloaded = DWORD(0)

        self.DebugSymbols.GetNumberModules(byref(numModulesLoaded), byref(numModulesUnloaded))
        res = []
        for i in range(numModulesLoaded.value):
            self.DebugSymbols.GetModuleByIndex(i, byref(currModuleBase))
            self.DebugSymbols.GetModuleNames(i, c_uint64(currModuleBase.value), byref(currImageName), 1023, byref(currImageNameSize),
                                             byref(currModuleName), 1023, byref(currModuleNameSize), byref(currLoadedImageName),
                                             1023, byref(currLoadedImageNameSize))
            # Removing trailing \x00
            res.append((currModuleName[:currModuleNameSize.value - 1], currImageName[:currImageNameSize.value - 1], currLoadedImageName[:currLoadedImageNameSize.value - 1]))
        return res 
开发者ID:sogeti-esec-lab,项目名称:LKD,代码行数:25,代码来源:dbginterface.py

示例4: write_virtual_memory

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def write_virtual_memory(self, addr, data):
        """Write data to a given virtual address

           :param addr: The Symbol to write to
           :type addr: Symbol
           :param size: The Data to write
           :type size: str or ctypes.Structure
           :returns: the size written -- :class:`int`
        """
        try:
            # ctypes structure
            size = ctypes.sizeof(data)
            buffer = ctypes.byref(data)
        except TypeError:
            # buffer
            size = len(data)
            buffer = data
        written = ULONG(0)
        addr = self.resolve_symbol(addr)
        self.DebugDataSpaces.WriteVirtual(c_uint64(addr), buffer, size, byref(written))
        return written.value 
开发者ID:sogeti-esec-lab,项目名称:LKD,代码行数:23,代码来源:dbginterface.py

示例5: write_physical_memory

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def write_physical_memory(self, addr, data):
        """Write data to a given physical address

           :param addr: The Symbol to write to
           :type addr: Symbol
           :param size: The Data to write
           :type size: str or ctypes.Structure
           :returns: the size written -- :class:`int`
        """
        try:
            # ctypes structure
            size = ctypes.sizeof(data)
            buffer = ctypes.byref(data)
        except TypeError:
            # buffer
            size = len(data)
            buffer = data
        written = ULONG(0)
        self.DebugDataSpaces.WritePhysical(c_uint64(addr), buffer, size, byref(written))
        return written.value 
开发者ID:sogeti-esec-lab,项目名称:LKD,代码行数:22,代码来源:dbginterface.py

示例6: adapt_int_width

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def adapt_int_width(n, width, signed=True):
    n = int(n)

    if width == 1:
        result = n
    elif width == 2:
        result = n
    elif width == 4:
        result = ctypes.c_int8(n).value if signed else ctypes.c_uint8(n).value
    elif width == 8:
        result = ctypes.c_int8(n).value if signed else ctypes.c_uint8(n).value
    elif width == 16:
        result = ctypes.c_int16(n).value if signed else ctypes.c_uint16(n).value
    elif width == 32:
        result = ctypes.c_int32(n).value if signed else ctypes.c_uint32(n).value
    elif width == 64:
        result = ctypes.c_int64(n).value if signed else ctypes.c_uint64(n).value
    else:
        result = n
    return result 
开发者ID:eth-sri,项目名称:debin,代码行数:22,代码来源:utils.py

示例7: allocate_null_page

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def allocate_null_page(size=0x1000):
	address = ctypes.c_void_p(1)
	if platform.architecture()[0] == '64bit':
		page_size = ctypes.c_uint64()
	else:
		page_size = ctypes.c_uint32()
	page_size.value = size
	result = m_ntdll.NtAllocateVirtualMemory(
		-1,
		ctypes.byref(address),
		0,
		ctypes.byref(page_size),
		flags('MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN'),
		flags('PAGE_EXECUTE_READWRITE')
	)
	return result == 0 
开发者ID:zeroSteiner,项目名称:mayhem,代码行数:18,代码来源:windows.py

示例8: process_is_wow64

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def process_is_wow64(handle=None):
    """
    Determine whether the process associated with the handle is running
    in WOW64 or not.

    :param int handle: A handle to the process to check.
    :return: Whether the process is running in WOW64 or not.
    :rtype: bool
    """
    if not hasattr(ctypes.windll.kernel32, 'IsWow64Process'):
        return False
    if platform.architecture()[0] == '64bit':
        ctypes.windll.kernel32.IsWow64Process.argtypes = [ctypes.c_uint64, ctypes.POINTER(ctypes.c_bool)]
    handle = (handle or -1)
    is_wow64 = ctypes.c_bool()
    if not ctypes.windll.kernel32.IsWow64Process(handle, ctypes.byref(is_wow64)):
        raise WindowsProcessError('Error: IsWow64Process', get_last_error=ctypes.windll.kernel32.GetLastError())
    return is_wow64.value 
开发者ID:Josue87,项目名称:BoomER,代码行数:20,代码来源:windows.py

示例9: approximateDiskSizes

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def approximateDiskSizes(self, *ranges):
        if self._snapshot is not None:
            raise TypeError("cannot calculate disk sizes on leveldb snapshot")
        assert len(ranges) > 0
        key_type = ctypes.c_void_p * len(ranges)
        len_type = ctypes.c_size_t * len(ranges)
        start_keys, start_lens = key_type(), len_type()
        end_keys, end_lens = key_type(), len_type()
        sizes = (ctypes.c_uint64 * len(ranges))()
        for i, range_ in enumerate(ranges):
            assert isinstance(range_, tuple) and len(range_) == 2
            assert isinstance(range_[0], str) and isinstance(range_[1], str)
            start_keys[i] = ctypes.cast(range_[0], ctypes.c_void_p)
            end_keys[i] = ctypes.cast(range_[1], ctypes.c_void_p)
            start_lens[i], end_lens[i] = len(range_[0]), len(range_[1])
        _ldb.leveldb_approximate_sizes(self._db.ref, len(ranges), start_keys,
                                       start_lens, end_keys, end_lens, sizes)
        return list(sizes) 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:20,代码来源:leveldb.py

示例10: _set_restypes

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def _set_restypes(self):
        # type: () -> None
        """ Functions return type. """

        self.core.CGGetActiveDisplayList.restype = ctypes.c_int32
        self.core.CGDisplayBounds.restype = CGRect
        self.core.CGRectStandardize.restype = CGRect
        self.core.CGRectUnion.restype = CGRect
        self.core.CGDisplayRotation.restype = ctypes.c_float
        self.core.CGWindowListCreateImage.restype = ctypes.c_void_p
        self.core.CGImageGetWidth.restype = ctypes.c_size_t
        self.core.CGImageGetHeight.restype = ctypes.c_size_t
        self.core.CGImageGetDataProvider.restype = ctypes.c_void_p
        self.core.CGDataProviderCopyData.restype = ctypes.c_void_p
        self.core.CFDataGetBytePtr.restype = ctypes.c_void_p
        self.core.CFDataGetLength.restype = ctypes.c_uint64
        self.core.CGImageGetBytesPerRow.restype = ctypes.c_size_t
        self.core.CGImageGetBitsPerPixel.restype = ctypes.c_size_t
        self.core.CGDataProviderRelease.restype = ctypes.c_void_p
        self.core.CFRelease.restype = ctypes.c_void_p 
开发者ID:pnprog,项目名称:goreviewpartner,代码行数:22,代码来源:darwin.py

示例11: _return_ctype

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def _return_ctype(self):
        """ Returns the associated ctype of a given datatype. """
        _datatype_ctype = {
            DataType.Bool: ctypes.c_uint8,
            DataType.I8: ctypes.c_int8,
            DataType.U8: ctypes.c_uint8,
            DataType.I16: ctypes.c_int16,
            DataType.U16: ctypes.c_uint16,
            DataType.I32: ctypes.c_int32,
            DataType.U32: ctypes.c_uint32,
            DataType.I64: ctypes.c_int64,
            DataType.U64: ctypes.c_uint64,
            DataType.Sgl: ctypes.c_float,
            DataType.Dbl: ctypes.c_double,
            DataType.Fxp: ctypes.c_uint32,
            DataType.Cluster: ctypes.c_uint32,
        }
        return _datatype_ctype[self] 
开发者ID:ni,项目名称:nifpga-python,代码行数:20,代码来源:nifpga.py

示例12: MIDI_GetTrackHash

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def MIDI_GetTrackHash(p0, p1, p2, p3):
    a = _RPR._ft['MIDI_GetTrackHash']
    f = ct.CFUNCTYPE(ct.c_byte, ct.c_uint64, ct.c_byte,
                     ct.c_char_p, ct.c_int)(a)
    t = (_RPR.rpr_packp('MediaTrack*', p0),
         ct.c_byte(p1), packs_l(p2), ct.c_int(p3))
    r = f(t[0], t[1], t[2], t[3])
    return (r, p0, p1, unpacks_l(t[2]), p3)

# def RPR_MIDI_InsertCC(p0, p1, p2, p3, p4, p5, p6, p7):
#     a = _ft['MIDI_InsertCC']
#     f = CFUNCTYPE(
#         c_byte, c_uint64, c_byte, c_byte, c_double, c_int, c_int, c_int, c_int
#     )(a)
#     t = (
#         rpr_packp('MediaItem_Take*', p0), c_byte(p1), c_byte(p2), c_double(p3),
#         c_int(p4), c_int(p5), c_int(p6), c_int(p7)
#     )
#     r = f(t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7])
#     return r 
开发者ID:RomeoDespres,项目名称:reapy,代码行数:22,代码来源:additional_api.py

示例13: getindex

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def getindex(self):
        index_size = ctypes.c_uint64(0)
        index_data = ctypes.POINTER(ctypes.c_uint64)()
        check_call(_LIB.MXDataIterGetIndex(self.handle,
                                           ctypes.byref(index_data),
                                           ctypes.byref(index_size)))
        if index_size.value:
            address = ctypes.addressof(index_data.contents)
            dbuffer = (ctypes.c_uint64* index_size.value).from_address(address)
            np_index = np.frombuffer(dbuffer, dtype=np.uint64)
            return np_index.copy()
        else:
            return None 
开发者ID:awslabs,项目名称:dynamic-training-with-apache-mxnet-on-aws,代码行数:15,代码来源:io.py

示例14: __init__

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def __init__(self, x):
        self.X = ctypes.c_uint64(x)

    # <...>\source\blender\blenlib\intern\rand.c:96 
开发者ID:griffin-copperfield,项目名称:Arnold-For-Blender,代码行数:6,代码来源:bla.py

示例15: seed

# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import c_uint64 [as 别名]
def seed(self, seed: int):
        self.X = ctypes.c_uint64((seed << 16) | LOWSEED)

    # <...>\source\blender\blenlib\intern\rand.c:105 
开发者ID:griffin-copperfield,项目名称:Arnold-For-Blender,代码行数:6,代码来源:bla.py


注:本文中的ctypes.c_uint64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。