本文介绍了如何使用EM_GETTEXTRANGE与WriteProcessMemory的和ReadProcessMemory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在C#中使用EM_GETTEXTRANGE与WriteProcessMemory的和ReadProcessMemory

i need to use EM_GETTEXTRANGE with WriteProcessMemory and ReadProcessMemory in c#

我已经获得起始位置和单词的末尾位置,但我不能使用此
EM_GETTEXTRANGE得到了这个词

i already get the start position and the end position of word but i can't use this EM_GETTEXTRANGE to get the word

任何机构帮助我

推荐答案

您需要一大堆更多的PInvoke。首先,你需要在目标进程中分配内存,因此它可以读取和写入的TextRange结构值。这需要调用OpenProcess和VirtualAllocEx的。现在,你需要初始化结构,业务的首要任务是让内存为lpstrText成员。再次VirtualAllocEx来分配足够大来存储串,WriteProcessMemory的初始化结构的缓冲器。

You need a bunch more pinvoke. First off, you need to allocate memory in the target process so it can read and write the TEXTRANGE structure value. That requires OpenProcess and VirtualAllocEx. Now you need to initialize the structure, first order of business is to get memory for the lpstrText member. VirtualAllocEx again to allocate a buffer large enough to store the string, WriteProcessMemory to initialize the structure.

现在您准备调用SendMessage函数。 ReadProcessMemory读lpstrText回来。清理与两次VirtualFreeEx和CloseHandle的关闭进程句柄。

Now your ready to call SendMessage. ReadProcessMemory to read the lpstrText back. Cleanup with two times VirtualFreeEx and CloseHandle to close the process handle.

大约一​​百方式拍摄的脚下。这是流行的一种code在codeproject.com,我知道它的存在,但他们的搜索是完全borked为晚。祝你好运!

About a hundred ways to shoot the foot. This is popular kind of code at codeproject.com, I know it is there but their search is completely borked as of late. Good luck!

这篇关于如何使用EM_GETTEXTRANGE与WriteProcessMemory的和ReadProcessMemory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 16:14