VOID WINAPI ExitProcess(
  _In_  UINT uExitCode
);

BOOL WINAPI TerminateProcess(
  _In_ HANDLE hProcess,
  _In_ UINT   uExitCode
);

DWORD WINAPI GetLastError();

/*
Flags is directly dereferenced if non-null on windows 10
Let's assert it's a PVOID for now on

*/
NTSTATUS WINAPI LdrLoadDll(
  __in_opt LPCWSTR               PathToFile,
  __in_opt PVOID                Flags,
  _In_ PUNICODE_STRING      ModuleFileName,
  _Out_ PHANDLE             ModuleHandle
);




BOOL WINAPI GetExitCodeThread(
    _In_  HANDLE hThread,
    _Out_ LPDWORD lpExitCode
);

BOOL WINAPI GetExitCodeProcess(
    __in  HANDLE hProcess,
    __out LPDWORD lpExitCode
);


BOOL WINAPI SetPriorityClass(
  _In_ HANDLE hProcess,
  _In_ DWORD  dwPriorityClass
);

DWORD WINAPI GetPriorityClass(
  _In_ HANDLE hProcess
);

LPVOID WINAPI VirtualAlloc(
  _In_opt_  LPVOID lpAddress,
  _In_      SIZE_T dwSize,
  _In_      DWORD flAllocationType,
  _In_      DWORD flProtect
);

LPVOID WINAPI VirtualAllocEx(
  _In_      HANDLE hProcess,
  _In_opt_  LPVOID lpAddress,
  _In_      SIZE_T dwSize,
  _In_      DWORD flAllocationType,
  _In_      DWORD flProtect
);




BOOL WINAPI VirtualFree(
  _In_ LPVOID lpAddress,
  _In_ SIZE_T dwSize,
  _In_ DWORD  dwFreeType
);

BOOL WINAPI VirtualFreeEx(
  _In_ HANDLE hProcess,
  _In_ LPVOID lpAddress,
  _In_ SIZE_T dwSize,
  _In_ DWORD  dwFreeType
);



BOOL WINAPI VirtualProtect(
  _In_   LPVOID lpAddress,
  _In_   SIZE_T dwSize,
  _In_   DWORD flNewProtect,
  _Out_  PDWORD lpflOldProtect
);

BOOL WINAPI VirtualProtectEx(
  _In_  HANDLE hProcess,
  _In_  LPVOID lpAddress,
  _In_  SIZE_T dwSize,
  _In_  DWORD  flNewProtect,
  _Out_ PDWORD lpflOldProtect
);


DWORD VirtualQuery(
  LPCVOID lpAddress,
  PMEMORY_BASIC_INFORMATION lpBuffer,
  DWORD dwLength
);

SIZE_T WINAPI VirtualQueryEx(
    _In_     HANDLE hProcess,
    _In_opt_ LPCVOID lpAddress,
    _Out_ PMEMORY_BASIC_INFORMATION lpBuffer,
    _In_     SIZE_T dwLength
    );

BOOL WINAPI QueryWorkingSet(
  _In_  HANDLE hProcess,
  _Out_ PVOID  pv,
  _In_  DWORD  cb
);

BOOL WINAPI QueryWorkingSetEx(
  _In_    HANDLE hProcess,
  _Inout_ PVOID  pv,
  _In_    DWORD  cb
);


DWORD WINAPI GetModuleFileNameA(
  _In_opt_  HMODULE hModule,
  _Out_     LPSTR lpFilename,
  _In_      DWORD nSize
);

DWORD WINAPI GetModuleFileNameW(
  _In_opt_  HMODULE hModule,
  _Out_     LPWSTR lpFilename,
  _In_      DWORD nSize
);

HANDLE WINAPI CreateThread(
  _In_opt_   LPSECURITY_ATTRIBUTES lpThreadAttributes,
  _In_       SIZE_T dwStackSize,
  _In_       LPTHREAD_START_ROUTINE lpStartAddress,
  _In_opt_   LPVOID lpParameter,
  _In_       DWORD dwCreationFlags,
  _Out_opt_  LPDWORD lpThreadId
);

HANDLE WINAPI CreateRemoteThread(
  _In_   HANDLE hProcess,
  _In_   LPSECURITY_ATTRIBUTES lpThreadAttributes,
  _In_   SIZE_T dwStackSize,
  _In_   LPTHREAD_START_ROUTINE lpStartAddress,
  _In_   LPVOID lpParameter,
  _In_   DWORD dwCreationFlags,
  _Out_  LPDWORD lpThreadId
);

BOOL WINAPI VirtualProtect(
  _In_   LPVOID lpAddress,
  _In_   SIZE_T dwSize,
  _In_   DWORD flNewProtect,
  _Out_  PDWORD lpflOldProtect
);

BOOL WINAPI CreateProcessA(
    __in_opt    LPCSTR lpApplicationName,
    __inout_opt LPSTR lpCommandLine,
    __in_opt    LPSECURITY_ATTRIBUTES lpProcessAttributes,
    __in_opt    LPSECURITY_ATTRIBUTES lpThreadAttributes,
    __in        BOOL bInheritHandles,
    __in        DWORD dwCreationFlags,
    __in_opt    LPVOID lpEnvironment,
    __in_opt    LPCSTR lpCurrentDirectory,
    __in        LPSTARTUPINFOA lpStartupInfo,
    __out       LPPROCESS_INFORMATION lpProcessInformation
);

BOOL WINAPI CreateProcessW(
    __in_opt    LPCWSTR lpApplicationName,
    __inout_opt LPWSTR lpCommandLine,
    __in_opt    LPSECURITY_ATTRIBUTES lpProcessAttributes,
    __in_opt    LPSECURITY_ATTRIBUTES lpThreadAttributes,
    __in        BOOL bInheritHandles,
    __in        DWORD dwCreationFlags,
    __in_opt    LPVOID lpEnvironment,
    __in_opt    LPCWSTR lpCurrentDirectory,
    __in        LPSTARTUPINFOW lpStartupInfo,
    __out       LPPROCESS_INFORMATION lpProcessInformation
);

BOOL WINAPI CreateProcessAsUserA(
  _In_opt_    HANDLE                hToken,
  _In_opt_    LPSTR               lpApplicationName,
  _Inout_opt_ LPSTR                lpCommandLine,
  _In_opt_    LPSECURITY_ATTRIBUTES lpProcessAttributes,
  _In_opt_    LPSECURITY_ATTRIBUTES lpThreadAttributes,
  _In_        BOOL                  bInheritHandles,
  _In_        DWORD                 dwCreationFlags,
  _In_opt_    LPVOID                lpEnvironment,
  _In_opt_    LPSTR               lpCurrentDirectory,
  _In_        LPSTARTUPINFOA         lpStartupInfo,
  _Out_       LPPROCESS_INFORMATION lpProcessInformation
);


BOOL WINAPI CreateProcessAsUserW(
  _In_opt_    HANDLE                hToken,
  _In_opt_    LPWSTR               lpApplicationName,
  _Inout_opt_ LPWSTR                lpCommandLine,
  _In_opt_    LPSECURITY_ATTRIBUTES lpProcessAttributes,
  _In_opt_    LPSECURITY_ATTRIBUTES lpThreadAttributes,
  _In_        BOOL                  bInheritHandles,
  _In_        DWORD                 dwCreationFlags,
  _In_opt_    LPVOID                lpEnvironment,
  _In_opt_    LPWSTR               lpCurrentDirectory,
  _In_        LPSTARTUPINFOW         lpStartupInfo,
  _Out_       LPPROCESS_INFORMATION lpProcessInformation
);

BOOL WINAPI GetThreadContext(
    __in    HANDLE hThread,
    __inout LPCONTEXT lpContext
);


BOOL WINAPI SetThreadContext(
    __in HANDLE hThread,
    __in CONST LPCONTEXT lpContext
);



HANDLE WINAPI OpenThread(
    __in DWORD dwDesiredAccess,
    __in BOOL bInheritHandle,
    __in DWORD dwThreadId
);

HANDLE WINAPI OpenProcess(
    __in DWORD dwDesiredAccess,
    __in BOOL bInheritHandle,
    __in DWORD dwProcessId
);

BOOL WINAPI CloseHandle(
    __in HANDLE hObject
);

BOOL WINAPI ReadProcessMemory(
  _In_   HANDLE     hProcess,
  _In_   LPCVOID    lpBaseAddress,
  _Out_  LPVOID     lpBuffer,
  _In_   SIZE_T     nSize,
  _Out_  SIZE_T     *lpNumberOfBytesRead
);

NTSTATUS WINAPI NtWow64ReadVirtualMemory64(
  _In_   HANDLE     hProcess,
  _In_   ULONG64    lpBaseAddress,
  _Out_  LPVOID     lpBuffer,
  _In_   ULONG64    nSize,
  _Out_  PULONG64   lpNumberOfBytesRead
);


BOOL WINAPI WriteProcessMemory(
  _In_   HANDLE     hProcess,
  _In_   LPVOID     lpBaseAddress,
  _In_   LPCVOID    lpBuffer,
  _In_   SIZE_T     nSize,
  _Out_  SIZE_T     *lpNumberOfBytesWritten
);


NTSTATUS WINAPI NtWow64WriteVirtualMemory64(
  _In_   HANDLE     hProcess,
  _In_   ULONG64    lpBaseAddress,
  _Out_  LPVOID     lpBuffer,
  _In_   ULONG64    nSize,
  _Out_  PULONG64   lpNumberOfBytesWritten
);



HANDLE WINAPI GetCurrentProcess();

HANDLE WINAPI CreateFileA(
    __in     LPCSTR lpFileName,
    __in     DWORD dwDesiredAccess,
    __in     DWORD dwShareMode,
    __in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes,
    __in     DWORD dwCreationDisposition,
    __in     DWORD dwFlagsAndAttributes,
    __in_opt HANDLE hTemplateFile
    );

HANDLE WINAPI CreateFileW(
    __in     LPCWSTR lpFileName,
    __in     DWORD dwDesiredAccess,
    __in     DWORD dwShareMode,
    __in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes,
    __in     DWORD dwCreationDisposition,
    __in     DWORD dwFlagsAndAttributes,
    __in_opt HANDLE hTemplateFile
    );





BOOL WINAPI OpenProcessToken(
  _In_   HANDLE ProcessHandle,
  _In_   DWORD DesiredAccess,
  _Out_  PHANDLE TokenHandle
);

BOOL WINAPI DuplicateToken(
  _In_  HANDLE                       ExistingTokenHandle,
  _In_  SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
  _Out_ PHANDLE                      DuplicateTokenHandle
);


BOOL WINAPI DuplicateTokenEx(
  _In_     HANDLE                       hExistingToken,
  _In_     DWORD                        dwDesiredAccess,
  _In_opt_ LPSECURITY_ATTRIBUTES        lpTokenAttributes,
  _In_     SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
  _In_     TOKEN_TYPE                   TokenType,
  _Out_    PHANDLE                      phNewToken
);


BOOL WINAPI OpenThreadToken(
  _In_  HANDLE  ThreadHandle,
  _In_  DWORD   DesiredAccess,
  _In_  BOOL    OpenAsSelf,
  _Out_ PHANDLE TokenHandle
);

BOOL WINAPI SetThreadToken(
  _In_opt_ PHANDLE Thread,
  _In_opt_ HANDLE  Token
);

BOOL WINAPI LookupPrivilegeValueA(
    __in_opt LPCSTR lpSystemName,
    __in     LPCSTR lpName,
    __out    PLUID   lpLuid
);

BOOL WINAPI LookupPrivilegeValueW(
    __in_opt LPCWSTR lpSystemName,
    __in     LPCWSTR lpName,
    __out    PLUID   lpLuid
);

BOOL WINAPI LookupPrivilegeNameA(
  _In_opt_  LPCSTR lpSystemName,
  _In_      PLUID   lpLuid,
  _Out_opt_ LPCSTR  lpName,
  _Inout_   LPDWORD cchName
);

BOOL WINAPI LookupPrivilegeNameW(
  _In_opt_  LPCWSTR lpSystemName,
  _In_      PLUID   lpLuid,
  _Out_opt_ LPCWSTR  lpName,
  _Inout_   LPDWORD cchName
);

BOOL WINAPI AdjustTokenPrivileges(
  _In_       HANDLE TokenHandle,
  _In_       BOOL DisableAllPrivileges,
  _In_opt_   PTOKEN_PRIVILEGES NewState,
  _In_       DWORD BufferLength,
  _Out_opt_  PTOKEN_PRIVILEGES PreviousState,
  _Out_opt_  PDWORD ReturnLength
);

HRSRC WINAPI FindResourceA(
    __in_opt HMODULE hModule,
    __in     LPCSTR lpName,
    __in     LPCSTR lpType
);

HRSRC WINAPI FindResourceW(
    __in_opt HMODULE hModule,
    __in     LPCWSTR lpName,
    __in     LPCWSTR lpType
);

DWORD WINAPI SizeofResource(
  _In_opt_  HMODULE hModule,
  _In_      HRSRC hResInfo
);

HGLOBAL WINAPI LoadResource(
  _In_opt_  HMODULE hModule,
  _In_      HRSRC hResInfo
);

LPVOID WINAPI LockResource(
  _In_  HGLOBAL hResData
);

BOOL FreeResource(
  HGLOBAL hResData
);

BOOL EnumResourceTypesA(
  HMODULE          hModule,
  ENUMRESTYPEPROCA lpEnumFunc,
  LONG_PTR         lParam
);


BOOL EnumResourceTypesW(
  HMODULE          hModule,
  ENUMRESTYPEPROCW lpEnumFunc,
  LONG_PTR         lParam
);

BOOL EnumResourceNamesA(
  HMODULE          hModule,
  LPCSTR           lpType,
  ENUMRESNAMEPROCA lpEnumFunc,
  LONG_PTR         lParam
);

BOOL EnumResourceNamesW(
  HMODULE          hModule,
  LPCWSTR          lpType,
  ENUMRESNAMEPROCW lpEnumFunc,
  LONG_PTR         lParam
);

BOOL WINAPI GetVersionExA(
    __inout LPOSVERSIONINFOA lpVersionInformation
);

BOOL WINAPI GetVersionExW(
    __inout LPOSVERSIONINFOW lpVersionInformation
);

DWORD GetVersion();

HANDLE GetCurrentThread();

DWORD GetCurrentThreadId();

DWORD GetCurrentProcessorNumber();

BOOL AllocConsole();

BOOL FreeConsole();

HANDLE WINAPI GetStdHandle(
  _In_  DWORD nStdHandle
);

BOOL WINAPI SetStdHandle(
  _In_  DWORD nStdHandle,
  _In_  HANDLE hHandle
);

DWORD WINAPI SetThreadAffinityMask(
  _In_  HANDLE hThread,
  _In_  DWORD dwThreadAffinityMask
);

BOOL WINAPI ReadFile(
  _In_        HANDLE       hFile,
  _Out_       LPVOID       lpBuffer,
  _In_        DWORD        nNumberOfBytesToRead,
  _Out_opt_   LPDWORD      lpNumberOfBytesRead,
  _Inout_opt_ LPOVERLAPPED lpOverlapped
);

BOOL WINAPI WriteFile(
  _In_         HANDLE hFile,
  _In_         LPCVOID lpBuffer,
  _In_         DWORD nNumberOfBytesToWrite,
  _Out_opt_    LPDWORD lpNumberOfBytesWritten,
  _Inout_opt_  LPOVERLAPPED lpOverlapped
);


PVOID WINAPI AddVectoredContinueHandler(
  _In_  ULONG FirstHandler,
  _In_  PVECTORED_EXCEPTION_HANDLER VectoredHandler
);


PVOID WINAPI AddVectoredExceptionHandler(
  _In_  ULONG FirstHandler,
  _In_  PVECTORED_EXCEPTION_HANDLER VectoredHandler
);

BOOL WINAPI TerminateThread(
  _Inout_  HANDLE hThread,
  _In_     DWORD dwExitCode
);

VOID WINAPI ExitThread(
  _In_  DWORD dwExitCode
);

ULONG WINAPI RemoveVectoredExceptionHandler(
  _In_  PVOID Handler
);

DWORD WINAPI ResumeThread(
  _In_  HANDLE hThread
);

DWORD WINAPI SuspendThread(
  _In_  HANDLE hThread
);



DWORD WINAPI WaitForSingleObject(
  _In_  HANDLE hHandle,
  _In_  DWORD dwMilliseconds
);

DWORD WINAPI GetThreadId(
 _In_ HANDLE Thread
 );



BOOL WINAPI DeviceIoControl(
  _In_        HANDLE       hDevice,
  _In_        DWORD        dwIoControlCode,
  _In_opt_    LPVOID       lpInBuffer,
  _In_        DWORD        nInBufferSize,
  _Out_opt_   LPVOID       lpOutBuffer,
  _In_        DWORD        nOutBufferSize,
  _Out_opt_   LPDWORD      lpBytesReturned,
  _Inout_opt_ LPOVERLAPPED lpOverlapped
);

BOOL WINAPI GetTokenInformation(
  _In_      HANDLE                  TokenHandle,
  _In_      TOKEN_INFORMATION_CLASS TokenInformationClass,
  _Out_opt_ LPVOID                  TokenInformation,
  _In_      DWORD                   TokenInformationLength,
  _Out_     PDWORD                  ReturnLength
);


BOOL WINAPI Wow64DisableWow64FsRedirection(
  _Out_ PVOID *OldValue
);

BOOL WINAPI Wow64RevertWow64FsRedirection(
  _In_ PVOID OldValue
);

BOOLEAN WINAPI Wow64EnableWow64FsRedirection(
  _In_ BOOLEAN Wow64FsEnableRedirection
);

BOOL WINAPI Wow64GetThreadContext(
    _In_    HANDLE hThread,
    _Inout_ PWOW64_CONTEXT lpContext
);

BOOL WINAPI SetConsoleCtrlHandler(
  _In_opt_ PHANDLER_ROUTINE HandlerRoutine,
  _In_     BOOL             Add
);

LONG WINAPI WinVerifyTrust(
    _In_opt_ HWND hwnd,
    _In_ GUID *pgActionID,
    _Inout_ LPVOID pWVTData
);

HGLOBAL WINAPI GlobalAlloc(
  _In_ UINT   uFlags,
  _In_ SIZE_T dwBytes
);

HGLOBAL WINAPI GlobalFree(
  _In_ HGLOBAL hMem
);

BOOL WINAPI GlobalUnlock(
  _In_ HGLOBAL hMem
);

LPVOID WINAPI GlobalLock(
  _In_ HGLOBAL hMem
);

BOOL WINAPI OpenClipboard(
  _In_opt_ HWND hWndNewOwner
);

BOOL WINAPI EmptyClipboard();

BOOL WINAPI CloseClipboard();

HANDLE WINAPI SetClipboardData(
  _In_     UINT   uFormat,
  _In_opt_ HANDLE hMem
);

HANDLE WINAPI GetClipboardData(
  _In_ UINT uFormat
);

UINT WINAPI EnumClipboardFormats(
  _In_ UINT format
);

INT WINAPI GetClipboardFormatNameA(
  _In_  UINT   format,
  _Out_ LPCSTR lpszFormatName,
  _In_  INT    cchMaxCount
);

INT WINAPI GetClipboardFormatNameW(
  _In_  UINT   format,
  _Out_ LPCWSTR lpszFormatName,
  _In_  INT    cchMaxCount
);

LONG WINAPI WinVerifyTrust(
  _In_ HWND   hWnd,
  _In_ GUID   *pgActionID,
  _In_ LPVOID pWVTData
);

BOOL WINAPI OpenProcessToken (
    __in        HANDLE ProcessHandle,
    __in        DWORD DesiredAccess,
    __deref_out PHANDLE TokenHandle
);

BOOL WINAPI OpenThreadToken (
    __in        HANDLE ThreadHandle,
    __in        DWORD DesiredAccess,
    __in        BOOL OpenAsSelf,
    __deref_out PHANDLE TokenHandle
);


BOOL WINAPI GetTokenInformation (
    __in      HANDLE TokenHandle,
    __in      TOKEN_INFORMATION_CLASS TokenInformationClass,
    __out     LPVOID TokenInformation,
    __in      DWORD TokenInformationLength,
    __out     PDWORD ReturnLength
);

BOOL WINAPI SetTokenInformation (
    __in HANDLE TokenHandle,
    __in TOKEN_INFORMATION_CLASS TokenInformationClass,
    __in LPVOID TokenInformation,
    __in DWORD TokenInformationLength
);




BOOL WINAPI CreateWellKnownSid(
  _In_      WELL_KNOWN_SID_TYPE WellKnownSidType,
  _In_opt_  PSID                DomainSid,
  _Out_opt_ PSID                pSid,
  _Inout_   DWORD               *cbSid
);


VOID DebugBreak();

BOOL WINAPI WaitForDebugEvent(
    __in LPDEBUG_EVENT lpDebugEvent,
    __in DWORD dwMilliseconds
    );

BOOL WINAPI ContinueDebugEvent(
    __in DWORD dwProcessId,
    __in DWORD dwThreadId,
    __in DWORD dwContinueStatus
    );

BOOL WINAPI DebugActiveProcess(
    __in DWORD dwProcessId
    );

BOOL WINAPI DebugActiveProcessStop(
    __in DWORD dwProcessId
    );

BOOL WINAPI DebugSetProcessKillOnExit(
    __in BOOL KillOnExit
    );

BOOL WINAPI DebugBreakProcess (
    __in HANDLE Process
    );

DWORD WINAPI GetProcessId(
  _In_ HANDLE Process
);

BOOL WINAPI Wow64SetThreadContext(
    __in HANDLE hThread,
    __in CONST WOW64_CONTEXT *lpContext
);

DWORD WINAPI GetMappedFileNameW (
    __in HANDLE hProcess,
    __in LPVOID lpv,
    __out PVOID lpFilename,
    __in DWORD nSize
);

DWORD WINAPI GetMappedFileNameA (
    __in HANDLE hProcess,
    __in LPVOID lpv,
    __out PVOID lpFilename,
    __in DWORD nSize
);

VOID RtlInitString (
    PSTRING DestinationString,
    LPCSTR SourceString
);


VOID RtlInitUnicodeString (
    PUNICODE_STRING DestinationString,
    LPCWSTR SourceString
);

NTSTATUS RtlAnsiStringToUnicodeString (
    PUNICODE_STRING DestinationString,
    PCANSI_STRING SourceString,
    BOOLEAN AllocateDestinationString
);

NTSTATUS RtlDecompressBuffer(
    USHORT CompressionFormat,
    PUCHAR UncompressedBuffer,
    ULONG  UncompressedBufferSize,
    PUCHAR CompressedBuffer,
    ULONG  CompressedBufferSize,
    PULONG FinalUncompressedSize
);

NTSTATUS RtlCompressBuffer(
  USHORT CompressionFormatAndEngine,
  PUCHAR UncompressedBuffer,
  ULONG  UncompressedBufferSize,
  PUCHAR CompressedBuffer,
  ULONG  CompressedBufferSize,
  ULONG  UncompressedChunkSize,
  PULONG FinalCompressedSize,
  PVOID  WorkSpace
);

NTSTATUS RtlDecompressBufferEx(
   USHORT CompressionFormat,
   PUCHAR UncompressedBuffer,
   ULONG  UncompressedBufferSize,
   PUCHAR CompressedBuffer,
   ULONG  CompressedBufferSize,
   PULONG FinalUncompressedSize,
   PVOID  WorkSpace
);

NTSTATUS RtlGetCompressionWorkSpaceSize(
   USHORT CompressionFormatAndEngine,
   PULONG CompressBufferWorkSpaceSize,
   PULONG CompressFragmentWorkSpaceSize
);


INT WINAPI lstrcmpA(
    __in LPCSTR lpString1,
    __in LPCSTR lpString2
);

INT WINAPI lstrcmpW(
    __in LPCWSTR lpString1,
    __in LPCWSTR lpString2
);


HANDLE WINAPI CreateFileMappingA(
    __in     HANDLE hFile,
    __in_opt LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
    __in     DWORD flProtect,
    __in     DWORD dwMaximumSizeHigh,
    __in     DWORD dwMaximumSizeLow,
    __in_opt LPCSTR lpName
);

HANDLE WINAPI  CreateFileMappingW(
    __in     HANDLE hFile,
    __in_opt LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
    __in     DWORD flProtect,
    __in     DWORD dwMaximumSizeHigh,
    __in     DWORD dwMaximumSizeLow,
    __in_opt LPCWSTR lpName
);


LPVOID WINAPI MapViewOfFile(
    __in HANDLE hFileMappingObject,
    __in DWORD dwDesiredAccess,
    __in DWORD dwFileOffsetHigh,
    __in DWORD dwFileOffsetLow,
    __in SIZE_T dwNumberOfBytesToMap
);


DWORD WINAPI GetLogicalDriveStringsA(
  _In_  DWORD  nBufferLength,
  _Out_ LPCSTR lpBuffer
);


DWORD WINAPI GetLogicalDriveStringsW(
  _In_  DWORD  nBufferLength,
  _Out_ LPWSTR lpBuffer
);



BOOL WINAPI GetVolumeInformationA(
  _In_opt_  LPCSTR lpRootPathName,
  _Out_opt_ LPSTR  lpVolumeNameBuffer,
  _In_      DWORD   nVolumeNameSize,
  _Out_opt_ LPDWORD lpVolumeSerialNumber,
  _Out_opt_ LPDWORD lpMaximumComponentLength,
  _Out_opt_ LPDWORD lpFileSystemFlags,
  _Out_opt_ LPSTR  lpFileSystemNameBuffer,
  _In_      DWORD   nFileSystemNameSize
);


BOOL WINAPI GetVolumeInformationW(
  _In_opt_  LPWSTR lpRootPathName,
  _Out_opt_ LPWSTR  lpVolumeNameBuffer,
  _In_      DWORD   nVolumeNameSize,
  _Out_opt_ LPDWORD lpVolumeSerialNumber,
  _Out_opt_ LPDWORD lpMaximumComponentLength,
  _Out_opt_ LPDWORD lpFileSystemFlags,
  _Out_opt_ LPWSTR  lpFileSystemNameBuffer,
  _In_      DWORD   nFileSystemNameSize
);


BOOL WINAPI GetVolumeNameForVolumeMountPointA(
  _In_  LPCSTR lpszVolumeMountPoint,
  _Out_ LPCSTR  lpszVolumeName,
  _In_  DWORD   cchBufferLength
);


BOOL WINAPI GetVolumeNameForVolumeMountPointW(
  _In_  LPWSTR lpszVolumeMountPoint,
  _Out_ LPWSTR  lpszVolumeName,
  _In_  DWORD   cchBufferLength
);

UINT WINAPI GetDriveTypeA(
  _In_opt_ LPCSTR lpRootPathName
);

UINT WINAPI GetDriveTypeW(
  _In_opt_ LPWSTR lpRootPathName
);

DWORD WINAPI QueryDosDeviceA(
  _In_opt_ LPCSTR lpDeviceName,
  _Out_    LPCSTR  lpTargetPath,
  _In_     DWORD   ucchMax
);

DWORD WINAPI QueryDosDeviceW(
  _In_opt_ LPWSTR lpDeviceName,
  _Out_    LPWSTR  lpTargetPath,
  _In_     DWORD   ucchMax
);


HANDLE WINAPI FindFirstVolumeA(
  _Out_ LPCSTR lpszVolumeName,
  _In_  DWORD  cchBufferLength
);

HANDLE WINAPI FindFirstVolumeW(
  _Out_ LPWSTR lpszVolumeName,
  _In_  DWORD  cchBufferLength
);

BOOL WINAPI FindNextVolumeA(
  _In_  HANDLE hFindVolume,
  _Out_ LPCSTR lpszVolumeName,
  _In_  DWORD  cchBufferLength
);

BOOL WINAPI FindNextVolumeW(
  _In_  HANDLE hFindVolume,
  _Out_ LPWSTR lpszVolumeName,
  _In_  DWORD  cchBufferLength
);



BOOL WINAPI DuplicateHandle(
  _In_  HANDLE   hSourceProcessHandle,
  _In_  HANDLE   hSourceHandle,
  _In_  HANDLE   hTargetProcessHandle,
  _Out_ LPHANDLE lpTargetHandle,
  _In_  DWORD    dwDesiredAccess,
  _In_  BOOL     bInheritHandle,
  _In_  DWORD    dwOptions
);

NTSTATUS WINAPI ZwDuplicateObject(
  _In_      HANDLE      SourceProcessHandle,
  _In_      HANDLE      SourceHandle,
  _In_opt_  HANDLE      TargetProcessHandle,
  _Out_opt_ PHANDLE     TargetHandle,
  _In_      ACCESS_MASK DesiredAccess,
  _In_      ULONG       HandleAttributes,
  _In_      ULONG       Options
);


DWORD WINAPI GetModuleBaseNameA(
  _In_     HANDLE  hProcess,
  _In_opt_ HMODULE hModule,
  _Out_    LPCSTR  lpBaseName,
  _In_     DWORD   nSize
);

DWORD WINAPI GetModuleBaseNameW(
  _In_     HANDLE  hProcess,
  _In_opt_ HMODULE hModule,
  _Out_    LPWSTR  lpBaseName,
  _In_     DWORD   nSize
);

DWORD WINAPI GetProcessImageFileNameA(
  _In_  HANDLE hProcess,
  _Out_ LPCSTR lpImageFileName,
  _In_  DWORD  nSize
);

DWORD WINAPI GetProcessImageFileNameW(
  _In_  HANDLE hProcess,
  _Out_ LPWSTR lpImageFileName,
  _In_  DWORD  nSize
);

INT WINAPI GetSystemMetrics(
  _In_ INT nIndex
);

BOOL WINAPI GetComputerNameA(
  _Out_   LPCSTR  lpBuffer,
  _Inout_ LPDWORD lpnSize
);

BOOL WINAPI GetComputerNameW(
  _Out_   LPWSTR  lpBuffer,
  _Inout_ LPDWORD lpnSize
);

BOOL WINAPI LookupAccountSidA(
  _In_opt_  LPCSTR        lpSystemName,
  _In_      PSID          lpSid,
  _Out_opt_ LPCSTR        lpName,
  _Inout_   LPDWORD       cchName,
  _Out_opt_ LPCSTR        lpReferencedDomainName,
  _Inout_   LPDWORD       cchReferencedDomainName,
  _Out_     PSID_NAME_USE peUse
);

BOOL WINAPI LookupAccountSidW(
  _In_opt_  LPWSTR       lpSystemName,
  _In_      PSID          lpSid,
  _Out_opt_ LPWSTR        lpName,
  _Inout_   LPDWORD       cchName,
  _Out_opt_ LPWSTR        lpReferencedDomainName,
  _Inout_   LPDWORD       cchReferencedDomainName,
  _Out_     PSID_NAME_USE peUse
);

BOOL LookupAccountNameA(
  LPCSTR        lpSystemName,
  LPCSTR        lpAccountName,
  PSID          Sid,
  LPDWORD       cbSid,
  LPSTR         ReferencedDomainName,
  LPDWORD       cchReferencedDomainName,
  PSID_NAME_USE peUse
);

BOOL LookupAccountNameW(
  LPCWSTR       lpSystemName,
  LPCWSTR       lpAccountName,
  PSID          Sid,
  LPDWORD       cbSid,
  LPWSTR        ReferencedDomainName,
  LPDWORD       cchReferencedDomainName,
  PSID_NAME_USE peUse
);

DWORD WINAPI GetInterfaceInfo(
  _Out_   PIP_INTERFACE_INFO pIfTable,
  _Inout_ PULONG             dwOutBufLen
);

DWORD WINAPI GetIfTable(
  _Out_   PMIB_IFTABLE pIfTable,
  _Inout_ PULONG       pdwSize,
  _In_    BOOL         bOrder
);

DWORD WINAPI GetIpAddrTable(
  _Out_   PMIB_IPADDRTABLE pIpAddrTable,
  _Inout_ PULONG           pdwSize,
  _In_    BOOL             bOrder
);

BOOL WINAPI GetProcessTimes(
  _In_  HANDLE     hProcess,
  _Out_ LPFILETIME lpCreationTime,
  _Out_ LPFILETIME lpExitTime,
  _Out_ LPFILETIME lpKernelTime,
  _Out_ LPFILETIME lpUserTime
);

DWORD WINAPI GetShortPathNameA(
  _In_  LPCSTR lpszLongPath,
  _Out_ LPCSTR  lpszShortPath,
  _In_  DWORD   cchBuffer
);

DWORD WINAPI GetShortPathNameW(
  _In_  LPWSTR lpszLongPath,
  _Out_ LPWSTR  lpszShortPath,
  _In_  DWORD   cchBuffer
);

DWORD WINAPI GetLongPathNameA(
  _In_  LPCSTR lpszShortPath,
  _Out_ LPCSTR  lpszLongPath,
  _In_  DWORD   cchBuffer
);

DWORD WINAPI GetLongPathNameW(
  _In_  LPWSTR lpszShortPath,
  _Out_ LPWSTR  lpszLongPath,
  _In_  DWORD   cchBuffer
);


BOOL WINAPI GetProcessDEPPolicy(
  _In_  HANDLE  hProcess,
  _Out_ LPDWORD lpFlags,
  _Out_ PBOOL   lpPermanent
);



BOOL WINAPI ConvertStringSidToSidA(
  _In_  LPCSTR StringSid,
  _Out_ PSID    *Sid
);


BOOL WINAPI ConvertStringSidToSidW(
  _In_  LPWSTR StringSid,
  _Out_ PSID    *Sid
);


BOOL WINAPI ConvertSidToStringSidA(
  _In_  PSID   Sid,
  _Out_ LPCSTR *StringSid
);

BOOL WINAPI ConvertSidToStringSidW(
  _In_  PSID   Sid,
  _Out_ LPWSTR *StringSid
);

HLOCAL WINAPI LocalFree(
  _In_ HLOCAL hMem
);

BOOL WINAPI InitializeProcThreadAttributeList(
  _Out_opt_  LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList,
  _In_       DWORD                        dwAttributeCount,
  _Reserved_ DWORD                        dwFlags,
  _Inout_    PSIZE_T                      lpSize
);


BOOL WINAPI UpdateProcThreadAttribute(
  _Inout_   LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList,
  _In_      DWORD                        dwFlags,
  _In_      DWORD_PTR                    Attribute,
  _In_      PVOID                        lpValue,
  _In_      SIZE_T                       cbSize,
  _Out_opt_ PVOID                        lpPreviousValue,
  _In_opt_  PSIZE_T                      lpReturnSize
);

VOID WINAPI DeleteProcThreadAttributeList(
  _Inout_ LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList
);


INT WINAPI MessageBoxA(
  _In_opt_ HWND    hWnd,
  _In_opt_ LPCSTR lpText,
  _In_opt_ LPCSTR lpCaption,
  _In_     UINT    uType
);


INT WINAPI MessageBoxW(
  _In_opt_ HWND    hWnd,
  _In_opt_ LPWSTR lpText,
  _In_opt_ LPWSTR lpCaption,
  _In_     UINT    uType
);

UINT WINAPI GetWindowsDirectoryA(
  _Out_ LPCSTR lpBuffer,
  _In_  UINT   uSize
);

UINT WINAPI GetWindowsDirectoryW(
  _Out_ LPWSTR lpBuffer,
  _In_  UINT   uSize
);

VOID WINAPI RtlGetUnloadEventTraceEx(
  _Out_ PULONG *ElementSize,
  _Out_ PULONG *ElementCount,
  _Out_ PVOID  *EventTrace
);


BOOLEAN WINAPI RtlDosPathNameToNtPathName_U(
    _In_ PCWSTR DosName,
    _Out_ PUNICODE_STRING NtName,
    _Out_ PCWSTR *PartName,
    _Out_ PRTL_RELATIVE_NAME_U RelativeName
);

// NOT EXPORTED !!
NTSTATUS WINAPI ApiSetResolveToHost (
    _In_ PVOID Schema,
    _In_ PUNICODE_STRING FileNameIn,
    _In_opt_ PUNICODE_STRING ParentName,
    _Out_ PBOOLEAN Resolved,
    _Out_ PUNICODE_STRING HostBinary
    );


VOID WINAPI Sleep(
  _In_ DWORD dwMilliseconds
);

DWORD WINAPI SleepEx(
  _In_ DWORD dwMilliseconds,
  _In_ BOOL  bAlertable
);

BOOL WINAPI GetProcessMitigationPolicy(
  _In_  HANDLE                    hProcess,
  _In_  PROCESS_MITIGATION_POLICY MitigationPolicy,
  _Out_ PVOID                     lpBuffer,
  _In_  SIZE_T                    dwLength
);


BOOL WINAPI SetProcessMitigationPolicy(
  _In_ PROCESS_MITIGATION_POLICY MitigationPolicy,
  _In_ PVOID                     lpBuffer,
  _In_ SIZE_T                    dwLength
);


BOOL WINAPI GetProductInfo(
  _In_  DWORD  dwOSMajorVersion,
  _In_  DWORD  dwOSMinorVersion,
  _In_  DWORD  dwSpMajorVersion,
  _In_  DWORD  dwSpMinorVersion,
  _Out_ PDWORD pdwReturnedProductType
);





BOOL GetProcessMemoryInfo(
  HANDLE                   Process,
  PPROCESS_MEMORY_COUNTERS ppsmemCounters,
  DWORD                    cb
);


HMODULE WINAPI GetModuleHandleA(
  _In_opt_ LPCSTR lpModuleName
);

HMODULE WINAPI GetModuleHandleW(
  _In_opt_ LPWSTR lpModuleName
);


BOOLEAN RtlEqualUnicodeString(
  PUNICODE_STRING String1,
  PUNICODE_STRING String2,
  BOOLEAN          CaseInSensitive
);


DWORD WINAPI GetFirmwareEnvironmentVariableA(
  _In_ LPCSTR lpName,
  _In_ LPCSTR lpGuid,
  _Out_ PVOID pBuffer,
  _In_ DWORD    nSize
);

DWORD WINAPI GetFirmwareEnvironmentVariableW(
  _In_ LPCWSTR lpName,
  _In_ LPCWSTR lpGuid,
  _Out_ PVOID pBuffer,
  _In_ DWORD    nSize
);

DWORD WINAPI GetFirmwareEnvironmentVariableExA(
  _In_ LPCSTR lpName,
  _In_ LPCSTR lpGuid,
  _Out_ PVOID pBuffer,
  _In_ DWORD    nSize,
  _Out_ PDWORD pdwAttribubutes
);

DWORD WINAPI GetFirmwareEnvironmentVariableExW(
  _In_ LPCWSTR lpName,
  _In_ LPCWSTR lpGuid,
  _Out_ PVOID pBuffer,
  _In_ DWORD    nSize,
  _Out_ PDWORD pdwAttribubutes
);

BOOL IsDebuggerPresent();


