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 


Editing Memory in Delphi.
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
angerist
Grandmaster Cheater Supreme
Reputation: 0

Joined: 18 Jun 2007
Posts: 1011
Location: Australia.

PostPosted: Sun Jun 08, 2008 11:20 pm    Post subject: Editing Memory in Delphi. Reply with quote

Ok i've started coding in delphi. And Im working on some private server hacks. I know this is a really simple thing to do . But I need some help cos im a complete noob .

So I use this to let me edit memory
Code:
function EditMemory(Address: Integer; Value: Integer): Boolean;
var
  ProcessId, WindowName, HandleWindow: Integer;
  Write: Cardinal;
begin
  WindowName := FindWindow(nil, 'MapleStory');
  If WindowName = 0 then
  begin
  Result := False;
  Exit;
  end;
  GetWindowThreadProcessId(WindowName, @ProcessId);
  HandleWindow := OpenProcess(PROCESS_ALL_ACCESS, False, ProcessId);
  WriteProcessMemory(HandleWindow, Ptr(Address), @Value, 4, Write);
  CloseHandle(HandleWindow);
  Result := True;
end;


Then I need to repetitively freeze the address?

Code:
procedure SwearHack();
begin
  while 1 = 1 do
  begin
   EditMyMemory($007F2B34, $42C80000);
   Sleep(5);
  end;
end;


But that's gonna freeze maplestory, So i have to run it in a new thread?

Code:
procedure TForm1.Button1Click(Sender: TObject);
var
ThreadID: Cardinal;
begin
CreateThread(nil, 0, @swearhack, nil, 0, ThreadID);
end;


I DON'T KNOW IF THIS IS WHAT I HAVE TO DO TO. ITS BASICALLY JUST A GUESS. I need some assistance.

_________________
Back to top
View user's profile Send private message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Mon Jun 09, 2008 12:40 am    Post subject: Reply with quote

You are getting the window handle and opening the process every loop. It's better to do that just once. so in you're loop, you only have to call WriteProcessMemory.
Back to top
View user's profile Send private message
angerist
Grandmaster Cheater Supreme
Reputation: 0

Joined: 18 Jun 2007
Posts: 1011
Location: Australia.

PostPosted: Mon Jun 09, 2008 5:24 am    Post subject: Reply with quote

Ohhh. So it only needs to be done once?.
_________________
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: Mon Jun 09, 2008 8:14 am    Post subject: Reply with quote

No, but there's no point calling FindWindow, GetWindowThreadProcessId, OpenProcess and CloseHandle everytime, once is enough.

And constantly writing memory won't freeze MapleStory, but it will freeze your application.

I suggest you to find the blue message address and jump over it to bypass, then you only have to write memory once.
Back to top
View user's profile Send private message
Reak
I post too much
Reputation: 0

Joined: 15 May 2007
Posts: 3496

PostPosted: Mon Jun 09, 2008 8:32 am    Post subject: Reply with quote

And I suggest you to use MapleStory's class.
There are more windows named 'MapleStory' (Start-Up. Ad, error messages and the folder as well).
So use its class, which is 'MapleStoryClass'. (Of the main-game for sure).
Back to top
View user's profile Send private message
NothingToShow
Grandmaster Cheater Supreme
Reputation: 0

Joined: 11 Jul 2007
Posts: 1579

PostPosted: Mon Jun 09, 2008 10:09 am    Post subject: Reply with quote

I have a question regarded to your EditMemory function.
I made this to work on WoW (edited the FindWindow), but still, it won't work.
Code:
EditMemory($008D86F0, -100);

008D86F0 is the address for the jump height of a character. When you add it to Cheat Engine, you use 8D86F0, but that doesn't work either.
I need to set the value of the address, to -100, but how do I do that?
Back to top
View user's profile Send private message
Reak
I post too much
Reputation: 0

Joined: 15 May 2007
Posts: 3496

PostPosted: Mon Jun 09, 2008 10:19 am    Post subject: Reply with quote

Moller wrote:
I have a question regarded to your EditMemory function.
I made this to work on WoW (edited the FindWindow), but still, it won't work.
Code:
EditMemory($008D86F0, -100);

008D86F0 is the address for the jump height of a character. When you add it to Cheat Engine, you use 8D86F0, but that doesn't work either.
I need to set the value of the address, to -100, but how do I do that?


This function writes with 4 bytes.
Back to top
View user's profile Send private message
NothingToShow
Grandmaster Cheater Supreme
Reputation: 0

Joined: 11 Jul 2007
Posts: 1579

PostPosted: Mon Jun 09, 2008 10:25 am    Post subject: Reply with quote

rEakW0n wrote:
Moller wrote:
I have a question regarded to your EditMemory function.
I made this to work on WoW (edited the FindWindow), but still, it won't work.
Code:
EditMemory($008D86F0, -100);

008D86F0 is the address for the jump height of a character. When you add it to Cheat Engine, you use 8D86F0, but that doesn't work either.
I need to set the value of the address, to -100, but how do I do that?


This function writes with 4 bytes.

So what byte should it be? 2?
Sorry, new to all that real game training.
Back to top
View user's profile Send private message
nwongfeiying
Grandmaster Cheater
Reputation: 2

Joined: 25 Jun 2007
Posts: 695

PostPosted: Mon Jun 09, 2008 10:53 am    Post subject: Reply with quote

I'm just wondering, but why repeatedly freeze the address? It could change. Rather, I would do a ReadProcessMemory and check if it's the value you want it to be and change it if not.
Back to top
View user's profile Send private message
NothingToShow
Grandmaster Cheater Supreme
Reputation: 0

Joined: 11 Jul 2007
Posts: 1579

PostPosted: Mon Jun 09, 2008 2:18 pm    Post subject: Reply with quote

I've read a little more about that, and I think I need to use VirtualProtectEx.
Anyone could tell me how to do that (on WoW, if that helps you)?
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Mon Jun 09, 2008 5:33 pm    Post subject: Reply with quote

I'm not sure how to use APIs in delphi. But I know that you can get ideas from C++, because the declarations and calling can be easily conveted...like

Code:

int x;

//to delphi

var
   x: integer;


So here's code for VirtualProtect.

Code:

MEMORY_BASIC_INFORMATION mbi;
DWORD oldprotect;

VirtualProtect(mbi.BaseAddress, mbi.RegionSize, PAGE_READWRITE, &oldprotect);


That should give you an idea. I suggest looking up the MEMORY_BASIC_INFORMATION structure on msdn, I think in delphi structures are referred to as records? And also look up VirtualProtect.

MEMORY_BASIC_INFORMATION

http://msdn.microsoft.com/en-us/library/aa366775

VirtualProtect

http://msdn.microsoft.com/en-us/library/aa366898

Btw, VirtualProtect only works if you call it from a dll which will be injected into WoW. Otherwise you have to use VirtualProtectEx.

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
NothingToShow
Grandmaster Cheater Supreme
Reputation: 0

Joined: 11 Jul 2007
Posts: 1579

PostPosted: Mon Jun 09, 2008 11:41 pm    Post subject: Reply with quote

oib111 wrote:
I'm not sure how to use APIs in delphi. But I know that you can get ideas from C++, because the declarations and calling can be easily conveted...like

Code:

int x;

//to delphi

var
   x: integer;


So here's code for VirtualProtect.

Code:

MEMORY_BASIC_INFORMATION mbi;
DWORD oldprotect;

VirtualProtect(mbi.BaseAddress, mbi.RegionSize, PAGE_READWRITE, &oldprotect);


That should give you an idea. I suggest looking up the MEMORY_BASIC_INFORMATION structure on msdn, I think in delphi structures are referred to as records? And also look up VirtualProtect.

MEMORY_BASIC_INFORMATION

http://msdn.microsoft.com/en-us/library/aa366775

VirtualProtect

http://msdn.microsoft.com/en-us/library/aa366898

Btw, VirtualProtect only works if you call it from a dll which will be injected into WoW. Otherwise you have to use VirtualProtectEx.

So it seems that using VirtualProtectEx would be alot easier, why not use that then?
Back to top
View user's profile Send private message
angerist
Grandmaster Cheater Supreme
Reputation: 0

Joined: 18 Jun 2007
Posts: 1011
Location: Australia.

PostPosted: Tue Jun 10, 2008 1:28 am    Post subject: Reply with quote

Symbol wrote:
No, but there's no point calling FindWindow, GetWindowThreadProcessId, OpenProcess and CloseHandle everytime, once is enough.

And constantly writing memory won't freeze MapleStory, but it will freeze your application.

I suggest you to find the blue message address and jump over it to bypass, then you only have to write memory once.


That was more detailed. I get it. I'll post snippets of what I've got so far. I've been coding in Delphi for 2 weeks. So I'm constantly running into problems.

_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Tue Jun 10, 2008 8:02 am    Post subject: Reply with quote

Moller wrote:
oib111 wrote:
I'm not sure how to use APIs in delphi. But I know that you can get ideas from C++, because the declarations and calling can be easily conveted...like

Code:

int x;

//to delphi

var
   x: integer;


So here's code for VirtualProtect.

Code:

MEMORY_BASIC_INFORMATION mbi;
DWORD oldprotect;

VirtualProtect(mbi.BaseAddress, mbi.RegionSize, PAGE_READWRITE, &oldprotect);


That should give you an idea. I suggest looking up the MEMORY_BASIC_INFORMATION structure on msdn, I think in delphi structures are referred to as records? And also look up VirtualProtect.

MEMORY_BASIC_INFORMATION

http://msdn.microsoft.com/en-us/library/aa366775

VirtualProtect

http://msdn.microsoft.com/en-us/library/aa366898

Btw, VirtualProtect only works if you call it from a dll which will be injected into WoW. Otherwise you have to use VirtualProtectEx.

So it seems that using VirtualProtectEx would be alot easier, why not use that then?


Quote:

VirtualProtect Function

Changes the protection on a region of committed pages in the virtual address space of the calling process.


Quote:

VirtualProtectEx Function

Changes the protection on a region of committed pages in the virtual address space of a specified process.

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
NothingToShow
Grandmaster Cheater Supreme
Reputation: 0

Joined: 11 Jul 2007
Posts: 1579

PostPosted: Tue Jun 10, 2008 8:33 am    Post subject: Reply with quote

@oib111
I've tried this
Code:
function EditMemory(Address: Integer; Value: Integer): Boolean;
var
  ProcessId, WindowName, HandleWindow: Integer;
  Write: Cardinal;
  mbi: MEMORY_BASIC_INFORMATION;
  oldprotect: dword;
begin
  WindowName := FindWindow(nil, 'World of Warcraft');
  If WindowName = 0 then
  begin
  Result := False;
  Exit;
  end;
  GetWindowThreadProcessId(WindowName, @ProcessId);
  HandleWindow := OpenProcess(PROCESS_ALL_ACCESS, False, ProcessId);
  VirtualProtectEx(HandleWindow, mbi.BaseAddress, mbi.RegionSize, PAGE_READWRITE, @oldprotect);
  WriteProcessMemory(HandleWindow, Ptr(Address), @Value, 2, Write);
  CloseHandle(HandleWindow);
  Result := True;
end;


Code:
EditMemory($008D86F0, -100)


Still no success, any ideas?
Reakwon said it shouldn't be 4 byte, so I tried 2, but I have no idea what it should be.
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
Goto page 1, 2, 3  Next
Page 1 of 3

 
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