知道内存的开始位置与大小,咋 读出来?copymemory,memcpy,

解决方案 »

  1.   


    ReadProcessMemoryReads data from an area of memory in a specified process. The entire area to be read must be accessible or the operation fails.
    BOOL ReadProcessMemory(
      HANDLE hProcess,
      LPCVOID lpBaseAddress,
      LPVOID lpBuffer,
      SIZE_T nSize,
      SIZE_T* lpNumberOfBytesRead
    );Parameters
    hProcess 
    [in] A handle to the process with memory that is being read. The handle must have PROCESS_VM_READ access to the process. 
    lpBaseAddress 
    [in] A pointer to the base address in the specified process from which to read. Before any data transfer occurs, the system verifies that all data in the base address and memory of the specified size is accessible for read access, and if it is not accessible the function fails. 
    lpBuffer 
    [out] A pointer to a buffer that receives the contents from the address space of the specified process. 
    nSize 
    [in] The number of bytes to be read from the specified process. 
    lpNumberOfBytesRead 
    [out] A pointer to a variable that receives the number of bytes transferred into the specified buffer. If lpNumberOfBytesRead is NULL, the parameter is ignored. 
    Return Value
    If the function succeeds, the return value is nonzero.If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError.The function fails if the requested read operation crosses into an area of the process that is inaccessible.
    同意小刀的。
      

  2.   

    看錯了。如果只知道地址就是用  Copymemory
      

  3.   

    以下是我常用的(基于文件),不知适合不适合你Type
      Tperson = record
        age:ineger;
        name:array [0..9] of char;
      end;var
      p:pchar;
      person: TPerson;
    begin      
      p := Stream.Memory;//stream为读取文件的流
          Move(p^,person.age,SizeOf(integer));
          Inc(p,SizeOf(integer));
          Move(p^,person.name,10);
    end;
      

  4.   

    a,b为数组  CopyMemory(@b[0], @a[0], Length(a) * SizeOf(Double));//从地址a开始,拷贝一定长度单位的内存数组至b中