操作别的进程的内存:
1.用Process32First和Process32Next可以玫举所有的进程(Window95/98实现了,WINNT4.0以及一下没有实现,Win2000实现了,如果是用NT4的话,就比较麻烦了,要用Performanance Data,太麻烦了,不说了。)
2.用VirtualQueryEx可以得到一个进程的内存的信息,如开始地址等(95/98/NT4/2000都实现了,就NT3.5没实现,要自己写)
3.然后用ReadProcessMemory和WriteProcessMemory就可以实现对某一进程内存的修改,这两个函数95/98/NT4/2000都实现了,读和写的方式是通过ReadPorcessMemory将内存块读到本进程中,就是在本进程上的一个拷贝,然后对这个拷贝执行各种操作,反正是在本进程中地一个拷贝(本进程中的一片内存),随你怎么操作啦,再将内存块用WriteProcessMemory写回去,就实现了对该内存数据的修改,象金山游侠、FPE那样的操作实际都是先对在本进程中的拷贝进行操作,然后将拷贝写回去。

解决方案 »

  1.   

    ProcessReadMemory的参数:
      HANDLE hProcess              //待处理的进程的句柄
      LPCVOID lpBaseAddress,        //待处理的进程的要读取数据块的起始地址
      LPVOID lpBuffer,              //缓冲区地址
      DWORD nSize,                  //要读的字节数
      LPDWORD lpNumberOfBytesRead  //函数处理后实际读取得字节数,要传地址
      

  2.   

       WIN32 的系统存储控件分为两部分用户部分和系统部分,各位2GB(NT下也有分为3GB和1GB的)。在WIN32下每个进程独占系统的存储空间的用户部分(低端的2GB,0x00000000-0x7fffffff)    但在这2GB的开始合末尾个各有一小块被有特别的用途,应用程序并不能使用,对于NT和95/98,这块区域的大小不一样,NT是0x0000-0xffff,95/98是多少我也不忘了,末尾块的范围我也记不得了,这些你可以去查一下,我想能明白是怎么回事就行了。你能访问的地址就介于这两块内存之间,所以你的开始地址可以是这两块内存之间的任意地址。
      

  3.   

    AllocMem functionAllocates a memory block and initializes each byte to zero.AllocMemCount variableRepresents the total number of allocated memory blocks in an application.AllocMemSize variableRepresents the total size of allocated memory blocks.GetHeapStatus functionReturns the current status of the memory manager.GetMemoryManager procedureReturns the entry points of the currently installed memory manager.HeapAllocFlags variableFlags that indicate how the memory manager obtains memory from the operating system.IsMemoryManagerSet functionIndicates whether the memory manager has been overridden using the SetMemoryManager procedure.ReallocMem procedureReallocates a dynamic variable.SetMemoryManager procedureSets entry points of the memory manager.SysFreeMem functionFrees the memory pointed to by a specified pointer.SysGetMem functionAllocates a specified number of bytes and returns a pointer to them.SysReallocMem functionReturns a pointer to a specified number of bytes, preserving the values pointed to by the Pointer parameter.
      

  4.   

    分配内存:AlloMem(Size: Cardinal): Pointer;
    释放内存:FreeMem
    flypuma(飞豹) 说得太详细了,呵呵。
      

  5.   

    DeleteObject 从内存删除一个对象
    DialogBoxIndirectParam 从内存模块中建立对话框
    CreateDialogIndirectParam 从内存模块中建立非模态对话框
    HeapAlloc 从堆中分配内存
    HeapReAlloc 从堆中重分配内存
    LocalAlloc 从堆分配内存
    LocalUnlock 开锁本地内存块
    GlobalUnlock 开锁全局内存块
    HeapCompact 压缩内存堆
    ReadProcessMemory 在进程中读内存
    WriteProcessMemory 在指定进程中写内存
    GlobalAlloc 在堆中分配内存
    LocalSize 返回本地内存块大小
    LocalFlags 返回本地内存块信息
    GlobalSize 返回全局内存块大小
    GlobalFlags 返回全局内存块信息
    LocalReAlloc 修改本地内存大小及属性
    GlobalReAlloc 修改全局内存块大小/属性
    ZeroMemory 将一块内存置零
    GlobalMemoryStatus 检查内存状态
    HeapFree          释放从堆中分配的内存
    LocalFree 释放本地内存信息
    GlobalFree 释放全局内存块
    GlobalLock 锁定内存对象并返回一个指针
    LocalLock          锁定本地内存对象并返回指针
    LoadKeyboardLayout 键盘布置装入内存
      

  6.   

    我只会用CopyMemory,FilMemory,ZeroMemory:)