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 


Address of file.dll.

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

Joined: 03 Feb 2011
Posts: 4

PostPosted: Thu Feb 03, 2011 11:43 am    Post subject: Address of file.dll. Reply with quote

Hello. I found few momory addresses, but they are not static. When I double klik on their address, it returns for example: file.dll+1D44B0. How can I read address of file.dll in c++? Thanks for any advices Wink.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Thu Feb 03, 2011 1:11 pm    Post subject: Reply with quote

GetModuleHandle()
Back to top
View user's profile Send private message
Fanatic12
How do I cheat?
Reputation: 0

Joined: 03 Feb 2011
Posts: 4

PostPosted: Thu Feb 03, 2011 1:24 pm    Post subject: Reply with quote

Thabks. I already tryed:

DWORD/HANDLE aaaaaa = GetModuleHandle("samp.dll");
printf("aaaaaa=%x\n", aaaaaa);

But it alwyas returns 0 Confused. Any ideas?
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: Thu Feb 03, 2011 1:36 pm    Post subject: Reply with quote

If you aren't injected into the process GetModuleHandle wont work. If you are doing things outside of the process in a separate exe, use:

#include <Tlhelp32.h>
- CreateToolhelp32Snapshot
- Module32First
- Module32Next

or

#include <psapi.h>
- EnumProcessModules
- GetModuleFileNameEx

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

Joined: 03 Feb 2011
Posts: 4

PostPosted: Thu Feb 03, 2011 2:32 pm    Post subject: Reply with quote

My code:

while(hWnd == 0)
{
hWnd = FindWindow(NULL, "GTA:SA:MP");
Sleep(5000);
}

printf("GTA:SA:MP runs.\n");
GetWindowThreadProcessId(hWnd, &pId);
pHandle = OpenProcess(PROCESS_ALL_ACCESS, TRUE, pId);

HANDLE aaaaaa = GetModuleHandle("samp.dll");
printf("aaaaaa=%d\n", aaaaaa);


It is wrong?
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: Thu Feb 03, 2011 3:03 pm    Post subject: Reply with quote

Yes, that wont work because you are externally obtaining the information. You will need to use one of the methods I stated above, or inject a dll directly into the process if you wish to use GetModuleHandle.

Also be warned that using PROCESS_ALL_ACCESS isn't valid anymore unless more steps are taken. It is best practice to specify exactly what you need when calling OpenProcess for the flags.

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

Joined: 03 Feb 2011
Posts: 4

PostPosted: Thu Feb 03, 2011 3:51 pm    Post subject: Reply with quote

I feel quite noob, but I don't understand this very well Embarassed.
I made this from something I found on msdn:


while(hWnd == 0)
{
hWnd = FindWindow(NULL, "GTA:SA:MP");
Sleep(5000);
}

printf("GTA:SA:MP runs.\n");
GetWindowThreadProcessId(hWnd, &pId);
pHandle = OpenProcess(PROCESS_ALL_ACCESS, TRUE, pId);

HANDLE aaaaaa = CreateToolhelp32Snapshot(0x8u, pId);
MODULEENTRY32 me32;
Module32First(aaaaaa, &me32);
me32.dwSize = sizeof( MODULEENTRY32 );
Module32First( aaaaaa, &me32 );
printf("aaaaaa=%X\n", aaaaaa);
while(Module32Next( aaaaaa, &me32 ))
{
printf("aaaaaa=%X\n", aaaaaa);
}



I don't know what I am doind now. It writes aaaaaa=68 many times. Cheat engine returns 03E90000. Sorry for my stupid questions Rolling Eyes.
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: Thu Feb 03, 2011 4:16 pm    Post subject: Reply with quote

Go back to MSDN and read the pages about the API. You aren't using them properly and you aren't using the structures properly either. The pages on MSDN give more then enough information to use the API.

I don't want to spoon feed you code because then you wont learn anything.

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

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Sun Feb 06, 2011 8:21 pm    Post subject: Reply with quote

if GetModuleHandle () won't work, use LoadLibrary () instead. Or use a snapshot.
Back to top
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Feb 07, 2011 8:38 am    Post subject: Reply with quote

He's not injected, LoadLibrary wont do shit for him.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
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