pythondbghelp

SymInitialize python


from ctypes import *
from capstone import *

k32 = windll.kernel32
dbghelp = cdll.LoadLibrary('dbghelp.dll')

handle = k32.LoadLibraryEx(modulePath, 0, 1) #DONT_RESOLVE_DLL_REFERENCES
hproc = k32.GetCurrentProcess()

ret = dbghelp.SymInitialize(hproc, sympath, 1)

SymInitialize returns 0

GetLastError returns -1073741813

What I'm doing wrong, same code written in C++ works just fine.


Solution

  • I specified exact function signature, now it works.

    from ctypes.wintypes import HANDLE, LPCSTR, UINT 
    si = windll.dbghelp.SymInitialize
    si.argtypes = [HANDLE, LPCSTR, UINT]