<https://stackoverflow.com/posts/63814377/timeline>

i am studying win32process of pywin32.

but, i encounter a problem.

problem is I don't know win32process.CreateRemoteThread wants what arguments

I don't know what *TypeError: Unable to convert function to pointer-sized
value*, *TypeError: Unable to convert NoneType to pointer-sized
value*, *TypeError:
Unable to convert tuple to pointer-sized value* means,


import win32processimport win32conimport win32api

i=0
def cnt1():
    global i
    print("None")
    i+=1
def cnt2(a, b):
    global i
    print(f"args : {a} {b}")
    i+=1


pid = win32process.GetCurrentProcessId()print(f"pid : {pid}")
pHandle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, win32con.FALSE, pid)

a = None
b = (1, 2)

tHandle1, tid = win32process.CreateRemoteThread(pHandle, None, 0,
id(cnt1), id(a), 0)# when id(cnt1) argument is cnt1, error# TypeError:
Unable to convert function to pointer-sized value# when id(a) argument
is a, error# TypeError: Unable to convert NoneType to pointer-sized
value# So I tried to give the address through id(cnt1) and id(a) as
parameters of CreateRemoteThread.# but, python IDLE is
crashing...(Attachments)

tHandle2, tid = win32process.CreateRemoteThread(pHandle, None, 0,
id(cnt2), id(b), 0)# same as adove# when id(b) argument is b, error#
TypeError: Unable to convert tuple to pointer-sized value
print(f"i : {i}")

win32api.CloseHandle(tHandle1)
win32api.CloseHandle(tHandle2)
win32api.CloseHandle(pHandle)

it is my code
my enviroment is Windows 7 home 64bit, python 3.6.7, pywin32- 224

thank you
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to