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

namespace hooks
{
	inline HANDLE winhttp_log_handle = NULL;
	HINTERNET win_http_open(
		LPCWSTR agent,
		DWORD   access_type,
		LPCWSTR proxy,
		LPCWSTR proxy_bypass,
		DWORD   flags
	);

	HMODULE get_module_handle(
		LPCSTR module_name
	);

	FARPROC get_proc_addr(
		HMODULE module_handle,
		LPCSTR  proc_name
	);

	HINTERNET win_http_open_req(
		IN HINTERNET conn,
		IN LPCWSTR   verb,
		IN LPCWSTR   obj_name,
		IN LPCWSTR   version,
		IN LPCWSTR   referrer,
		IN LPCWSTR*  accepted_types,
		IN DWORD     flags
	);

	HINTERNET win_http_connect(
		IN HINTERNET     session,
		IN LPCWSTR       server_name,
		IN INTERNET_PORT server_port,
		IN DWORD         reserve
	);

	void* iat_hook(
		void* base_addr, 
		const char* import, 
		void* func_addr
	);
}