Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Question about WINHTTP_STATUS_CALLBACK in WinHTTP?

Question about WINHTTP_STATUS_CALLBACK in WinHTTP?

Scheduled Pinned Locked Moved C / C++ / MFC
questioncryptographyhelptutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bosfan
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups