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 


C++ ASM convert

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
DarkMystrik
How do I cheat?
Reputation: 0

Joined: 11 Jul 2014
Posts: 1

PostPosted: Mon Dec 01, 2014 9:53 am    Post subject: C++ ASM convert Reply with quote

Hey! I've got a problem i cant seem to solve. I've been searching for the past 4 hours on google, but i couldnt find anything similar to me Razz

Code:
alloc(WhatNowMinesweeper,256)

0067C8F8:
jmp WhatNowMinesweeper

WhatNowMinesweeper:
push eax
mov eax,1
mov [0067C8F8],eax

pop eax


How do i convert that into C++ Inline ASM?

Code:

#include <windows.h>
#define JMP(frm,to) (((int)to - (int)frm)-5)
DWORD Adress = 0x0067C8F8;

__declspec(naked) void myCodeCave()
{
   __asm
   {
         Adress:
         jmp WhatNowMinesweeper

         WhatNowMinesweeper :
         push eax
         mov eax, 1
         mov [Adress], eax

         pop eax

   }
}

void main()
{
   *(BYTE*)Adress = 0xe9; // defining jump opcode
   *(DWORD*)(Adress + 1) = JMP(Adress, myCodeCave);
   *(WORD*)(Adress + 5) = 0x9090;
}

BOOL APIENTRY DllMain(HINSTANCE hDll, DWORD callReason, LPVOID lpReserved) {
   if (callReason == DLL_PROCESS_ATTACH) {
      //MessageBox(NULL, L"Hooked <3 ~Mystrik", L"", MB_OK);
      CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&main, 0, 0, 0);
   }

   return 1;
}

Doesnt seem to work. Because of these errors

puu.sh/dcFBs/6d69e71ce8.png

Could anyone fix it, and after that tell me how they fixed it?
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: Mon Dec 01, 2014 12:45 pm    Post subject: Reply with quote

Auto Assembly is different than a normal assembly.
You can't access / write to an address just by setting Address: followed by the code to execute
you already set a jump instruction in 'Adress' in your main function
remove the jmp WhatNowMinesweeper
I remember writing a very lite tutorial on converting AA scripts to C++ on this forum years ago..
you can look it up it should help you understand your problem.

_________________
Stylo
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