[DllImport("Kernel32.dll")]
public static extern unsafe int ReadProcessMemory(int hProcess, int lpBaseAddress, int lpBuffer, int nSize, int* lpNumberOfBytesRead);
这样对吗?如果要读0c0890c0这个地址,
Hbf1=ReadProcessMemory(pro2,&0c0890c0,参数三,参数四);
对吗?后两个参数要怎么写。如果函数成功,那函数的返回值就是那个地址的值吧,,
public static extern unsafe int ReadProcessMemory(int hProcess, int lpBaseAddress, int lpBuffer, int nSize, int* lpNumberOfBytesRead);
这样对吗?如果要读0c0890c0这个地址,
Hbf1=ReadProcessMemory(pro2,&0c0890c0,参数三,参数四);
对吗?后两个参数要怎么写。如果函数成功,那函数的返回值就是那个地址的值吧,,
解决方案 »
- C# 第一次运行网页时,会报错:[HttpException (0x80004005): 会话状态已创建一个会话 ID,但由于响应已被应用程序刷新而无法保存它。
- 怎样将数据库查询出来的数据写入.txt文件中
- (B/S)求教后台异步加载数据的方法!
- 求正则表达式
- C#向数据库写信息
- DataGrid中数据源为DataSet时,如何根据排序后的DataGrid中的RowNumber正确定位到DataRow呀?
- Dundas控件饼形图百分比显示问题
- 如何让我的应用程序在启动后,不要选中TREE VIEW组件上的NODE啊
- itextsharp 给PDF文档加图片水印后会将原PDF文档的内容改变
- 关于从StreamReader写到string的问题
- VB.net如何将经常引用的Excel封装Excel.dll?
- 如何回车后下一个控件获得焦点
static extern bool ReadProcessMemory(uint hProcess, IntPtr lpBaseAddress,
IntPtr lpBuffer, uint nSize, ref uint lpNumberOfBytesRead);//....
byte[] vBuffer = new byte[4];
IntPtr vBytesAddress = Marshal.UnsafeAddrOfPinnedArrayElement(vBuffer, 0); // 得到缓冲区的地址
uint vNumberOfBytesRead = 0;ReadProcessMemory(pro2, (IntPtr)0c0890c0, vBytesAddress, vBytesAddress.Length, ref vNumberOfBytesRead);int vInt = Marshal.ReadInt32(vBytesAddress); // 读取数据
PerformanceCounter那它又怎么用呢,能讲讲吗,
没找着
错误 2 应输入 ; C:\Documents and Settings\angel\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 31 54 WindowsApplication1
错误 3 无效的表达式项“,” C:\Documents and Settings\angel\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 31 54 WindowsApplication1
错误 4 应输入 ; C:\Documents and Settings\angel\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 31 55 WindowsApplication1
错误 5 应输入 ; C:\Documents and Settings\angel\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 31 68 WindowsApplication1
错误 6 无效的表达式项“,” C:\Documents and Settings\angel\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 31 68 WindowsApplication1
错误 7 应输入 ; C:\Documents and Settings\angel\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 31 69 WindowsApplication1
错误 8 应输入 ; C:\Documents and Settings\angel\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 31 89 WindowsApplication1
错误 9 无效的表达式项“,” C:\Documents and Settings\angel\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 31 89 WindowsApplication1
错误 10 应输入 ; C:\Documents and Settings\angel\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 31 90 WindowsApplication1
错误 11 无效的表达式项“ref” C:\Documents and Settings\angel\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 31 90 WindowsApplication1
错误 12 应输入 ; C:\Documents and Settings\angel\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 31 94 WindowsApplication1
错误 13 应输入 ; C:\Documents and Settings\angel\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 31 112 WindowsApplication1
错误 14 无效的表达式项“)” C:\Documents and Settings\angel\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 31 112 WindowsApplication1
贴你的调试代码才是最重要的
MSDN看了,英文,看得不是太懂?就加了这段段后出的错误
[DllImport("kernel32.dll")]
static extern bool ReadProcessMemory(uint hProcess, IntPtr lpBaseAddress,
IntPtr lpBuffer, uint nSize, ref uint lpNumberOfBytesRead);//....
byte[] vBuffer = new byte[4];
IntPtr vBytesAddress = Marshal.UnsafeAddrOfPinnedArrayElement(vBuffer, 0); // 得到缓冲区的地址
uint vNumberOfBytesRead = 0;ReadProcessMemory(pro2, (IntPtr)0c0890c0, vBytesAddress, vBytesAddress.Length, ref vNumberOfBytesRead);int vInt = Marshal.ReadInt32(vBytesAddress); // 读取数据
出在这句,后四个参数上,不明白哪错了 ???
[DllImport("kernel32.dll")]
static extern bool ReadProcessMemory(uint hProcess, IntPtr lpBaseAddress,
IntPtr lpBuffer, uint nSize, ref uint lpNumberOfBytesRead);private void button1_Click(object sender, EventArgs e)
{ byte[] vBuffer = new byte[4];
IntPtr vBytesAddress = Marshal.UnsafeAddrOfPinnedArrayElement(vBuffer, 0); // 得到缓冲区的地址
uint vNumberOfBytesRead = 0;
uint pro2 = 1; // 这里换成你的数值
ReadProcessMemory(pro2, (IntPtr)0xc0890c0, vBytesAddress,
(uint)vBuffer.Length, ref vNumberOfBytesRead); int vInt = Marshal.ReadInt32(vBytesAddress); // 读取数据
}
总是0另外,Marshal是什么意思?
Marshal.UnsafeAddrOfPinnedArrayElement
Marshal.ReadInt32(vBytesAddress);
你可以先用其他内存分析器看看推荐一个我自己写的
http://download.csdn.net/source/160423这些东西自己查MSDN吧,搜也可以,比我给你贴的更详细
Marshal 成员 提供了一个方法集,这些方法用于分配非托管内存、复制非托管内存块、将托管类型转换为非托管类型,此外还提供了在与非托管代码交互时使用的其他杂项方法。下表列出了由 Marshal 类型公开的成员。