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 


[Tut] How to convert AA script into your C++ project
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
NoMercy
Master Cheater
Reputation: 1

Joined: 09 Feb 2009
Posts: 289

PostPosted: Wed Oct 07, 2009 1:23 pm    Post subject: Reply with quote

well i dont get an error, ive got it in a dll

everyything is wroking, but when i turn it on, i get a crash and my entire computer = down

nothing works so ive to push on/off button
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Wed Oct 07, 2009 1:35 pm    Post subject: Reply with quote

i also noticed you forgot to return to your original code at the end of your codecave
add it to the end of it
Code:

jmp dword ptr ds:[PinAddress+5]

otherwise you won't get back to your original code
Back to top
View user's profile Send private message
NoMercy
Master Cheater
Reputation: 1

Joined: 09 Feb 2009
Posts: 289

PostPosted: Wed Oct 07, 2009 1:36 pm    Post subject: Reply with quote

oki ill try that:)

thanks

EDIT: still crash

this is AA script i use:
Code:
[enable]
//Updated By Schnee
//0.54 EMS
alloc(pinunrandom,512)
label(returnhere)
label(zeroAlign)
label(continueCompare)

0073D07D: //03 C2 80 38 0A 73 07 80 E1 01 D0 E1 EB 03 80 E1
jmp pinunrandom
returnhere:

pinunrandom:
add eax,edx
push edx
shr edx,1
cmp edx,09
je zeroAlign
ja continueCompare
inc edx
jmp continueCompare

zeroAlign:
mov edx,0

continueCompare:
mov [eax],edx
pop edx
cmp byte ptr [eax],0a
jmp returnhere

[disable]
0073D07D:
add eax,edx
cmp byte ptr [eax],0a

dealloc(pinunrandom)


not updated
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Wed Oct 07, 2009 2:22 pm    Post subject: Reply with quote

NoMercy wrote:
i failed again, ive got this

but i get huge error when i test it

Code:
void __declspec(naked) __stdcall PinUnRan ()
{
   __asm
   {
      add eax,edx
      push edx
      shr edx,0x1
      cmp edx,0x09
      je zeroAlign
      ja continueCompare
      inc edx
      jmp continueCompare

      zeroAlign:
      mov edx,0x0

      continueCompare:
      mov [eax],edx
      pop edx
      cmp byte ptr [eax],0x0a     
   }
}

void PinUnRanDomizer (HWND hWnd)
{
   char PinClean [32];


   //Clean
   SetDlgItemText(hWnd, IDC_PINUN , "On" );
   memcpy (PinClean, (void*)PinAdress,11);
   
   //Code Cave Blink
   *(BYTE*)PinAdress = 0xE9;
   *(DWORD*)(PinAdress + 1) = JMP(PinAdress, PinUnRan);
   

   //Wait
   while (!PinUnRanDomizerExit)
      Sleep (100);

   //Off
   SetDlgItemText(hWnd, IDC_PINUN , "Off" );
   memcpy ((void*)PinAdress,PinClean,11);
   
}


btw it compiles without problems

and could some1 explain this:
Code:
*(BYTE*) and *(DWORD*)

i know how to use, but i wanna know wut it excalty does

thanks at least



Did you CreateThread on your Pin Unrandomizer function ?

If not, your while loop is causing constant sleep within your DLL's main thread, and will fuck things up.

Also,

*(BYTE*), is casting the address after it as a pointer to a byte, then dereferencing it to the value of the byte at the address.

Same goes for *(DWORD*), but it will give the value of the 4 bytes at the given address.


Your hook destination looks like this ?

Code:
DWORD pinAddress = 0x0073D07D;

void __declspec(naked) __stdcall pinUnrandom()
{
   __asm
   {
      add eax,edx
      push edx
      shr edx,1
      cmp edx,09
      je zeroAlign
      ja continueCompare
      inc edx
      jmp continueCompare

zeroAlign:
      mov edx,0

continueCompare:
      mov [eax],edx
      pop edx
      cmp byte ptr [eax],0x0a
      jmp dword ptr ds:[pinAddress+5]
   }
}
Back to top
View user's profile Send private message
NoMercy
Master Cheater
Reputation: 1

Joined: 09 Feb 2009
Posts: 289

PostPosted: Thu Oct 08, 2009 3:37 am    Post subject: Reply with quote

hm

i declare it like this in main.cpp

Code:
if (wParam == IDC_HK1) {
         if (PinUnRanDomizerExit == FALSE) {
            PinUnRanDomizerExit = TRUE;
         }
         else if (PinUnRanDomizerExit == TRUE) {
            PinUnRanDomizerExit = FALSE;
            CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&PinUnRanDomizer, hWnd, 0, 0);
         }
      }


and in hacks.cpp

Code:
#define JMP(frm, to) (int)(((int)to - (int)frm) - 5); //Jump (for codecaves)
#define _CRT_SECURE_NO_WARNINGS 1 //Get rid of annoying messages with _itoa()
#include <windows.h>
#include "Resource.h"

//Extern/shared bools
extern BOOL PinUnRanDomizerExit;
extern BOOL GodExit;

DWORD PinAdress = 0x00743C60;

//Addy not found bool
bool MissingAddy = false; //Missing addy

//------------------------------------------------------------------------------------------



//Find Address


//PostMessage Bypass
DWORD DLLFunc = (DWORD)GetProcAddress( LoadLibraryW(L"User32.dll" ), "PostMessageA" ) + 5;
__declspec(naked) BOOL WINAPI PM(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
   __asm
   {
      mov edi, edi
      push ebp
      mov ebp, esp
      jmp dword ptr ds:[DLLFunc]
   }
}


void __declspec(naked) __stdcall PinUnRan ()
{
   __asm
   {
      add eax,edx
      push edx
      shr edx,0x1
      cmp edx,0x09
      je zeroAlign
      ja continueCompare
      inc edx
      jmp continueCompare

      zeroAlign:
      mov edx,0x0

      continueCompare:
      mov [eax],edx
      pop edx
      cmp byte ptr [eax],0x0a   
     jmp dword ptr ds:[PinAdress+5]
   }
}

void PinUnRanDomizer (HWND hWnd)
{
   char PinClean [32];


   //Clean
   SetDlgItemText(hWnd, IDC_PINUN , "On" );
   memcpy (PinClean, (void*)PinAdress,11);
   
   //Code Cave Blink
   *(BYTE*)PinAdress = 0xE9;
   *(DWORD*)(PinAdress + 1) = JMP(PinAdress, PinUnRan);
   

   //Wait
   while (!PinUnRanDomizerExit)
      Sleep (100);

   //Off
   SetDlgItemText(hWnd, IDC_PINUN , "Off" );
   memcpy ((void*)PinAdress,PinClean,11);
   
}


so u are saying i shouldt use the whil loop but a simple if?
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Thu Oct 08, 2009 4:46 am    Post subject: Reply with quote

If it is holding up the main thread of the DLL, i don't see why the game would crash. The DLL would just freeze up, lol.

And yes, turn it off a different way.

Why don't you just have a BOOL that determines whether it is on or off?
Back to top
View user's profile Send private message
NoMercy
Master Cheater
Reputation: 1

Joined: 09 Feb 2009
Posts: 289

PostPosted: Thu Oct 08, 2009 4:50 am    Post subject: Reply with quote

idk ill try that, the BOOL

but it doesnt have anything to do why it shouldnt work right?

but not only the game crash, my entire computer crashes
Back to top
View user's profile Send private message
Deltron Z
Expert Cheater
Reputation: 1

Joined: 14 Jun 2009
Posts: 164

PostPosted: Thu Oct 08, 2009 6:07 am    Post subject: Reply with quote

1qaz wrote:
i also noticed you forgot to return to your original code at the end of your codecave
add it to the end of it
Code:

jmp dword ptr ds:[PinAddress+5]

otherwise you won't get back to your original code

Incorrect. you need to read the value from PinAddress and then add 5, you added 5 to PinAddress and read the value of that address.
Back to top
View user's profile Send private message
namek303
Grandmaster Cheater
Reputation: 0

Joined: 05 Jun 2006
Posts: 709

PostPosted: Thu Oct 08, 2009 9:00 am    Post subject: Reply with quote

Also another reason why it may crash is it executes the script more then 1 time. like if you put the code in a function that loops.

what would fix that is a simple bool like said with a if statement.

a if like this

if((hotkey== pressed) && (yourbool == false){
yourbool = true; // prevents it from executing the code more then 1 time

//the rest of your code here.

}


//something like that should work. i found it worked for me.

_________________
Back to top
View user's profile Send private message AIM Address
NoMercy
Master Cheater
Reputation: 1

Joined: 09 Feb 2009
Posts: 289

PostPosted: Thu Oct 08, 2009 11:33 am    Post subject: Reply with quote

Deltron Z wrote:
1qaz wrote:
i also noticed you forgot to return to your original code at the end of your codecave
add it to the end of it
Code:

jmp dword ptr ds:[PinAddress+5]

otherwise you won't get back to your original code

Incorrect. you need to read the value from PinAddress and then add 5, you added 5 to PinAddress and read the value of that address.


lol, so its not needed?
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Thu Oct 08, 2009 11:41 am    Post subject: Reply with quote

it doesn't matter whether you add the 5 b4 or after you modify the address
the important thing is to return to your original code[/list]
Back to top
View user's profile Send private message
anglelover
How do I cheat?
Reputation: 0

Joined: 09 Aug 2010
Posts: 3

PostPosted: Fri Aug 13, 2010 12:09 am    Post subject: Reply with quote

How to convert AA script into your C# project.please. who can send email to me? my email: motnuacuatoioi19@yahoo com
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 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