InternetUrlCrack() function

Hello guys,

I've got a little problem with this function when I'm trying to crack my URL in URL_COMPONENTS structure, the value of HostName and urlPath members stays on '\0' and meanwhile it's so, I have the true Length of both(HostName and urlPath members).
what is the problem.

Thanks and best wishes,
John Smith.


Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
URL_COMPONENTS urlcomponents;
	urlcomponents.dwStructSize=sizeof(URL_COMPONENTS);
	urlcomponents.dwHostNameLength=10;
	urlcomponents.dwPasswordLength=10;
	urlcomponents.dwSchemeLength=10;
	urlcomponents.dwUrlPathLength=10;
	urlcomponents.dwUserNameLength=10;
	urlcomponents.dwExtraInfoLength=10;
	urlcomponents.lpszExtraInfo=extraInfo;
	urlcomponents.lpszHostName=hostName;
	urlcomponents.lpszPassword=passwordSet;
	urlcomponents.lpszScheme=schemeUrl;
	urlcomponents.lpszUrlPath=fileUrlPath;
	urlcomponents.lpszUserName=userName;
	//urlcomponents.nPort=80;
	
	std::string originUrl="http://s1.asandownload.com/mobile/android/application/Color.Effect.Booth.Pro.v1.4.2_AsanDl.com.apk";

	InternetCrackUrl(originUrl.c_str(),originUrl.Length(),0,&urlcomponents);
Last edited on
After looking at http://msdn.microsoft.com/en-us/library/windows/desktop/aa384376(v=vs.85).aspx
It looks like the second parameter should be the length of the first parameter.
Last edited on
Yea, So Sorry I just wrote it worng in here and in Real Code I tested both originUrl.Length() and 0 and they didn't work.
btw when I use GetLastError it Says :
ERROR_INSUFFICIENT_BUFFER

122 (0x7A)

The data area passed to a system call is too small.

what should I do ?
Last edited on
The Problem solved and I'm Gonna share it here :D

it's so obvious that when the error returns ERROR_INSUFFICIENT_BUFFER
u need to increase the Length or size of something for god sake!!! :D

well I increased it :D
ex:
 
urlcomponents.dwHostNameLength=1024;

cause my buffer size was
 
=new char [1024];


AWESOME!
Topic archived. No new replies allowed.