Python - 如何获取进程的起始/基地址? [英] Python - How to get the start/base address of a process?

查看:39
本文介绍了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆