Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ InternetCrackUrl()函数_C++_Parsing_Winapi_Url_Wininet - Fatal编程技术网

C++ InternetCrackUrl()函数

C++ InternetCrackUrl()函数,c++,parsing,winapi,url,wininet,C++,Parsing,Winapi,Url,Wininet,当我试图在URL\u组件结构中破解我的URL时,这个函数有一个小问题,主机名和urlPath成员的值保持在“\0”上,同时,我有这两个成员的真实长度(主机名和urlPath成员)。 有什么问题?如果你能用密码回答我会很高兴的 谢谢并致以最良好的祝愿, 约翰·史密斯 URL_COMPONENTS urlcomponents; urlcomponents.dwStructSize=sizeof(URL_COMPONENTS); urlcomponents.dwHostNameLength=10; u

当我试图在URL\u组件结构中破解我的URL时,这个函数有一个小问题,主机名和urlPath成员的值保持在“\0”上,同时,我有这两个成员的真实长度(主机名和urlPath成员)。 有什么问题?如果你能用密码回答我会很高兴的

谢谢并致以最良好的祝愿, 约翰·史密斯

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);

您正在将
originUrl.c_str()
传递到
InternetCrackUrl()
dwurlength
参数。您需要传递
0
originUrl.length()
。您还应该检查
InternetCrackUrl()
的返回值是否失败

if (!InternetCrackUrl(originUrl.c_str(),originUrl.length(),0,&urlcomponents))
{
    DWORD ErrCode - GetLastError();
    ...
}

问题解决了,我将在这里分享:D

很明显,当GetLastError返回错误时,缓冲区不足 看在上帝的份上,你需要增加某物的长度或大小!!!:D 所以,我增加了它:D, 例:

因为我的缓冲区大小是

=new char [1024];

太棒了

是的,很抱歉,我只是在这里编写了它,在实际代码中,我测试了originUrl.Length()和0,但它们都不起作用。顺便说一句,当我使用GetLastError时,它会说:ERROR\u unciplement\u BUFFER 122(0x7A)传递给系统调用的数据区域太小。我该怎么办?
=new char [1024];