# Remote Buffer

Read and write process memory

Summary

Remote Buffer | Read and write process memory
Open | Open remote buffer
Close | Close the remote buffer
Read | Read from the remote buffer into local buffer
Write | Write local buffer into remote buffer
Get | Get address or size of the remote buffer
Example |
About |

### Open

> RemoteBuf_Open( | ByRef | H,
> |  | hwnd,
> |  | size | )

Open remote buffer

#### Parameters

H | Reference to variable to receive remote buffer handle
hwnd | HWND of the window that belongs to the process
size | Size of the buffer

#### Returns

Error message on failure

### Close

> RemoteBuf_Close( | ByRef | H | )

Close the remote buffer

#### Parameters

H | Remote buffer handle

### Read

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

Read from the remote buffer into local buffer

#### Parameters

H | Remote buffer handle
pLocal | Reference to the local buffer
pSize | Size of the local buffer
pOffset | Optional 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

H | Remote buffer handle
pLocal | Reference to the local buffer
pSize | Size of the local buffer
pOffset | Optional 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

H | Remote buffer handle
pQ | Query 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

- Ver 2.0 by majkinetor. See http://www.autohotkey.com/forum/topic12251.html
- Code updates by infogulch
- Licenced under Creative Commons Attribution-Noncommercial http://creativecommons.org/licenses/by-nc/3.0/.

> 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