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 


[Help] Exporting addresses like "Exe.exe"+02583 in

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
PsychicSymphony
Newbie cheater
Reputation: 0

Joined: 17 May 2011
Posts: 13
Location: Ontario

PostPosted: Wed May 25, 2011 4:42 pm    Post subject: [Help] Exporting addresses like "Exe.exe"+02583 in Reply with quote

Ok so I have this auto assembly script in cheat engine.
Its a code injection script and its pretty simple I just have one problem. Im exporting it into inline asm in c++(__asm) and you cant use the "Whatever.exe"+04832: like in auto assembly. How do you use it in c++?

_________________
Psychic Symphony
////
// Very Happy //
// //
////
Back to top
View user's profile Send private message
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Wed May 25, 2011 6:24 pm    Post subject: Reply with quote

Get the module's base address, and add the offset to it.

Code:
#include <windows.h>
#include <tlhelp32.h>
#include <tchar.h>

DWORD_PTR dwGetModuleBaseAddress(DWORD dwProcessIdentifier, TCHAR *szModuleName)
{
   DWORD_PTR dwModuleBaseAddress = 0;
   HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, dwProcessIdentifier); 
   if (hSnapshot != INVALID_HANDLE_VALUE)
   {
      MODULEENTRY32 ModuleEntry32;
      ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
      if (Module32First(hSnapshot, &ModuleEntry32))
      {
         do
         {
            if (_tcsicmp(ModuleEntry32.szModule, szModuleName) == 0)
            {
               dwModuleBaseAddress = (DWORD_PTR)ModuleEntry32.modBaseAddr;
               break;
            }
         }
         while (Module32Next(hSnapshot, &ModuleEntry32));
      }
      CloseHandle(hSnapshot);
   }
   return dwModuleBaseAddress;
}


Last edited by Innovation on Fri Mar 08, 2013 9:12 pm; edited 5 times in total
Back to top
View user's profile Send private message
PsychicSymphony
Newbie cheater
Reputation: 0

Joined: 17 May 2011
Posts: 13
Location: Ontario

PostPosted: Wed May 25, 2011 6:56 pm    Post subject: Reply with quote

How do you get the offset?
_________________
Psychic Symphony
////
// Very Happy //
// //
////
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Thu May 26, 2011 5:42 pm    Post subject: Reply with quote

The offset is what it is +
Back to top
View user's profile Send private message
steebchen
How do I cheat?
Reputation: 0

Joined: 06 Dec 2013
Posts: 5

PostPosted: Fri Dec 06, 2013 3:28 pm    Post subject: Code doesn't work Reply with quote

Hi, when I use the code Innovation posted, I get an error in Visual Basic, that there is an ";" missing. When I add it, the message hides, but another two display:
"The identifier is not defined" (I translated this, so it may be not the exact error msg). 1. for dwProcessIdentifier, 2. for szModuleName.

I'm using Visual Studio Express 2013, and I also put the includes in my code.


Last edited by steebchen on Sun Dec 08, 2013 8:08 am; edited 1 time in total
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Fri Dec 06, 2013 3:52 pm    Post subject: Re: Code doesn't work Reply with quote

steebchen wrote:
Hi, when I use the code Innovation posted, I get an error in Visual Basic, that there is an ";" missing. When I add it, the message hides, but another two display:
"The identifier is not defined" (I translated this, so it may be not the exact error msg). 1. for dwProcessIdentifier, 2. for szModuleName.

I'm using Visual Basic Express 2013, and I also put the includes in my code.


That is because it is not Visual Basic code, it is C++.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
steebchen
How do I cheat?
Reputation: 0

Joined: 06 Dec 2013
Posts: 5

PostPosted: Fri Dec 06, 2013 4:35 pm    Post subject: Reply with quote

I use C++.
Edit:
Problem almost solved.
I put it in main(), instead of before main.
Back to top
View user's profile Send private message
steebchen
How do I cheat?
Reputation: 0

Joined: 06 Dec 2013
Posts: 5

PostPosted: Sun Dec 08, 2013 8:08 am    Post subject: Reply with quote

And which values / variables I have to put in the function call?
Can you give me an example?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun Dec 08, 2013 1:15 pm    Post subject: Reply with quote

steebchen wrote:
And which values / variables I have to put in the function call?
Can you give me an example?


Perhaps you need to stop and actually learn the language. Copy pasting things and then asking for help every time you get a compile error is not the way to go about making a cheat or learning a language.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
omoe
Grandmaster Cheater
Reputation: 8

Joined: 11 Jun 2013
Posts: 547

PostPosted: Sun Dec 08, 2013 2:23 pm    Post subject: Reply with quote

steebchen wrote:
And which values / variables I have to put in the function call?
Can you give me an example?

I started learning c++ 5 days ago but i think this is how you use it .

dwGetModuleBaseAddress(DWORD dwProcessIdentifier, TCHAR *szModuleName) ;
replace - with
DWORD dwProcessIdentifier = Process id
TCHAR *szModuleName= the name of the module you want to get the base for . e.g. Whatever.exe
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 09, 2013 2:40 pm    Post subject: Reply with quote

5 days of learning C++ must be good enough for messing around with virtual memory..
I'd suggest you go back and make some effort before jumping around screwing whatever is executed Smile

_________________
Stylo
Back to top
View user's profile Send private message
omoe
Grandmaster Cheater
Reputation: 8

Joined: 11 Jun 2013
Posts: 547

PostPosted: Mon Dec 09, 2013 4:01 pm    Post subject: Reply with quote

Stylo wrote:
5 days of learning C++ must be good enough for messing around with virtual memory..
I'd suggest you go back and make some effort before jumping around screwing whatever is executed Smile

Was my answer wrong or something ? . Shocked
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: Tue Dec 10, 2013 6:11 am    Post subject: Reply with quote

omoe wrote:
Stylo wrote:
5 days of learning C++ must be good enough for messing around with virtual memory..
I'd suggest you go back and make some effort before jumping around screwing whatever is executed Smile

Was my answer wrong or something ? . Shocked

You were perfectly right Very Happy

_________________
Stylo
Back to top
View user's profile Send private message
steebchen
How do I cheat?
Reputation: 0

Joined: 06 Dec 2013
Posts: 5

PostPosted: Tue Dec 10, 2013 8:25 am    Post subject: Reply with quote

Got it now, thank you.
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