Skip to content

Latest commit

 

History

History
135 lines (96 loc) · 6.36 KB

nf-wininet-httpqueryinfow.md

File metadata and controls

135 lines (96 loc) · 6.36 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:wininet.HttpQueryInfoW
HttpQueryInfoW function (wininet.h)
Retrieves header information associated with an HTTP request. (Unicode)
HttpQueryInfo
HttpQueryInfo function [WinINet]
HttpQueryInfoW
_inet_httpqueryinfo_function
wininet.httpqueryinfo
wininet/HttpQueryInfo
wininet/HttpQueryInfoW
wininet\httpqueryinfo.htm
wininet
5747ce19-5004-4eea-abe9-dd00abac1b3b
12/05/2018
HttpQueryInfo, HttpQueryInfo function [WinINet], HttpQueryInfoA, HttpQueryInfoW, _inet_httpqueryinfo_function, wininet.httpqueryinfo, wininet/HttpQueryInfo, wininet/HttpQueryInfoA, wininet/HttpQueryInfoW
wininet.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
HttpQueryInfoW (Unicode) and HttpQueryInfoA (ANSI)
Wininet.lib
Wininet.dll
Windows
19H1
HttpQueryInfoW
wininet/HttpQueryInfoW
c++
APIRef
kbSyntax
DllExport
Wininet.dll
HttpQueryInfo
HttpQueryInfoA
HttpQueryInfoW

HttpQueryInfoW function

-description

Retrieves header information associated with an HTTP request.

-parameters

-param hRequest [in]

A handle returned by a call to the HttpOpenRequest or InternetOpenUrl function.

-param dwInfoLevel [in]

A combination of an attribute to be retrieved and flags that modify the request. For a list of possible attribute and modifier values, see Query Info Flags.

-param lpBuffer [in, out]

A pointer to a buffer to receive the requested information. This parameter must not be NULL.

-param lpdwBufferLength [in, out]

A pointer to a variable that contains, on entry, the size in bytes of the buffer pointed to by lpvBuffer.

When the function returns successfully, this variable contains the number of bytes of information written to the buffer. In the case of a string, the byte count does not include the string's terminating null character.

When the function
fails with an extended error code of ERROR_INSUFFICIENT_BUFFER, the variable pointed to by lpdwBufferLength contains on exit the size, in bytes, of a buffer large enough to receive the requested information. The calling application can then allocate a buffer of this size or larger, and call the function again.

-param lpdwIndex [in, out]

A 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.

-returns

Returns TRUE if successful, or FALSE otherwise. To get extended error information, call GetLastError.

-remarks

You can retrieve the following types of data from HttpQueryInfo:

  • Strings (default)
  • SYSTEMTIME (for dates)
  • DWORD (for STATUS_CODE, CONTENT_LENGTH, and so on, if HTTP_QUERY_FLAG_NUMBER has been used)

If your application requires that the data be returned as a data type other than a string, you must include the appropriate modifier with the attribute passed to dwInfoLevel.

The HttpQueryInfo function is available in Microsoft Internet Explorer 3.0 for ISO-8859-1 characters (HttpQueryInfoA function) and in Internet Explorer 4.0 or later for ISO-8859-1 characters (HttpQueryInfoA function) and for ISO-8859-1 characters converted to UTF-16LE characters.(the HttpQueryInfoW function).

Note  The HttpQueryInfoA function represents headers as ISO-8859-1 characters not ANSI characters. The HttpQueryInfoW function represents headers as ISO-8859-1 characters converted to UTF-16LE characters. As a result, it is never safe to use the HttpQueryInfoW function when the headers can contain non-ASCII characters. Instead, an application can use the MultiByteToWideChar and WideCharToMultiByte functions with a Codepage parameter set to 28591 to map between ANSI characters and UTF-16LE characters.
 
See Retrieving HTTP Headers for an example code calling the HttpQueryInfo function.

Like all other aspects of the WinINet API, this function cannot be safely called from within DllMain or the constructors and destructors of global objects.

Note  WinINet does not support server implementations. In addition, it should not be used from a service. For server implementations or services use Microsoft Windows HTTP Services (WinHTTP).
 

Note

The wininet.h header defines HttpQueryInfo as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

-see-also

HTTP Sessions

Retrieving HTTP Headers

WinINet Functions