Python-如何获取进程的开始/基址? [英] Python - How to get the start/base address of a process?
本文介绍了Python-如何获取进程的开始/基址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取进程的起始/基地址?例如,Solitaire.exe(solitaire.exe + BAFA8)
How do I get the start/base address of a process? Per example Solitaire.exe (solitaire.exe+BAFA8)
#-*- coding: utf-8 -*-
import ctypes, win32ui, win32process
PROCESS_ALL_ACCESS = 0x1F0FFF
HWND = win32ui.FindWindow(None,u"Solitär").GetSafeHwnd()
PID = win32process.GetWindowThreadProcessId(HWND)[1]
PROCESS = ctypes.windll.kernel32.OpenProcess(PROCESS_ALL_ACCESS,False,PID)
print PID, HWND,PROCESS
我想计算一个内存地址,因此我需要solitaire.exe的基地址。
I would like to calculate a memory address and for this way I need the base address of solitaire.exe.
这是我的意思的图片:
推荐答案
我认为 GetModuleHandle 实际上是给定模块的基址。您可以通过传递NULL来获取exe的句柄。
I think the handle returned by GetModuleHandle is actually the base address of the given module. You get the handle of the exe by passing NULL.
这篇关于Python-如何获取进程的开始/基址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文