def _load_file(filename, ea, size, offset=0): path = os.path.abspath(filename) li = idaapi.open_linput(path, False) if not li: raise Exception, 'Unable to create loader_input_t : %s' % path res = idaapi.file2base(li, offset, ea, ea + size, True) idaapi.close_linput(li) return res
def _load_file(filename, ea, size, offset=0): path = os.path.abspath(filename) li = idaapi.open_linput(path, False) if not li: raise Exception, 'Unable to create loader_input_t : %s'% path res = idaapi.file2base(li, offset, ea, ea+size, True) idaapi.close_linput(li) return res
def _load_file(filename, ea, size, offset=0): path = os.path.abspath(filename) li = idaapi.open_linput(path, False) if not li: raise IOError("{:s}.load_file({!r}, {:x}, {:#x}) : Unable to create loader_input_t : {:s}".format(__name__, filename, ea, size, path)) res = idaapi.file2base(li, offset, ea, ea+size, True) idaapi.close_linput(li) return res
def __load_file(filename, ea, size, offset=0): path = os.path.abspath(filename) res = idaapi.open_linput(path, False) if not res: raise E.DisassemblerError( "{:s}.load_file({!r}, {:#x}, {:+#x}) : Unable to create loader_input_t from path \"{:s}\"." .format(__name__, filename, ea, size, path)) ok = idaapi.file2base(res, offset, ea, ea + size, False) idaapi.close_linput(res) return ok
def __load_file(filename, ea, size, offset=0): path = os.path.abspath(filename) # use IDA to open up the file contents # XXX: does IDA support unicode file paths? res = idaapi.open_linput(path, False) if not res: raise E.DisassemblerError(u"{:s}.load_file({!r}, {:#x}, {:+#x}) : Unable to create an `idaapi.loader_input_t` from path \"{:s}\".".format(__name__, filename, ea, size, path)) # now we can write the file into the specified address as a segment ok = idaapi.file2base(res, offset, ea, ea+size, False) idaapi.close_linput(res) return ok
def __load_file(filename, ea, size, offset=0): path = os.path.abspath(filename) # use IDA to open up the file contents # XXX: does IDA support unicode file paths? res = idaapi.open_linput(path, False) if not res: raise E.DisassemblerError( u"{:s}.load_file({!r}, {:#x}, {:+#x}) : Unable to create an `idaapi.loader_input_t` from path \"{:s}\"." .format(__name__, filename, ea, size, path)) # now we can write the file into the specified address as a segment ok = idaapi.file2base(res, offset, ea, ea + size, False) idaapi.close_linput(res) return ok