I have below files
my_test.py
import my_debugger
debugger =my_debugger.debugger()
debugger.load("C:\\windows\\system32\\calc.exe")
my_debugger.py
from ctypes import *
from my_debugger_defines import *
kernel32 = windll.kernel32
class debugger():
def __init__(self):
    pass
def load(self, path_to_exe):
 creation_flags = DEBUG_PROCESS
 startupinfo = STARTUPINFO()
 process_information = PROCESS_INFORMATION
 startupinfo.dwflags =0x1
 startupinfo.wShowWindow = 0x0
 startupinfo.cb = sizeof(startupinfo)
 if kernel32.CreateProcessA(path_to_exe, None, None, None, None, byref(startupinfo),byref(process_information)):
     print( "[*] we have succedfully lanunched the prcoess")
     print ("[*] PID:  %d" % process_information.dwProcessId)
 else:
     print("[*} error: 0x%08x." % kernel32.GetLastError())
my_debugger_defines.py
from ctypes import *
# mirosoft types to ctypes
WORD = c_ushort
DWORD =c_ulong
LPBYTE = POINTER(c_ubyte)
LPTSTR = POINTER(c_char)
HANDLE = c_void_p
#constants
DEBUG_PROCESS = 0X00000001
CREATE_NEW_CONSOLE = 0X00000010
#structures for createpressa() fuction
class STARTUPINFO(Structure):
_fields_ = [
    ("cb",    DWORD),
    ("lpReserved",   LPTSTR),
    ("lpDesktop",   LPTSTR),
    ("lpTitle",     LPTSTR),
    ("dwX",        DWORD),
    ("dwY",        DWORD),
        ("dwXSize",    DWORD),
    ("dwYsize",    DWORD),
    ("dsXCountChars",   DWORD),
    ("dwYCountChars",   DWORD),
    ("dwFillAttribute", DWORD),
    ("dwFlags", DWORD),
    ("wShowWindow", WORD),
    ("cbReserved2", WORD),
    ("lpReserved2", LPBYTE),
    ("hStdInput", HANDLE),
    ("hStdOutput", HANDLE),
    ("hStdError", HANDLE),
]
class PROCESS_INFORMATION(Structure):
 _fields_ = [
  ("hProcess", HANDLE),
  ("HtHREAD",  HANDLE),
  ("dwProcessId", DWORD),
  ("dwThreadId", DWORD),
]
when I run my_test.py I got below error
C:\download\New folder (6) (1)\Programowanie>python my_test.py
Traceback (most recent call last): File "my_test.py", line 3, in debugger.load("C:\windows\system32\calc.exe") File "C:\download\New folder (6) (1)\Programowanie\my_debugger.py", line 19, in load if kernel32.CreateProcessA(path_to_exe, None, None, None, None, byref(startupinfo),byref(process_information)): TypeError: byref() argument must be a ctypes instance, not '_ctypes.PyCStructType'
C:\download\New folder (6) (1)\Programowanie>
do you know how to fix error?
User contributions licensed under CC BY-SA 3.0