c++ - Error 12006 in WinHttpCrackUrl -
i'm trying build address variable. can pass winhttpopenrequest
.
char *unameaddr = (char*) exebaseaddress + 0x34f01c; printf("%s \n", unameaddr); string url = "http://xxxx.xxxx.com/xxxx/?u="; string username = unameaddr; string combine = url + username; cout << combine << endl; //http://xxxx.xxxx.com/xxxx/?u=myusername <-- url_components urlcomp; lpcwstr pwszurl1 = (lpcwstr)combine.c_str(); dword dwurllen = 0;
then have pass here:
hrequest = winhttpopenrequest( hconnect, l"get", urlcomp.lpszurlpath, null, winhttp_no_referer, winhttp_default_accept_types, 0);
urlcomp.lpszurlpath
should http://xxxx.xxxx.com/xxxx/?u=myusername
any advice? application crashes when gets process part.
error
12006 error_internet_unrecognized_scheme url scheme not recognized or not supported.
lpcwstr pwszurl1 = (lpcwstr)combine.c_str();
std::string::c_str
returns const char *
. lpcwstr
const wchar_t *
.
casting lpcwstr
lying compiler , yourself, combine.c_str()
returns not pointer wide-character string.
you'll have better success std::wstring
, represents wide-character strings.
consider reading unicode in windows api more information.
Comments
Post a Comment