#pragma once


#ifdef _DIRECT_CALLS

/* ---> kernel32 <--- */

/* C */
#define API_CLOSEHANDLE                  CloseHandle
#define API_CREATEPIPE					 CreatePipe

/* E */
#define API_EXPANDENVIRONMENTSTRINGSA	ExpandEnvironmentStringsA
#define API_ENTERCRITICALSECTION			 EnterCriticalSection

/* F */
#define API_FINDCLOSE			FindClose
#define API_FINDFIRSTFILEA		FindFirstFileA
#define API_FINDNEXTFILEA		FindNextFileA


/* G */
#define API_GETCURRENTPROCESS                    GetCurrentProcess
#define API_GETDRIVETYPEA		GetDriveTypeA
#define API_GETENVIRONMENTVARIABLEA			 GetEnvironmentVariableA
#define API_GETENVIRONMENTVARIABLEW			 GetEnvironmentVariableW
#define API_GETLASTERROR		GetLastError
#define API_GETPROCADDRESS			 GetProcAddress
#define API_GETSYSTEMTIMEASFILETIME			 GetSystemTimeAsFileTime
#define API_GETTICKCOUNT			 GetTickCount

/* I */
#define API_INITIALIZECRITICALSECTION			 InitializeCriticalSection


/* L */
#define API_LEAVECRITICALSECTION			 LeaveCriticalSection
#define API_LOCALALLOC			 LocalAlloc
#define API_LOADLIBRARYA			 LoadLibraryA
#define API_LOCALFREE			 LocalFree
#define API_LOCALREALLOC			 LocalReAlloc

/* O */
#define API_OUTPUTDEBUGSTRINGA			 OutputDebugStringA

/* R */
#define API_READFILE			 ReadFile

/* S */
#define API_SLEEP			 Sleep

/* V */
#define API_VIRTUALALLOC			 VirtualAlloc
#define API_VIRTUALALLOCEX			 VirtualAllocEx
#define API_VIRTUALFREE			 VirtualFree
#define API_VIRTUALPROTECT			 VirtualProtect

/* W */
#define API_WAITFORSINGLEOBJECT			 WaitForSingleObject

/* ---> advapi32 <--- */

/* C */
#define API_CONVERTSIDTOSTRINGSIDA		ConvertSidToStringSidA

/* G */
#define API_GETTOKENINFORMATION			GetTokenInformation

/* O */
#define API_OPENPROCESSTOKEN            OpenProcessToken

/* ---> msvcrt <--- */

/* B */
#define API__BEGINTHREADEX			 _beginthreadex

/* C */
#define API__CLOSE			 _close

/* I */
#define API_ISDIGIT			 isdigit
#define API_ISSPACE			 isspace
#define API__ITOA_S			 _itoa_s
#define API__ITOW_S			 _itow_s

/* M */
#define API_MEMCMP			 memcmp
#define API_MEMCPY			  memcpy
#define API_MEMCPY_S		  memcpy_s
#define API_MEMSET			 memset

/* O */
#define API__OPEN			 _open

/* R */
#define API_RAND			 rand
#define API_READ			 read

/* S */
#define API__SNPRINTF_S			 _snprintf_s
#define API__SNPRINTF			 _snprintf
#define API_SRAND			 srand
#define API_STRCMP			strcmp
#define API_STRDUP			 strdup
#define API_STRLEN			 strlen
#define API_STRRCHR			 strrchr
#define API_SSCANF			 sscanf
#define API_SSCANF_S			 sscanf_s
#define API_STRCAT_S			 strcat_s
#define API_STRCHR			 strchr
#define API__STRNICMP			 _strnicmp
#define API_STRNCMP			 strncmp
#define API_STRTOD			 strtod
#define API_SWPRINTF_S			 swprintf_s

/* T */
#define API_TIME			 time

/* V */
#define API__VSCPRINTF			 _vscprintf
#define API_VSNPRINTF			 vsnprintf
#define API_VSPRINTF			 vsprintf

/* W */
#define API_WCSCAT_S			 wcscat_s
#define API_WCSCPY_S			 wcscpy_s
#define API_WCSLEN			 wcslen
#define API__WRITE			 _write
#define API__WTOI			 _wtoi

/* ---> Winhttp <--- */
#define API_WINHTTPCLOSEHANDLE                   WinHttpCloseHandle
#define API_WINHTTPCONNECT                       WinHttpConnect
#define API_WINHTTPGETIEPROXYCONFIGFORCURRENTUSER                        WinHttpGetIEProxyConfigForCurrentUser
#define API_WINHTTPGETPROXYFORURL                        WinHttpGetProxyForUrl
#define API_WINHTTPOPEN                  WinHttpOpen
#define API_WINHTTPOPENREQUEST                   WinHttpOpenRequest
#define API_WINHTTPQUERYHEADERS                  WinHttpQueryHeaders
#define API_WINHTTPREADDATA                      WinHttpReadData
#define API_WINHTTPRECEIVERESPONSE                       WinHttpReceiveResponse
#define API_WINHTTPSENDREQUEST                   WinHttpSendRequest
#define API_WINHTTPSETOPTION                     WinHttpSetOption
#define API_WINHTTPSETTIMEOUTS                   WinHttpSetTimeouts


/* ---> Winsock <--- */
#define API_GETHOSTBYNAME		 gethostbyname
#define API_INET_ADDR			 inet_addr
#define API_INET_NTOA			 inet_ntoa
#define API_NTOHL				 ntohl
#define API_WSACLEANUP			 WSACleanup
#define API_WSASTARTUP			 WSAStartup


/* allocators */
#define API_ALLOC		noRuntimeAlloc
#define API_CALLOC	    noRuntimeCalloc
#define API_FREE		noRuntimeFree
#define API_REALLOC		noRuntimeRealloc

#else

/* ---> kernel32 <-- */

/* C */
#define API_CLOSEHANDLE                  pRuntime->pKernel32->fpCloseHandle
#define API_CREATEFILEA			 pRuntime->pKernel32->fpCreateFileA
#define API_CREATEPIPE			 pRuntime->pKernel32->fpCreatePipe
#define API_CREATEPROCESSA			 pRuntime->pKernel32->fpCreateProcessA
#define API_CREATETHREAD			 pRuntime->pKernel32->fpCreateThread

/* D */
#define API_DELETEFILE			 pRuntime->pKernel32->fpDeleteFile

/* E */
#define API_ENTERCRITICALSECTION			 pRuntime->pKernel32->fpEnterCriticalSection
#define API_EXPANDENVIRONMENTSTRINGSA	pRuntime->pKernel32->fpExpandEnvironmentStringsA
#define API_EXITTHREAD			 pRuntime->pKernel32->fpExitThread

/* F */
#define API_FINDCLOSE			pRuntime->pKernel32->fpFindClose
#define API_FINDFIRSTFILEA		pRuntime->pKernel32->fpFindFirstFileA
#define API_FLUSHFILEBUFFERS			 pRuntime->pKernel32->fpFlushFileBuffers
#define API_FINDNEXTFILEA		pRuntime->pKernel32->fpFindNextFileA


/* G */
#define API_GETCURRENTPROCESS                    pRuntime->pKernel32->fpGetCurrentProcess
#define API_GETDRIVETYPEA		pRuntime->pKernel32->fpGetDriveTypeA
#define API_GETENVIRONMENTVARIABLEA			 pRuntime->pKernel32->fpGetEnvironmentVariableA
#define API_GETENVIRONMENTVARIABLEW			 pRuntime->pKernel32->fpGetEnvironmentVariableW
#define API_GETFILESIZE			 pRuntime->pKernel32->fpGetFileSize
#define API_GETLASTERROR		pRuntime->pKernel32->fpGetLastError
#define API_GETPROCADDRESS			 pRuntime->pKernel32->fpGetProcAddress
#define API_GETSYSTEMTIMEASFILETIME			 pRuntime->pKernel32->fpGetSystemTimeAsFileTime
#define API_GETTICKCOUNT			 pRuntime->pKernel32->fpGetTickCount
#define API_GLOBALLOCK			 pRuntime->pKernel32->fpGlobalLock
#define API_GLOBALUNLOCK			 pRuntime->pKernel32->fpGlobalUnlock

/* I */
#define API_INITIALIZECRITICALSECTION			 pRuntime->pKernel32->fpInitializeCriticalSection

/* L */
#define API_LEAVECRITICALSECTION			 pRuntime->pKernel32->fpLeaveCriticalSection

/* O */
#define API_OUTPUTDEBUGSTRINGA  pRuntime->pKernel32->fpOutputDebugStringA

/* R */
#define API_READFILE			 pRuntime->pKernel32->fpReadFile

/* S */
#define API_SLEEP                        pRuntime->pKernel32->fpSleep

/* V */
#define API_VIRTUALALLOC                         pRuntime->pKernel32->fp_VirtualAlloc
#define API_VIRTUALALLOCEX                       pRuntime->pKernel32->fp_VirtualAllocEx
#define API_VIRTUALFREE                  pRuntime->pKernel32->fp_VirtualFree
#define API_VIRTUALPROTECT                       pRuntime->pKernel32->fp_VirtualProtect

/* W */
#define API_WAITFORSINGLEOBJECT			 pRuntime->pKernel32->fpWaitForSingleObject
#define API_WRITEFILE			 pRuntime->pKernel32->fpWriteFile

/* ---> advapi32 <--- */

/* C */
#define API_CONVERTSIDTOSTRINGSIDA			 pRuntime->pAdvapi32->fpConvertSidToStringSidA

/* G */
#define API_GETTOKENINFORMATION			 pRuntime->pAdvapi32->fpGetTokenInformation

/* O */
#define API_OPENPROCESSTOKEN                     pRuntime->pAdvapi32->fpOpenProcessToken

/* R */
#define API_REGCLOSEKEY			 pRuntime->pAdvapi32->fpRegCloseKey
#define API_REGCREATEKEYEXA			 pRuntime->pAdvapi32->fpRegCreateKeyExA
#define API_REGDELETEKEYA			 pRuntime->pAdvapi32->fpRegDeleteKeyA
#define API_REGDISABLEREFLECTIONKEY			 pRuntime->pAdvapi32->fpRegDisableReflectionKey
#define API_REGENABLEREFLECTIONKEY			 pRuntime->pAdvapi32->fpRegEnableReflectionKey
#define API_REGOPENCURRENTUSER			 pRuntime->pAdvapi32->fpRegOpenCurrentUser
#define API_REGOPENKEYEXA			 pRuntime->pAdvapi32->fpRegOpenKeyExA
#define API_REGQUERYREFLECTIONKEY			 pRuntime->pAdvapi32->fpRegQueryReflectionKey
#define API_REGSETVALUEEXA			 pRuntime->pAdvapi32->fpRegSetValueExA

/* ---> msvcrt <--- */

/* B */
#define API__BEGINTHREADEX			 pRuntime->pMsvcrt->fp_beginthreadex

/* C */
#define API__CLOSE			 pRuntime->pMsvcrt->fp_close

/* I */
#define API_ISDIGIT			 pRuntime->pMsvcrt->fp_isdigit
#define API_ISSPACE			 pRuntime->pMsvcrt->fp_isspace
#define API__ITOA_S			 pRuntime->pMsvcrt->fp_itoa_s
#define API__ITOW_S			 pRuntime->pMsvcrt->fp_itow_s

/* M */
#define API_MEMCMP				 pRuntime->pMsvcrt->fpmemcmp
#define API_MEMCPY				 pRuntime->pMsvcrt->fp_memcpy
#define API_MEMCPY_S			 pRuntime->pMsvcrt->fp_memcpy_s
#define API_MEMSET				 pRuntime->pMsvcrt->fpmemset

/* O */
#define API__OPEN			 pRuntime->pMsvcrt->fp_open

/* R */
#define API_RAND			 pRuntime->pMsvcrt->fp_rand
#define API_READ			 pRuntime->pMsvcrt->fp_read

/* S */
#define API__SNPRINTF_S			pRuntime->pMsvcrt->fp__snprintf_s
#define API__SNPRINTF			pRuntime->pMsvcrt->fp_snprintf
#define API_SRAND				pRuntime->pMsvcrt->fp_srand
#define API_STRCMP				pRuntime->pMsvcrt->fp_strcmp
#define API_STRDUP				pRuntime->pMsvcrt->fp_strdup
#define API_STRLEN				pRuntime->pMsvcrt->fp_strlen
#define API_STRRCHR				pRuntime->pMsvcrt->fp_strrchr
#define API_SSCANF			    pRuntime->pMsvcrt->fp_sscanf
#define API_SSCANF_S			pRuntime->pMsvcrt->fp_sscanf_s
#define API_STRCAT_S			pRuntime->pMsvcrt->fp_strcat_s
#define API_STRCHR				pRuntime->pMsvcrt->fp_strchr
#define API__STRNICMP			pRuntime->pMsvcrt->fp_strnicmp
#define API_STRNCPY_S			pRuntime->pMsvcrt->fp_strncpy_s
#define API_STRNCMP			    pRuntime->pMsvcrt->fp_strncmp
#define API_STRTOD				pRuntime->pMsvcrt->fp_strtod
#define API_SWPRINTF_S			pRuntime->pMsvcrt->fp_swprintf_s

/* T */
#define API_TIME			    pRuntime->pMsvcrt->fp_time

/* V */
#define API__VSCPRINTF			 pRuntime->pMsvcrt->fp_vscprintf
#define API_VSNPRINTF			 pRuntime->pMsvcrt->fp_vsnprintf
#define API_VSPRINTF			 pRuntime->pMsvcrt->fp_vsprintf

/* W */
#define API_WCSCAT_S			 pRuntime->pMsvcrt->fpwcscat_s
#define API_WCSCPY_S			 pRuntime->pMsvcrt->fpwcscpy_s
#define API_WCSLEN				 pRuntime->pMsvcrt->fpwcslen
#define API__WRITE				 pRuntime->pMsvcrt->fp_write
#define API__WTOI				 pRuntime->pMsvcrt->fp_wtoi


/* ---> Winhttp <--- */
#define API_WINHTTPCLOSEHANDLE                   pRuntime->pWinhttp->fpWinHttpCloseHandle
#define API_WINHTTPCONNECT                       pRuntime->pWinhttp->fpWinHttpConnect
#define API_WINHTTPGETIEPROXYCONFIGFORCURRENTUSER  pRuntime->pWinhttp->fpWinHttpGetIEProxyConfigForCurrentUser
#define API_WINHTTPGETPROXYFORURL                pRuntime->pWinhttp->fpWinHttpGetProxyForUrl
#define API_WINHTTPOPEN							 pRuntime->pWinhttp->fpWinHttpOpen
#define API_WINHTTPOPENREQUEST                   pRuntime->pWinhttp->fpWinHttpOpenRequest
#define API_WINHTTPQUERYHEADERS                  pRuntime->pWinhttp->fpWinHttpQueryHeaders
#define API_WINHTTPREADDATA                      pRuntime->pWinhttp->fpWinHttpReadData
#define API_WINHTTPRECEIVERESPONSE               pRuntime->pWinhttp->fpWinHttpReceiveResponse
#define API_WINHTTPSENDREQUEST                   pRuntime->pWinhttp->fpWinHttpSendRequest
#define API_WINHTTPSETOPTION                     pRuntime->pWinhttp->fpWinHttpSetOption
#define API_WINHTTPSETTIMEOUTS                   pRuntime->pWinhttp->fpWinHttpSetTimeouts


/* ---> Winsock <--- */
#define API_GETHOSTBYNAME		 pRuntime->pWs2_32->fpGethostbyname
#define API_INET_ADDR			 pRuntime->pWs2_32->fpInet_addr
#define API_INET_NTOA			 pRuntime->pWs2_32->fpInet_ntoa
#define API_NTOHL				 pRuntime->pWs2_32->fpNtohl
#define API_WSACLEANUP			 pRuntime->pWs2_32->fpWSACleanup
#define API_WSASTARTUP			 pRuntime->pWs2_32->fpWSAStartup


/* Ole32 */

/* C */
#define API_COCREATEINSTANCE			 pRuntime->pOle32->fpCoCreateInstance
#define API_COINITIALIZEEX			 pRuntime->pOle32->fpCoInitializeEx
#define API_COINITIALIZESECURITY			 pRuntime->pOle32->fpCoInitializeSecurity
#define API_COSETPROXYBLANKET			 pRuntime->pOle32->fpCoSetProxyBlanket
#define API_COUNINITIALIZE			 pRuntime->pOle32->fpCoUninitialize

/* OleAut32 */

/* S */
#define API_SYSALLOCSTRING			 pRuntime->pOleAut32->fpSysAllocString
#define API_SYSFREESTRING			 pRuntime->pOleAut32->fpSysFreeString

/* V */
#define API_VARIANTCLEAR			 pRuntime->pOleAut32->fpVariantClear
#define API_VARIANTINIT			 pRuntime->pOleAut32->fpVariantInit

/* ---> allocators <--- */
#define API_ALLOC	  pRuntime->pAllocators->fpSalloc
#define API_CALLOC	  pRuntime->pAllocators->fpScalloc	
#define API_FREE 	  pRuntime->pAllocators->fpSfree
#define API_REALLOC   pRuntime->pAllocators->fpSrealloc

#endif