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++][Resolved] URLDownloadToFile or InternetOpenURL

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Mon Jul 21, 2008 5:25 am    Post subject: [C++][Resolved] URLDownloadToFile or InternetOpenURL Reply with quote

Hi,
My program should download a certain file from the internet (small file, few KB). I tried using both URLDownloadToFile (urlmon.lib) and InternetOpenURL (wininet.lib). But somehow when my code calls URLDownloadToFile or InternetOpenURL the function doesn't return. My program is a dll.
The weird thing is that when I compile the exact same project as a .exe it works completely fine. But as soon as one of those internet functions is called from inside a dll they don't return. I've tried setting the timeout and so on, but no luck. I programmed the same project in MASM but also there the functions only work from a .exe.
Any help or solution would be appreciated.
Thanks in advance,
-Tombana

(By the way: The dll must be loaded by LoadLibrary, not linked because I want it to be injectable)


EDIT:
I've found the problem. I feel soooo stupid Mad. I called those functions from inside the DllMain function instead of creating a new thread which calls the functions. (Yes I know the DllMain function should perform as least operations as possible but I didn't do that because I was just testing)


Last edited by tombana on Mon Jul 21, 2008 3:43 pm; edited 2 times in total
Back to top
View user's profile Send private message
b6ooy
Grandmaster Cheater
Reputation: 0

Joined: 21 Sep 2006
Posts: 653

PostPosted: Mon Jul 21, 2008 5:33 am    Post subject: Reply with quote

I never used this method , but i think you have to call InternetOpen before InternetOpenURL ..

Or use ShellExecute and open it directly [ easier ] ..
Back to top
View user's profile Send private message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Mon Jul 21, 2008 8:09 am    Post subject: Reply with quote

Yes I used InternetOpen before InternetOpenURL.
And the user isn't meant to see that the file is downloaded.
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Mon Jul 21, 2008 9:46 am    Post subject: Reply with quote

im not sure, but it may be the fact that its in a dll that it wont work properly, try it in an exe and see
_________________
Back to top
View user's profile Send private message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Mon Jul 21, 2008 10:39 am    Post subject: Reply with quote

Sorry if I wasn't clear but that's what I said. It works in an exe but the same code in a dll doesn't work.
So are there more win32 api's that have this or just these? Is there a solution?
(If there's not I think I'll try to download the file through winsock)
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Mon Jul 21, 2008 10:49 am    Post subject: Reply with quote

Winsock you would probably have to connect to the host and then make a get request. I suggest you do what you're doing now. Winsock would be too much trouble and work.
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Mon Jul 21, 2008 3:20 pm    Post subject: Reply with quote

What I'm doing now would be very easy if it would work lol.... but if it doesn't I will have to find another way, like manual Winsock stuff.
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