title: The parameter is incorrect error with InternetReadFileEx
body: <p>So im trying to read from a file in a website that I have using WinInet functions, and so I was able to do all the InternetConnect() functions and stuff successfully but when I try to do InternetReadFileExA() I keep getting error 87 which mean The parameter is incorrect and of course it doesnt tell me which one I have incorrect so I have no idea how to fix it, I think its probably the 4th parameter in the function which I have set to NULL because as usual Microsoft never tells you how to get specific values, all it says is "A caller supplied context value used for asynchronous operations." and it doesnt tell me what value I should use. Can anyone tell me what I have wrong and how to fix it? Here is my Code</p>
  
  <pre><code>HANDLE fileToSend;
  HINTERNET iNetOpenHandle = InternetOpen(L"FileTransfer", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC);
  
  using namespace std;
  
  int main()
  {
      HINTERNET connectHandle = InternetConnect(iNetOpenHandle, L"IMhidingTheIpHere", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, INTERNET_NO_CALLBACK, NULL);
  
      PCWSTR acceptTypes[2] = {L"text/html", NULL};
      HINTERNET httpReq = HttpOpenRequest(connectHandle, NULL, L"Tutorials.html", NULL, L"http://www.dominihq.hoxty.com/Tutorials.html", acceptTypes, INTERNET_FLAG_RELOAD, NULL);
  
  
  
      if (httpReq != NULL) {
          cout &lt;&lt; "Opened http request successfully" &lt;&lt; endl;
      }
      else {
          cout &lt;&lt; "Could not open http request" &lt;&lt; endl;
          int errCode = GetLastError();
          cout &lt;&lt; "Error Code: " &lt;&lt; errCode &lt;&lt; endl;
      }
  
      INTERNET_BUFFERSA iNetBuffer;
      bool readFileStatus = InternetReadFileExA(httpReq, &amp;iNetBuffer, WININET_API_FLAG_ASYNC, NULL);
  
      if (readFileStatus == true) {
          cout &lt;&lt; "ReadFile completed successfully!" &lt;&lt; endl;
          cout &lt;&lt; "Data: " &lt;&lt; iNetBuffer.lpvBuffer &lt;&lt; endl;
      }
      else {
          cout &lt;&lt; "Could not read file" &lt;&lt; endl;
          int errCode = GetLastError();
          cout &lt;&lt; "Error Code: " &lt;&lt; errCode &lt;&lt; endl;
      }
  
      system("Pause");
      return 0;
  }
  </code></pre>
  
  <p>Here is the part where the error is</p>
  
  <pre><code>bool readFileStatus = InternetReadFileExA(httpReq, &amp;iNetBuffer, WININET_API_FLAG_ASYNC, NULL);
  </code></pre>