handle.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:fibratus 作者: rabbitstack 项目源码 文件源码
def _query_handle(self, handle, klass, object_info_type):
        """Gets the object handle info.

        Parameters
        ----------


        handle: HANDLE
            handle object
        klass: int
            the class of information to query
        object_info_type: Structure
            structure type which holds the handle info
        """
        buff = malloc(self._object_buff_size)
        rlen = ULONG()
        status = nt_query_object(handle,
                                 klass,
                                 buff,
                                 self._object_buff_size,
                                 byref(rlen))
        if status >= 0:
            info = cast(buff, POINTER(object_info_type))
            self._buffers.append(buff)
            return info
        else:
            # reallocate the buffer size
            # and try again
            buff = realloc(buff, rlen.value)
            status = nt_query_object(handle,
                                     klass,
                                     buff,
                                     self._object_buff_size,
                                     None)
            if status >= 0:
                info = cast(buff, POINTER(object_info_type))
                self._buffers.append(buff)
                return info
            else:
                free(buff)
                return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号