Remote Buffer

Read and write process memory

Summary
Remote BufferRead and write process memory
OpenOpen remote buffer
CloseClose the remote buffer
ReadRead from the remote buffer into local buffer
WriteWrite local buffer into remote buffer
GetGet address or size of the remote buffer
Example
About

Open

RemoteBuf_Open(ByRef H,
 hwnd,
 size)

Open remote buffer

Parameters

HReference to variable to receive remote buffer handle
hwndHWND of the window that belongs to the process
sizeSize of the buffer

Returns

Error message on failure

Close

RemoteBuf_Close(ByRef H)

Close the remote buffer

Parameters

HRemote buffer handle

Read

RemoteBuf_Read(ByRef H,  
ByRef pLocal,  
 pSize,  
 pOffset =  0)

Read from the remote buffer into local buffer

Parameters

HRemote buffer handle
pLocalReference to the local buffer
pSizeSize of the local buffer
pOffsetOptional reading offset, by default 0

Returns

TRUE on success or FALSE on failure.  ErrorMessage on bad remote buffer handle

Write

RemoteBuf_Write(Byref H,  
byref pLocal,  
 pSize,  
 pOffset = )

Write local buffer into remote buffer

Parameters

HRemote buffer handle
pLocalReference to the local buffer
pSizeSize of the local buffer
pOffsetOptional writting offset, by default 0

Returns

TRUE on success or FALSE on failure.  ErrorMessage on bad remote buffer handle

Get

RemoteBuf_Get(ByRef H,  
 pQ = "adr")

Get address or size of the remote buffer

Parameters

HRemote buffer handle
pQQuery parameter: set to “adr” to get address (default), to “size” to get the size or to “handle” to get Windows API handle of the remote buffer.

Returns

Address or size of the remote buffer

Example

;get the handle of the Explorer window
   WinGet, hw, ID, ahk_class ExploreWClass

;open two buffers
   RemoteBuf_Open( hBuf1, hw, 128 )
   RemoteBuf_Open( hBuf2, hw, 16  )

;write something
   str := "1234"
   RemoteBuf_Write( hBuf1, str, strlen(str) )

   str := "_5678"
   RemoteBuf_Write( hBuf1, str, strlen(str), 4)

   str := "_testing"
   RemoteBuf_Write( hBuf2, str, strlen(str))


;read
   RemoteBuf_Read( hBuf1, str, 10 )
   out = %str%
   RemoteBuf_Read( hBuf2, str, 10 )
   out = %out%%str%

   MsgBox %out%

;close
   RemoteBuf_Close( hBuf1 )
   RemoteBuf_Close( hBuf2 )

About

RemoteBuf_Open(ByRef H,
 hwnd,
 size)
Open remote buffer
RemoteBuf_Close(ByRef H)
Close the remote buffer
RemoteBuf_Read(ByRef H,  
ByRef pLocal,  
 pSize,  
 pOffset =  0)
Read from the remote buffer into local buffer
RemoteBuf_Write(Byref H,  
byref pLocal,  
 pSize,  
 pOffset = )
Write local buffer into remote buffer
RemoteBuf_Get(ByRef H,  
 pQ = "adr")
Get address or size of the remote buffer
Close