日期:2014-05-17 浏览次数:21476 次
//读取内存中的整数 public int ReadMemoryValue(int address, int processId) { try { byte[] buffer = new byte[4]; IntPtr byteAddress = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0); //获取缓冲区地址 IntPtr hProcess = OpenProcess(0x1F0FFF, false, processId); ReadProcessMemory(hProcess, (IntPtr)address, byteAddress, 4, IntPtr.Zero); //将制定内存中的值读入缓冲区 CloseHandle(hProcess); Console.WriteLine(Marshal.ReadIntPtr(byteAddress)); return Marshal.ReadInt32(byteAddress); } catch { return 0; } } 这个是整数的,怎么读取浮点类型的值?如果有 Marshal.ReadFloat() 就好了...