provider.py 文件源码

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

项目:MacHeap 作者: blankwall 项目源码 文件源码
def consume(self, amount):
            '''Consume ``amount`` bytes from the given provider.'''
            resultBuffer = (ctypes.c_char*amount)()
            amount,resultAmount = ctypes.c_ulong(amount),ctypes.c_ulong(amount)
            result = k32.ReadFile(
                self.handle, ctypes.byref(resultBuffer),
                amount, ctypes.byref(resultAmount),
                None
            )
            if (result == 0) or (resultAmount.value == 0 and amount > 0):
                e = OSError(win32error.getLastErrorTuple())
                raise error.ConsumeError(self,self.offset,amount,resultAmount.value, exception=e)

            if resultAmount.value == amount:
                self.offset += resultAmount.value
            return str(resultBuffer.raw)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号