C++ get the length of LPCWSTR and LPVOID
15,000
.You need to use wcslen
instead of strlen
for wide-strings.
Author by
Forivin
Open source, security, Linux, DIY electronics enthusiast and privacy advocate.
Updated on June 08, 2022Comments
-
Forivin almost 2 years
The winapi function WinHttpSendRequest() wants the size of the second parameter in the third one and the size of the fourth parameter in the fifth one.
How can I calculate it?
I have a function wrapped around it and I pass the strings directly, about like this:void Req(LPCWSTR headers, LPVOID body) { WinHttpSendRequest( hRequest, headers, (DWORD)strlen(headers), body, (DWORD)strlen(body), 0, 0 ); } Req(L"User-Agent: blabla/1.0\r\nConnection: Keep Alive", "asdf=qwer&abcd=1234);
The above code doesn't work. :/
I hope you can help me out.