#pragma once
#include <Windows.h>
#include <winhttp.h>

typedef BOOL(WINAPI *WINHTTPCLOSEHANDLE)(_In_ HINTERNET hInternet);
typedef HINTERNET(WINAPI *WINHTTPCONNECT)(_In_ HINTERNET hSession, _In_ LPCWSTR pswzServerName, _In_ INTERNET_PORT nServerPort, _Reserved_ DWORD dwReserved);
typedef BOOL(WINAPI *WINHTTPGETIEPROXYCONFIGFORCURRENTUSER)(_Inout_ WINHTTP_CURRENT_USER_IE_PROXY_CONFIG *pProxyConfig);
typedef BOOL(WINAPI *WINHTTPGETPROXYFORURL)(_In_ HINTERNET hSession, _In_ LPCWSTR lpcwszUrl, _In_  WINHTTP_AUTOPROXY_OPTIONS *pAutoProxyOptions, _Out_ WINHTTP_PROXY_INFO *pProxyInfo);
typedef HINTERNET(WINAPI *WINHTTPOPEN)(_In_opt_ LPCWSTR pwszUserAgent, _In_ DWORD dwAccessType, _In_ LPCWSTR pwszProxyName, _In_ LPCWSTR pwszProxyBypass, _In_ DWORD dwFlags);
typedef HINTERNET(WINAPI *WINHTTPOPENREQUEST)(_In_ HINTERNET hConnect, _In_ LPCWSTR pwszVerb, _In_ LPCWSTR pwszObjectName, _In_ LPCWSTR pwszVersion, _In_ LPCWSTR pwszReferrer, _In_ LPCWSTR *ppwszAcceptTypes, _In_ DWORD dwFlags);
typedef BOOL(WINAPI *WINHTTPQUERYHEADERS)(_In_ HINTERNET hRequest, _In_ DWORD dwInfoLevel, _In_opt_ LPCWSTR pwszName, _Out_ LPVOID lpBuffer, _Inout_ LPDWORD lpdwBufferLength, _Inout_ LPDWORD lpdwIndex);
typedef BOOL(WINAPI *WINHTTPREADDATA)(_In_ HINTERNET hRequest, _Out_ LPVOID lpBuffer, _In_  DWORD dwNumberOfBytesToRead, _Out_ LPDWORD   lpdwNumberOfBytesRead);
typedef BOOL(WINAPI *WINHTTPRECEIVERESPONSE)(_In_ HINTERNET hRequest, _Reserved_ LPVOID lpReserved);
typedef BOOL (WINAPI *WINHTTPSENDREQUEST)(_In_ HINTERNET hRequest, _In_opt_ LPCWSTR pwszHeaders, _In_ DWORD dwHeadersLength, _In_opt_ LPVOID lpOptional, _In_ DWORD dwOptionalLength, _In_ DWORD dwTotalLength, _In_ DWORD_PTR dwContext);
typedef BOOL(WINAPI *WINHTTPSETOPTION)(_In_ HINTERNET hInternet, _In_ DWORD dwOption, _In_ LPVOID lpBuffer, _In_ DWORD dwBufferLength);
typedef BOOL(WINAPI *WINHTTPSETTIMEOUTS)(_In_ HINTERNET hInternet, _In_ int dwResolveTimeout, _In_ int dwConnectTimeout, _In_ int dwSendTimeout, _In_ int dwReceiveTimeout);



typedef struct _VTABLE_WINHTTP
{
	WINHTTPCLOSEHANDLE fpWinHttpCloseHandle;
	WINHTTPCONNECT fpWinHttpConnect;
	WINHTTPGETIEPROXYCONFIGFORCURRENTUSER fpWinHttpGetIEProxyConfigForCurrentUser;
	WINHTTPGETPROXYFORURL fpWinHttpGetProxyForUrl;
	WINHTTPOPEN fpWinHttpOpen;
	WINHTTPOPENREQUEST fpWinHttpOpenRequest;
	WINHTTPQUERYHEADERS fpWinHttpQueryHeaders;
	WINHTTPREADDATA fpWinHttpReadData;
	WINHTTPRECEIVERESPONSE fpWinHttpReceiveResponse;
	WINHTTPSENDREQUEST fpWinHttpSendRequest;
	WINHTTPSETOPTION fpWinHttpSetOption;
	WINHTTPSETTIMEOUTS fpWinHttpSetTimeouts;

} VTABLE_WINHTTP, *PVTABLE_WINHTTP;

