Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何使用Win32 Process CreateRemoteThread_Python_Python 3.x_Pywin32 - Fatal编程技术网

Python 如何使用Win32 Process CreateRemoteThread

Python 如何使用Win32 Process CreateRemoteThread,python,python-3.x,pywin32,Python,Python 3.x,Pywin32,我正在学习pywin32的Win32进程 但是,我遇到了一个问题 问题是我不知道win32process.CreateRemoteThread需要什么参数 我不知道什么类型错误:无法将函数转换为指针大小的值, 类型错误:无法将非类型转换为指针大小的值,类型错误:无法将元组转换为指针大小的值表示 import win32process import win32con import win32api i=0 def cnt1():     global i     print("Non

我正在学习pywin32的Win32进程

但是,我遇到了一个问题

问题是我不知道win32process.CreateRemoteThread需要什么参数

我不知道什么类型错误:无法将函数转换为指针大小的值, 类型错误:无法将非类型转换为指针大小的值类型错误:无法将元组转换为指针大小的值表示

import win32process
import win32con
import 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...
# I attached a screenshot

tHandle2, tid = win32process.CreateRemoteThread(pHandle, None, 0, id(cnt2), id(b), 0)
# same as adove
# when id(ㅠ) 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)
这是我的密码

我的环境是Windows7家庭64位,python 3.6.7,pywin32-224

多谢各位