http://bugs.winehq.org/show_bug.cgi?id=31051
--- Comment #4 from Ron van der Wal support@tarma.com 2012-07-02 17:30:24 CDT --- ADDITIONAL, CORRECTION: *lpdwIndex need only be updated (if lpdwIndex is non-NULL) if another same-named header is in fact available, for example when enumerating Set-Cookie headers.
However, the original reported bug still stands: If *lpdwIndex exceeds the highest valid header index available for the given dwInfoLevel, then the function should fail with error code ERROR_HTTP_HEADER_NOT_FOUND.
From the Microsoft documentation for HttpQueryInfo():
"lpdwIndex [in, out]
Pointer to a zero-based header index used to enumerate multiple headers with the same name. When calling the function, this parameter is the index of the specified header to return. When the function returns, this parameter is the index of the next header. If the next index cannot be found, ERROR_HTTP_HEADER_NOT_FOUND is returned."
Note that this CORRECTION invalidates the original enumeration sample, but that the information in the original report concerning the affected HTTP_QUERY_* values is still correct.