Question about WINHTTP_STATUS_CALLBACK in WinHTTP?
-
Hi, i use in my project WinHTTP and set a callback function with WinHttpSetStatusCallback. That all works fine, but one thing is where i need some help,my mistake maybe to understand this (how to use it)? How to share information about current statuses with the caller? How to share, information from callback with my own "connect" function? Here what im doing:
void MyHttp::Connect()
{
// Open WinHttpOpen(...);
HINTERNET hSession = WinHttpOpen( L"application_t", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
// now set the callback:
WINHTTP_STATUS_CALLBACK mycall = WinHttpSetStatusCallback(hSession, callback, WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS, NULL);/// some other stuff
}// now a piece of the callback :
void CALLBACK callback(HINTERNET hSession, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpStatusInformation, DWORD dwStatusInformationLen)
{
if (dwInternetStatus == WINHTTP_CALLBACK_STATUS_SECURE_FAILURE)
{
DWORD *details = (DWORD*)lpStatusInformation;
if(WINHTTP_CALLBACK_STATUS_FLAG_CERT_DATE_INVALID & *details)
{
// this (is a invalid certificate date, and some other) is the information that i like to share wit my own "connect" function
}
}This is just a snippet of my function, all works fine, only one thing is left : i need this informations from a callback, is there any way to do this?? Many thanks for help! best regards bosfan