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 


getprocaddress?!?! always gets null

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Tue Nov 10, 2009 12:27 pm    Post subject: getprocaddress?!?! always gets null Reply with quote

Code:

HMODULE hWs;
DWORD Address;
hWs = GetModuleHandle(_T("ws2_32.dll"));
Address = (DWORD)GetProcAddress(hWs,"send");


Address = 0 no matter what ?!
but when i want to get some kernel32's procedure address it's all fine...
any1?!
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Tue Nov 10, 2009 12:45 pm    Post subject: Reply with quote

LoadLibrary. If the module is not already mapped into memory which it won't be if your program doesn't use functions/import from it then GetModuleHandle() won't be returning a valid handle
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 Nov 10, 2009 1:02 pm    Post subject: Reply with quote

well look.
i inject my dll into msn process to get it's socket id
so i guess the module is already mapped to msn right?!
all i want to do is to get the address of send
the handle to the module works perfectly
but for some reason i can't get the procedure's address :s

@@@@@EDIT:
lol i'm such a retard ...
forgot removing memory's protection XDDD
my bad
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Wed Nov 18, 2009 8:23 pm    Post subject: Solution Reply with quote

Heres an example:

Code:

GetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA");


Make sure the function exists in the dll.
Back to top
View user's profile Send private message MSN Messenger
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Wed Nov 18, 2009 8:46 pm    Post subject: Reply with quote

Or... if you're using MSVC you may use...

Code:

DWORD fnSend = (DWORD)send;
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Thu Nov 19, 2009 6:53 pm    Post subject: Reply with quote

&Vage wrote:
Or... if you're using MSVC you may use...

Code:

DWORD fnSend = (DWORD)send;


That wont work because first of all "send" isn't defined unless you include the dll's header which I doubt he'd do. Just stick to GetProcAddress().
Back to top
View user's profile Send private message MSN Messenger
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Fri Nov 20, 2009 12:38 am    Post subject: Reply with quote

&Vage wrote:
Or... if you're using MSVC you may use...

Code:

DWORD fnSend = (DWORD)send;

really?
msvc can auto convert it?
thanks..
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