InternetGetProxyInfo function

Important

This function is deprecated on Windows 10, and it is unsupported as of Windows 11. For autoproxy support, use HTTP Services (WinHTTP) version 5.1 instead. For more information, see WinHTTP AutoProxy Support.

Retrieves proxy data for accessing specified resources. This function can be called only by explicitly loading JSProxy.dll.

Syntax

BOOL InternetGetProxyInfo(
  _In_  LPCSTR  lpszUrl,
  _In_  DWORD   dwUrlLength,
  _In_  LPSTR   lpszUrlHostName,
  _In_  DWORD   dwUrlHostNameLength,
  _Out_ LPSTR   *lplpszProxyHostName,
  _Out_ LPDWORD lpdwProxyHostNameLength
);

Parameters

lpszUrl [in]

A pointer to a null-terminated string that specifies the URL of the target HTTP resource.

dwUrlLength [in]

The size, in bytes, of the URL pointed to by lpszUrl.

lpszUrlHostName [in]

A pointer to a null-terminated string that specifies the host name of the target URL.

dwUrlHostNameLength [in]

The size, in bytes, of the host name pointed to by lpszUrlHostName.

lplpszProxyHostName [out]

A pointer to the address of a buffer that receives the URL of the proxy to use in an HTTP request for the specified resource. The application is responsible for freeing this string.

lpdwProxyHostNameLength [out]

A pointer to a variable that receives the size, in bytes, of the string returned in the lplpszProxyHostName buffer.

Return value

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

Remarks

To call InternetGetProxyInfo, you must dynamically link to it using the defined function-pointer type pfnInternetGetProxyInfo. The code snippet below shows how to declare an instance of this function-pointer type and then initialize and call it.

  HMODULE hModJS;                               // Handle for loading the DLL
  pfnInternetGetProxyInfo pIGPI;                // Function-pointer instance

  hModJS = LoadLibrary( TEXT("jsproxy.dll") );
  if (!hModJS)
  {
    _tprintf( TEXT("\nLoadLibrary failed to load jsproxy.dll with error: %d\n"),
            GetLastError( ) );
    return( FALSE );
  }

  pIGPI = (pfnInternetGetProxyInfo)
          GetProcAddress( hModJS, "InternetGetProxyInfo" );
  if (!pIGPI)         
  {
    _tprintf( TEXT("\nGetProcAddress failed to find InternetGetProxyInfo, error: %d\n"),
            GetLastError( ) );
    return( FALSE );
  }

  // The pIGPI function pointer can now be used to call InternetGetProxyInfo.

Like all other aspects of the WinINet API, this function can't 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).

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional [desktop apps only]
Unsupported as of Windows 11
Minimum supported server
Windows 2000 Server [desktop apps only]
DLL
JSProxy.dll

See also