InternetInitializeAutoProxyDll function

There are two WinINet functions named InternetInitializeAutoProxyDll. The first, which merely refreshes the internal state of proxy configuration information from the registry, has a single parameter as documented directly below.

The second function, prototyped as pfnInternetInitializeAutoProxyDll, is part of WinINet's limited autoproxy support, and must be called by dynamically linking to "JSProxy.dll". For autoproxy support, use Windows HTTP Services (WinHTTP) version 5.1. For more information, see WinHTTP AutoProxy Support.


BOOL InternetInitializeAutoProxyDll(
  _In_ DWORD dwReserved


dwReserved [in]

This parameter is reserved and must be 0.

Return value

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

Dynamic-Link pfnInternetInitializeAutoProxyDLL Function

In addition to the function with the syntax above, there is another WinINet function of the same name in "JSProxy.dll" that initializes WinINet autoproxy functionality using an autoconfiguration script loaded either from a temporary file or from a buffer, and optionally registering autoproxy helper functions.

This second version of InternetInitializeAutoProxyDll has the following prototype:

typedef BOOL (CALLBACK *pfnInternetInitializeAutoProxyDll)(
    DWORD dwVersion,
    LPSTR lpszDownloadedTempFile,
    LPSTR lpszMime,
    AutoProxyHelperFunctions* lpAutoProxyCallbacks,
    LPAUTO_PROXY_SCRIPT_BUFFER lpAutoProxyScriptBuffer );


Reserved; set to zero.


If the lpAutoProxyScriptBuffer parameter is NULL or does not point to a valid structure, then this parameter must point to a string that contains the file name and path of a temporary file in which the autoconfig script resides.


Reserved; set to NULL.


Optional pointer to an AutoProxyHelperFunctions structure that contains a v-table that points to the Proxy Auto-Config (PAC)helper functions supported by WinINet. Set to NULL if not used.


Pointer to an AUTO_PROXY_SCRIPT_BUFFER structure. If this parameter is not NULL, and the lpszScriptBuffer member of the structure it points to is not NULL, and the dwStructSize contains the expected structure size, then the lpszDownloadedTempFile parameter is ignored and an autoproxy script is loaded from the buffer pointed to by lpszScriptBuffer.

The JSProxy.dll function can be called using an instance of the pfnInternetInitializeAutoProxyDll type that is initialized at runtime as shown in the code snippet below.

HMODULE hModJS;                           // Handle to load DLL
pfnInternetInitializeAutoProxyDll pIIAPD; // Function-pointer instance

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

pIIAPD = (pfnInternetInitializeAutoProxyDll) 
         GetProcAddress( hModJS, "InternetInitializeAutoProxyDll" );
if (!pIIAPD)                 
   printf( "\nGetProcAddress failed to find InternetInitializeAutoProxyDll with error: %d\n",
           GetLastError( ) );
   return( FALSE );

// pIIAPD can now be used to call InternetInitializeAutoProxyDll


Because the InternetInitializeAutoProxyDll function takes time to complete its operation, it should not be called from a UI thread.

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


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]





See also

WinHTTP AutoProxy Support