[img]http://img4.imageshack.us/img4/5140/71788648.jpg[/img]

program stub;

{$APPTYPE CONSOLE}

uses
  SysUtils,Windows;

 var
  bufferhandle : THandle;
  bufferaddress : pointer;
  processhandle : THandle;

begin
///build buffer
bufferhandle := GlobalAlloc(GMEM_MOVEABLE and GMEM_ZEROINIT, 1);
bufferaddress := GlobalLock(bufferhandle);

//get process handle
processhandle := GetCurrentProcess;

//read one byte of file and load into buffer
ReadProcessMemory(processhandle, ptr($830022), bufferaddress, 1, nil);
end.


[Pascal Error] stub.dpr(25): E2033 Types of actual and formal var parameters must be identical

Any help?

The ReadProcessMemory function reads memory in a specified process. The entire area to be read must be accessible, or the operation fails. 

BOOL ReadProcessMemory(

    HANDLE hProcess, // handle of the process whose memory is read  
    LPCVOID lpBaseAddress, // address to start reading
    LPVOID lpBuffer,// address of buffer to place read data
    DWORD nSize,// number of bytes to read
    LPDWORD lpNumberOfBytesRead // address of number of bytes read
   );
program stub;

{$APPTYPE CONSOLE}

uses
  SysUtils,Windows;

 var
  bufferhandle : THandle;
  bufferaddress : pointer;
  processhandle : THandle;
  car:Cardinal;     {I put a 'car' var as cardinal}


begin
///build buffer
bufferhandle := GlobalAlloc(GMEM_MOVEABLE and GMEM_ZEROINIT, 1);
bufferaddress := GlobalLock(bufferhandle);

//get process handle
processhandle := GetCurrentProcess;

//read one byte of file and load into buffer
ReadProcessMemory(processhandle, ptr($830022), bufferaddress, 1,car);{and exchange 'nil' with 'car' }
end.

:D cause this function's 5th argument type is cardinal...

Type: Cardinal
Range:0..4294967295
Format:unsigned 32-bit

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.