Windows proxy settings ultimate guide part I – WinINET vs. WinHTTP

Very often there is misunderstanding about proxy settings in Windows OS. There is strange things happening, using very different ways how to deploy settings to client or server machines. What is more strange is that sometimes you have proxy settings enabled but they don’t work. But lets start with low level things. To use proxy from developer points of view, you need some API to be attached to, or you need to write your own proxy settings implementation. In Windows environment you have two API-s you can use. One is WinINET, and other is WinHTTP. Lets first talk about WinINET. It exist since Windows NT and Windows 95, and its main purpose is to enable applications to interact with FTP,  HTTP and some other Internet  protocols. It is not intended to be used with server applications or Windows services. In short, from our system point of view (I am system engineer not developer), it is used by now deprecated Internet Explorer and other user applications that leverages Internet connection. It has a lot of capabilities and it supports the use of interactive message dialogs such as entering user credentials.  It is presented in Windows OS with wininet.dll file.

2022-03-02_13-05-38
WinINET architecture

The second API is WinHTTP and it is created with features that will accommodate session isolation, support for services (can be run from service or service account) and impersonation support being called while the thread is impersonating a different user.  Latest version of WinHTTP 5.1 is part of operating system from Windows 2000 SP3, Windows XP SP1 and Windows Server 2003. WinHTTP is opposed to WinINET, non interactive environment for use in service based applications.  This API bring some capabilities like Autoproxy detection implemented in Internet Explorer, using Web Proxy Auto Detection Protocol (WPAD) that is using PAC files (proxy auto configuration). For better understanding, Windows Update service is using WinHTTP API to download updates from Microsoft update site. If you are behind proxy you will need to set proxy settings for WinHTTP to be able to download Microsoft patches

2022-03-02_12-53-59
WinHTTP architecture
image
Windows WPAD service

Just to show usage of WinINIT.dll we will use process explorer from Sysinternals to show that Internet Explorer is using wininit.dll. If you search for this dll in find handle or dll command you will see all executables that are using it. IE is one of them.

image

New browsers and applications are usually using winHTTP API. If we search for this dll you can see One Drive, Edge Chromium, Office, Skype and lot of different apps utilizing winhttp.dll

image

In next part of this guide we will show in what way we can configure proxy settings for both of API-s

One thought on “Windows proxy settings ultimate guide part I – WinINET vs. WinHTTP”

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.