You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to emulate a function call int __cdecl sub_46F8B0(int a1, char *a2)
The function I want to invoke is a wrapper over sprintf (a2, template, ... ).
In IDA 6.6, I call this:
from idaemu import *
a = Emu ( UC_ARCH_X86 , UC_MODE_32 )
print a.eFunc(0x0046F8B0, None, [0x4105C0, ?])
How to pass the second argument? The most reasonable would be to use ctypes.create_string_buffer(%) (because the return type is ctypes.c_char_Array_%). But an integer argument is required.
Python>s2=ctypes.create_string_buffer(50)
Python>print a.eFunc(0x454AB0, None, [0x4105C0, s2])
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:/Program Files (x86)/IDA 6.6/plugins\idaemu.py", line 371, in eFunc
self._emulate(func.startEA, retAddr, args)
File "C:/Program Files (x86)/IDA 6.6/plugins\idaemu.py", line 285, in _emulate
self._initStackAndArgs(uc, stopAddr, args)
File "C:/Program Files (x86)/IDA 6.6/plugins\idaemu.py", line 177, in _initStackAndArgs
uc.mem_write(sp, pack(self.pack_fmt, args[i]))
struct.error: cannot convert argument to integer
I'm not strong at python and ctypes. How to be in this situation?
The text was updated successfully, but these errors were encountered:
iamkisly
changed the title
Passing a string to a char * a2 argument
Passing a string to a char* argument
Aug 13, 2017
I'm trying to emulate a function call
int __cdecl sub_46F8B0(int a1, char *a2)
The function I want to invoke is a wrapper over
sprintf (a2, template, ... )
.In IDA 6.6, I call this:
How to pass the second argument? The most reasonable would be to use
ctypes.create_string_buffer(%)
(because the return type isctypes.c_char_Array_%
). But an integer argument is required.I'm not strong at python and ctypes. How to be in this situation?
The text was updated successfully, but these errors were encountered: