I am trying to write a string that i have in one app to a buffer in another app. The other app is mines so i know the buffer name which is b_String_1. It don't seem to work. I can do MapView but i want try Read and WriteProcessMemory.

Here it say "address to start writing to" . Don't that mean My Buffer that has the string i want to send.

And the other line say "address of buffer to write data to"

THIS IS VERY CONFUSSING ... if it what i thought it mean than where is or why not the words "The Receiving Buffer"

If my code is correct than my next qestion is how do i define the buffer in App1 to match the one in App2 the receiver. I can't say b_String_1 db 40 dup(?) ... or can i.

Do i have to write it like this just like a button or something

b_String_1 equ 100

If it is my own app do i still have to call OpenProcess, ReadProcessMemory. I don't think so but i could be wrong.

Thanks in advance

;BOOL WriteProcessMemory(

; HANDLE hProcess, // handle of process whose memory is written to
; LPVOID lpBaseAddress, // address to start writing to
; LPVOID lpBuffer, // address of buffer to write data to
; DWORD cbWrite, // number of bytes to write
; LPDWORD lpNumberOfBytesWritten // actual number of bytes written

;BOOL WriteProcessMemory(

; HANDLE App_Two_hand, // handle of process whose memory is written to
; LPVOID send_String_1, // address to start writing to
; LPVOID b_String_1, // address of buffer to write data to
; DWORD 40, // number of bytes to write
; LPDWORD 40 // actual number of bytes written

"actual number of bytes written" Suppose I you always know

;;;;;;;;;;;;;;;;;;;;;;;;; This is what i tried with changes
PUSH offset b_String_1
PUSH offset send_String_1
PUSH App_Two_hand
CALL WriteProcessMemory
Posted on 2003-07-27 15:52:00 by cmax
Pointer to a variable that receives the number of bytes transferred into the specified process. This parameter is optional. If lpNumberOfBytesWritten is NULL, the parameter is ignored.

So lets say you created process and want to write something to that one.

fname db "test.exe",0
mydata db 90,90 ;buffer which will be written o process
myaddress EQU 12345 ;address of process
numofbwrited dd 0 ;this will be filled after WPM call by the number of bytes written.

invoke CreateProcess, 0, addr fname, 0, 0, 0,\ ;create the process suspended
addr stinfo, addr prinfo

invoke WriteProcessMemory,prinfo.hProcess,myaddress,addr mydata,sizeof mydata,addr numofbwrited ;write it

Hope it helps
Posted on 2003-07-27 16:37:58 by LaptoniC
Thanks LaptoniC,

I tried some of this in my app but i could not see th light. Here is a better idea of what i am trying to do. I tried to change things according to your example but i got all twisted up mentally.

Receiver_Buffer: I put DD value in app1 cause i don't know what to do. The real Receiveing buffer is a db buffer in app2

This is where i want to set the string (not in hex) just a plain string and i need to do it quite often.

It's not a one shot deal. I need to use the same buffer from time to time sending difference strings for app2 to operate on.

I don't know where the Receiver_Buffer decaration goes in either app.

Both apps are my and are running without createprocess. I just don't know how to declare stuff for in each app

.data & const with same word (Receiver_Buffer) give error but how is app1 to know where app2 buffer is without a equ.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MyApp1.exe
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MyApp1.exe
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MyApp1.exe
Receiver_Buffer EQU 12345

b_String_1 db "This String has 39 letters",0

numofbwrited DWORD ?
Receiver_Buffer DWORD ? ............ but where about app2 reciver
My_App_2_handle DWORD ?


PUSH offset numofbwrited
PUSH SIZEOF b_String_1 ; sizeof mydata mydata db 90,90.. Sending
PUSH offset Receiver_Buffer ; myaddress EQU 12345 ;Somethings wrong
PUSH i_don't_ have_a_clue ; myaddress... where is app2 address ?
PUSH My_App_2_handle
CALL WriteProcessMemory

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MyApp2.exe
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MyApp2.exe
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MyApp2.exe




Receiver_Buffer db 40 dup(?)

Posted on 2003-07-27 19:33:00 by cmax