Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


WriteProcessMemory Help =)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sat Aug 04, 2007 4:57 pm    Post subject: WriteProcessMemory Help =) Reply with quote

i googled and i found some codes...
so heres 1:
Code:
var
  WindowName: Integer;
  ProcessId: Integer;
  ThreadId: Integer;
  buf: PChar;
  HandleWindow: Integer;
  Write: Cardinal;
 
{....}

const
  WindowTitle = 'a program name';
  Address = $A662D6;
  PokeValue = $4A;
  NumberOfBytes = 2;
 
{....}


procedure TForm1.Button1Click(Sender: TObject);
begin
  WindowName := FindWindow(nil, WindowTitle);

  if WindowName = 0 then
  begin
    MessageDlg('Program not running.', mtWarning, [mbOK], 0);
  end;

  ThreadId := GetWindowThreadProcessId(WindowName, @ProcessId);
  HandleWindow := OpenProcess(PROCESS_ALL_ACCESS, False, ProcessId);

  GetMem(buf, 1);
  buf^ := Chr(PokeValue);
  WriteProcessMemory(HandleWindow, ptr(Address), buf, NumberOfBytes, Write);
  FreeMem(buf);
  CloseHandle(HandleWindow);
end;



where its a comment (like {...}) theres the rest of the script...
what do i need to change in here i dont get everythin here...

Quote:
ThreadId := GetWindowThreadProcessId(WindowName, @ProcessId);
HandleWindow := OpenProcess(PROCESS_ALL_ACCESS, False, ProcessId);
//=======================================
GetMem(buf, 1);
buf^ := Chr(PokeValue);
WriteProcessMemory(HandleWindow, ptr(Address), buf, NumberOfBytes, Write);
FreeMem(buf);
CloseHandle(HandleWindow);
end;


ok, above the comment line i dont understand anything... O_o
below i think i know what to change but not pretty sure where and how...
buf^ - whats this?
Chr(PokeValue) - change Chr to something or leave it as Chr? and whats a poke value..?
ptr(Address) - ok here comes the address... but as 00112233 (example) or would it be 0x00112233?
number of bytes, like alloc? i guess Rolling Eyes
after that Write, need to change this or this is part of the code?
FreeMem(buf) - instead buf use a value? like 34 (just an example)

sorry for all the questions... thx to those that just willing to read and answer =)

can u just give me a real example this will be the best ill figure out what i need to change...
thx Very Happy
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sat Aug 04, 2007 5:07 pm    Post subject: Reply with quote

you should be using xEngine
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sat Aug 04, 2007 5:19 pm    Post subject: Reply with quote

whats this? O_o
umm.. a dll...
how can it help me..? im just trying to learn writeprocessmemory function not making a uce and i have no idea what is this dll for.. =\
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Sat Aug 04, 2007 9:02 pm    Post subject: Reply with quote

The dll contains a wrapper function for WriteProcessMemory. So you can just call the wrapper and then it will do the rest. Params are provided by x0r.
_________________
Back to top
View user's profile Send private message
Zombi3
Expert Cheater
Reputation: 0

Joined: 02 Aug 2007
Posts: 144

PostPosted: Sat Aug 04, 2007 9:08 pm    Post subject: Reply with quote

sponge wrote:
The dll contains a wrapper function for WriteProcessMemory. So you can just call the wrapper and then it will do the rest. Params are provided by x0r.

Still haven't heard from you?
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Sun Aug 05, 2007 4:50 am    Post subject: Reply with quote

Why use the DLL? Lol, its easier to do it yourself.
Back to top
View user's profile Send private message MSN Messenger
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sun Aug 05, 2007 10:37 am    Post subject: Reply with quote

yea i wanna learn how to do this myself...
besides, i dont know how to call it and use it... =\
so how can i do this without calling it?
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Sun Aug 05, 2007 5:45 pm    Post subject: Reply with quote

Symbol wrote:
yea i wanna learn how to do this myself...
besides, i dont know how to call it and use it... =\
so how can i do this without calling it?

you want to use WPM without calling it? are you crazy?? all the params and definitions you need are at MSDN.

_________________
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sun Aug 05, 2007 5:49 pm    Post subject: Reply with quote

im kinda new to ths..
inother words i dont understand a word of what u sayin'...
cant u use it without x0r's dll?
and i dont even know how to use it with the dll...
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Sun Aug 05, 2007 5:54 pm    Post subject: Reply with quote

oh my god... wow....
http://msdn2.microsoft.com/en-us/library/ms681674.aspx

Simplified terms:
Code:

hProcess
    [in] Handle to the process you want to edit.
lpBaseAddress
    [in] Where to write to.
lpBuffer
    [in] Information wanted to be written.
nSize
    [in] number of bytes you want written.
lpNumberOfBytesWritten
    [out] when the API returns it will fill this with how many bytes it wrote.
to find modulehandle use GetModuleHandle
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites