Beispiel #1
0
def new(*args, **kwds):
    if len(args) == 1:
        alloc = args[0]
        return Managed(alloc)
    return Managed( allocator.new(**kwds) )
Beispiel #2
0
            id = k32.GetCurrentProcess()
            super(WindowsLocal, self).__init__(id)
            self.handle = id    # XXX: shouldn't this be a handle of some kind?

    def new(*args, **kwds):
        if 'pid' in kwds:
            pid = kwds['pid']
            del(kwds['pid'])
            return WindowsProcessId(pid, **kwds)
        if 'handle' in kwds:
            handle = kwds['handle']
            del(kwds['handle'])
            return WindowsHandle(handle, **kwds)
        return WindowsLocal()

if __name__ == '__main__':
    import allocator
    x = allocator.new()

    res = x.getWriteable(0x0, 4)
    print hex(res)
    x.write(res, 'ehlo')

    v = x.getExecutable(res, 4)
    print hex(v)
    print repr(x.read(res, 4))

    x.freeWriteable(res, 4)
    # should fail on windows
    x.freeExecutable(v, 4)
Beispiel #3
0
def new(*args, **kwds):
    if len(args) == 1:
        alloc = args[0]
        return Managed(alloc)
    return Managed(allocator.new(**kwds))