 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
andykhoo Newbie cheater
Reputation: 0
Joined: 09 Nov 2008 Posts: 17
|
Posted: Fri Oct 02, 2009 8:05 am Post subject: [Delphi] Problem with ASM |
|
|
When I compile it, there was no error. But when I tick the checkbox, an error pop up
| Code: | | Project Project1.exe raised exception class EAccessViolation with message 'Access Violation at address 04718A4 in module 'Project1.exe'. Read of address '00BE9ED0'. Process Stopped. Use Step or Run to continue. |
Here is my checkbox coding.
| Code: | procedure TForm1.CheckBox17Click(Sender: TObject);
label UAE,
UAEReturn;
begin
if GetProcessID(ProgramName, PidId) then
begin
asm
UAE:
push eax
mov eax,[$00be9ed0]
mov eax,[eax+$2230]
cmp eax,0000050
pop eax
jg UAEReturn
push eax
mov eax,[$00be9ed0]
mov eax,[eax+$0F00]
cmp esi,eax
pop eax
jne UAEReturn
add eax,06
jmp UAEReturn
UAEReturn:
mov [ebx], eax
mov edi,[ebp+10]
end;
SetLength(byteArr, 5);
byteArr[0] := $E9;
byteArr[1] := $73;
byteArr[2] := $1C;
byteArr[3] := $15;
byteArr[4] := $50;
pokeX($009DE388, byteArr);
SetLength(byteArr, 4);
closehandle(PidHandle);
end;
end; |
Anybody can help me?
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Fri Oct 02, 2009 1:16 pm Post subject: |
|
|
| You need to allocate memory within the game you are trying to write this for, then copy the script there. Once it's copied, do your hooks. You can't just execute the asm within your delphi app.
|
|
| Back to top |
|
 |
andykhoo Newbie cheater
Reputation: 0
Joined: 09 Nov 2008 Posts: 17
|
Posted: Fri Oct 02, 2009 7:34 pm Post subject: |
|
|
| smartz993 wrote: | | You need to allocate memory within the game you are trying to write this for, then copy the script there. Once it's copied, do your hooks. You can't just execute the asm within your delphi app. |
But i already did this
| Code: | | if GetProcessID(ProgramName, PidId) then |
How do i allocate the memory? Kindly help?
|
|
| Back to top |
|
 |
igoticecream Grandmaster Cheater Supreme
Reputation: 0
Joined: 23 Apr 2006 Posts: 1807 Location: 0x00400000
|
Posted: Fri Oct 02, 2009 7:55 pm Post subject: |
|
|
| andykhoo wrote: | | smartz993 wrote: | | You need to allocate memory within the game you are trying to write this for, then copy the script there. Once it's copied, do your hooks. You can't just execute the asm within your delphi app. |
But i already did this
| Code: | | if GetProcessID(ProgramName, PidId) then |
How do i allocate the memory? Kindly help? |
1.- New: work with pointers
2.- AllocMem (GetMem, FreeMem): work with handles
3.- GlobalAlloc (GlobalFree, GlobalLock, GlobalUnlock): work with handles
Do i need to list more? Also i you are programming "OOP", you should know about New
|
|
| Back to top |
|
 |
andykhoo Newbie cheater
Reputation: 0
Joined: 09 Nov 2008 Posts: 17
|
Posted: Fri Oct 02, 2009 8:25 pm Post subject: |
|
|
| igoticecream wrote: | | andykhoo wrote: | | smartz993 wrote: | | You need to allocate memory within the game you are trying to write this for, then copy the script there. Once it's copied, do your hooks. You can't just execute the asm within your delphi app. |
But i already did this
| Code: | | if GetProcessID(ProgramName, PidId) then |
How do i allocate the memory? Kindly help? |
1.- New: work with pointers
2.- AllocMem (GetMem, FreeMem): work with handles
3.- GlobalAlloc (GlobalFree, GlobalLock, GlobalUnlock): work with handles
Do i need to list more? Also i you are programming "OOP", you should know about New |
Oh if my script is
I got to allocate 128bytes right?
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Fri Oct 02, 2009 8:39 pm Post subject: |
|
|
| andykhoo wrote: | | igoticecream wrote: | | andykhoo wrote: | | smartz993 wrote: | | You need to allocate memory within the game you are trying to write this for, then copy the script there. Once it's copied, do your hooks. You can't just execute the asm within your delphi app. |
But i already did this
| Code: | | if GetProcessID(ProgramName, PidId) then |
How do i allocate the memory? Kindly help? |
1.- New: work with pointers
2.- AllocMem (GetMem, FreeMem): work with handles
3.- GlobalAlloc (GlobalFree, GlobalLock, GlobalUnlock): work with handles
Do i need to list more? Also i you are programming "OOP", you should know about New |
Oh if my script is
I got to allocate 128bytes right? |
You can use the VirtualAlloc api. That's the way CE does it.
|
|
| Back to top |
|
 |
andykhoo Newbie cheater
Reputation: 0
Joined: 09 Nov 2008 Posts: 17
|
Posted: Fri Oct 02, 2009 8:41 pm Post subject: |
|
|
| smartz993 wrote: | | andykhoo wrote: | | igoticecream wrote: | | andykhoo wrote: | | smartz993 wrote: | | You need to allocate memory within the game you are trying to write this for, then copy the script there. Once it's copied, do your hooks. You can't just execute the asm within your delphi app. |
But i already did this
| Code: | | if GetProcessID(ProgramName, PidId) then |
How do i allocate the memory? Kindly help? |
1.- New: work with pointers
2.- AllocMem (GetMem, FreeMem): work with handles
3.- GlobalAlloc (GlobalFree, GlobalLock, GlobalUnlock): work with handles
Do i need to list more? Also i you are programming "OOP", you should know about New |
Oh if my script is
I got to allocate 128bytes right? |
You can use the VirtualAlloc api. That's the way CE does it. |
This is what I found
| Code: | function VirtualAllocEx (hProcess : Integer;
var lpAddress : Pointer;
var dwSize : Integer;
flAllocationType : Integer;
flProtect : Integer) : Integer;
stdcall; external 'kernel32.dll' name 'VirtualAllocEx' |
So I code it something like this?
| Code: | end;
MS := FindWindow('MSClass', nil);
if MS <>0 then
begin
GetWindowThreadProcessID(MS, @ProcessID);
hProcess:=OpenProcess(PROCESS_ALL_ACCESS,false,ProcessID);
virtualallocex(hProcess,pointer($00be9ed0),128,MEM_COMMIT,page_execute_readwrite);
end;
end; |
I got an error
| Code: | | Constant object cannot be passed as var parameter |
|
|
| Back to top |
|
 |
|
|
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
|
|