#pragma once
#include <Windows.h>

/* C */
typedef BOOL(WINAPI *CONVERTSIDTOSTRINGSIDA)(_In_  PSID   Sid, _Out_ LPSTR *StringSid);


/* G */
typedef BOOL(WINAPI *GETTOKENINFORMATION)(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_opt_ LPVOID TokenInformation, _In_ DWORD TokenInformationLength, _Out_ PDWORD ReturnLength);

/* O */
typedef BOOL(WINAPI *OPENPROCESSTOKEN)(_In_  HANDLE  ProcessHandle, _In_  DWORD   DesiredAccess, _Out_ PHANDLE TokenHandle);


/* R */
typedef LONG(WINAPI *REGCLOSEKEY)(_In_ HKEY hKey);
typedef LONG(WINAPI *REGCREATEKEYEXA)(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _Reserved_ DWORD Reserved, _In_opt_   LPCSTR  lpClass, _In_ DWORD dwOptions, _In_ REGSAM  samDesired, _In_opt_   LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_  LPDWORD lpdwDisposition);
typedef LONG(WINAPI *REGDELETEKEYA)(_In_ HKEY    hKey, _In_ LPCSTR lpSubKey);
typedef LONG(WINAPI *REGDISABLEREFLECTIONKEY)(_In_ HKEY hBase);
typedef LONG(WINAPI *REGENABLEREFLECTIONKEY)(_In_ HKEY hBase);
typedef LONG(WINAPI *REGOPENCURRENTUSER)(_In_  REGSAM samDesired, _Out_ PHKEY  phkResult);
typedef LONG(WINAPI *REGOPENKEYEXA)(_In_ HKEY    hKey, _In_opt_ LPCSTR lpSubKey, _In_ DWORD   ulOptions, _In_ REGSAM  samDesired, _Out_    PHKEY   phkResult);
typedef LONG(WINAPI *REGQUERYREFLECTIONKEY)(_In_  HKEY hBase, _Out_ BOOL *bIsReflectionDisabled);
typedef LONG(WINAPI *REGSETVALUEEXA)(_In_    HKEY hKey, _In_opt_   LPCSTR lpValueName, _Reserved_    DWORD   Reserved, _In_    DWORD   dwType, _In_    const BYTE *lpData, _In_    DWORD   cbData);



typedef struct _VTABLE_ADVAPI32
{
	/* C */
	CONVERTSIDTOSTRINGSIDA fpConvertSidToStringSidA;
	
	/* G */
	GETTOKENINFORMATION fpGetTokenInformation;
	
	/* O */
	OPENPROCESSTOKEN fpOpenProcessToken;

	/* R */
	REGCLOSEKEY fpRegCloseKey;
	REGCREATEKEYEXA fpRegCreateKeyExA;
	REGDELETEKEYA fpRegDeleteKeyA;
	REGDISABLEREFLECTIONKEY fpRegDisableReflectionKey;
	REGENABLEREFLECTIONKEY fpRegEnableReflectionKey;
	REGOPENCURRENTUSER fpRegOpenCurrentUser;
	REGOPENKEYEXA fpRegOpenKeyExA;
	REGQUERYREFLECTIONKEY fpRegQueryReflectionKey;
	REGSETVALUEEXA fpRegSetValueExA;

} VTABLE_ADVAPI32, *PVTABLE_ADVAPI32;
