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


Python POINTER._IDebugClient__com_GetRunningProcessSystemIds方法代码示例

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


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

示例1: __init__

# 需要导入模块: from ctypes import POINTER [as 别名]
# 或者: from ctypes.POINTER import _IDebugClient__com_GetRunningProcessSystemIds [as 别名]
class DebugClient:
    """IDebugClient Wrapper"""
    
    def __init__(self):
        """DebugClient initialization"""

        self.__debug_create()


    def __debug_create(self):
        """create IDebugClient"""
        
        self.__idebug_client = POINTER(DbgEng.IDebugClient)()
        hr = DebugCreate(byref(DbgEng.IDebugClient._iid_), byref(self.__idebug_client))
        if S_OK != hr:
            raise Exception('DebugCreate() fail.')
        else:
            logger.debug('[D] DebugClient: ' + str(self.__idebug_client))

    def query_interface(self, interface):
        """IDebugClient::QueryInterface method"""

        return self.__idebug_client.QueryInterface(interface)


    def get_indentity(self):
        """IDebugClient::GetIdentity method"""

        buffer_size = 0x100
        identity_size = c_ulong(0)
        hr = self.__idebug_client._IDebugClient__com_GetIdentity(None, buffer_size, byref(identity_size))
        if S_OK != hr:
            raise Exception('GetIdentity() fail.')

        buffer_size = identity_size.value + 1
        buffer = create_string_buffer(buffer_size)
        hr = self.__idebug_client._IDebugClient__com_GetIdentity(buffer, buffer_size, byref(identity_size))
        if S_OK != hr:
            raise Exception('GetIdentity() fail.')
        
        return buffer.value

    def set_event_callbacks(self, event_callbacks):
        """IDebugClient::SetEventCallbacks method"""

        hr = self.__idebug_client.SetEventCallbacks(event_callbacks)
        if S_OK != hr:
            raise Exception('SetEventCallbacks() fail.')

    def get_event_callbacks(self):
        """IDebugClient::GetEventCallbacks method"""

        return self.__idebug_client.GetEventCallbacks()

    def set_output_callbacks(self, output_callbacks):
        """IDebugClient::SetOutputCallbacks method"""

        hr = self.__idebug_client.SetOutputCallbacks(output_callbacks)
        if S_OK != hr:
            raise Exception('SetOutputCallbacks() fail.')

    def get_output_callbacks(self):
        """IDebugClient::GetOutputCallbacks method"""

        return self.__idebug_client.GetOutputCallbacks()

    def get_running_process_ids(self):
        """IDebugClient::GetRunningProcessSystemIds method"""

        server = 0
        count = 256
        ids = (c_ulong * count)()
        actual_count = c_ulong(0)
        hr = self.__idebug_client._IDebugClient__com_GetRunningProcessSystemIds(server, ids, count, byref(actual_count))
        if S_OK != hr:
            raise Exception('GetRunningProcessSystemIds() fail.')

        return ids, actual_count.value

    def get_running_process_desc(self, sysid):
        """IDebugClient::GetRunningProcessDescription method"""

        try:
            server = 0
            flags  = DbgEng.DEBUG_PROC_DESC_NO_PATHS
            exename_size = 0x100
            exename = create_string_buffer(exename_size)
            actual_exename_size = c_ulong(0)
            description_size = 0x100
            description = create_string_buffer(description_size)
            actual_description_size = c_ulong(0)
                
            hr = self.__idebug_client._IDebugClient__com_GetRunningProcessDescription(
                server, sysid, flags,
                exename, exename_size, byref(actual_exename_size),
                description, description_size, byref(actual_description_size))
                
            if S_OK != hr:
                if S_FALSE == hr:
                    exename_size = actual_exename_size.value + 1
#.........这里部分代码省略.........
开发者ID:z3r0zh0u,项目名称:pydbgx,代码行数:103,代码来源:pydbgx.py


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