From 59293985801eb98bf74601ee04b6cd8da8541841 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 31 May 2024 23:39:36 -0500 Subject: [PATCH 1/6] refactor: reduce `W32` compilation units --- CommonLibF4/include/REX/W32/BASE.h | 12 +- CommonLibF4/include/REX/W32/KERNEL32.h | 36 +- CommonLibF4/src/REX/W32.cpp | 925 ++++++++++++++++++++++++ CommonLibF4/src/REX/W32/ADVAPI32.cpp | 17 - CommonLibF4/src/REX/W32/BCRYPT.cpp | 47 -- CommonLibF4/src/REX/W32/D3D11.cpp | 17 - CommonLibF4/src/REX/W32/D3DCOMPILER.cpp | 155 ---- CommonLibF4/src/REX/W32/DBGHELP.cpp | 17 - CommonLibF4/src/REX/W32/DXGI.cpp | 17 - CommonLibF4/src/REX/W32/KERNEL32.cpp | 479 ------------ CommonLibF4/src/REX/W32/OLE32.cpp | 11 - CommonLibF4/src/REX/W32/SHELL32.cpp | 11 - CommonLibF4/src/REX/W32/USER32.cpp | 59 -- CommonLibF4/src/REX/W32/VERSION.cpp | 53 -- 14 files changed, 970 insertions(+), 886 deletions(-) create mode 100644 CommonLibF4/src/REX/W32.cpp delete mode 100644 CommonLibF4/src/REX/W32/ADVAPI32.cpp delete mode 100644 CommonLibF4/src/REX/W32/BCRYPT.cpp delete mode 100644 CommonLibF4/src/REX/W32/D3D11.cpp delete mode 100644 CommonLibF4/src/REX/W32/D3DCOMPILER.cpp delete mode 100644 CommonLibF4/src/REX/W32/DBGHELP.cpp delete mode 100644 CommonLibF4/src/REX/W32/DXGI.cpp delete mode 100644 CommonLibF4/src/REX/W32/KERNEL32.cpp delete mode 100644 CommonLibF4/src/REX/W32/OLE32.cpp delete mode 100644 CommonLibF4/src/REX/W32/SHELL32.cpp delete mode 100644 CommonLibF4/src/REX/W32/USER32.cpp delete mode 100644 CommonLibF4/src/REX/W32/VERSION.cpp diff --git a/CommonLibF4/include/REX/W32/BASE.h b/CommonLibF4/include/REX/W32/BASE.h index c6334f0b..0d72821e 100644 --- a/CommonLibF4/include/REX/W32/BASE.h +++ b/CommonLibF4/include/REX/W32/BASE.h @@ -63,7 +63,7 @@ namespace REX::W32 { constexpr GUID() noexcept = default; - constexpr GUID(const std::uint32_t a_data1, std::uint16_t const a_data2, const std::uint16_t a_data3, const std::array& a_data4) noexcept : + constexpr GUID(const std::uint32_t a_data1, const std::uint16_t a_data2, const std::uint16_t a_data3, const std::array& a_data4) noexcept : data1(a_data1), data2(a_data2), data3(a_data3), data4{ a_data4[0], a_data4[1], a_data4[2], a_data4[3], a_data4[4], a_data4[5], a_data4[6], a_data4[7] } {} @@ -153,6 +153,16 @@ namespace REX::W32 }; static_assert(sizeof(SECURITY_ATTRIBUTES) == 0x18); + union LARGE_INTEGER + { + struct + { + std::uint32_t lo; + std::int32_t hi; + }; + std::int64_t value; + }; + union ULARGE_INTEGER { struct diff --git a/CommonLibF4/include/REX/W32/KERNEL32.h b/CommonLibF4/include/REX/W32/KERNEL32.h index b00d2e52..ce6cb50f 100644 --- a/CommonLibF4/include/REX/W32/KERNEL32.h +++ b/CommonLibF4/include/REX/W32/KERNEL32.h @@ -46,6 +46,35 @@ namespace REX::W32 inline constexpr auto FILE_ATTRIBUTE_SYSTEM{ 0x00000004u }; inline constexpr auto FILE_ATTRIBUTE_DIRECTORY{ 0x00000010u }; inline constexpr auto FILE_ATTRIBUTE_ARCHIVE{ 0x00000020u }; + inline constexpr auto FILE_ATTRIBUTE_DEVICE{ 0x00000040 }; + inline constexpr auto FILE_ATTRIBUTE_NORMAL{ 0x00000080 }; + inline constexpr auto FILE_ATTRIBUTE_TEMPORARY{ 0x00000100 }; + inline constexpr auto FILE_ATTRIBUTE_SPARSE_FILE{ 0x00000200 }; + inline constexpr auto FILE_ATTRIBUTE_REPARSE_POINT{ 0x00000400 }; + inline constexpr auto FILE_ATTRIBUTE_COMPRESSED{ 0x00000800 }; + inline constexpr auto FILE_ATTRIBUTE_OFFLINE{ 0x00001000 }; + inline constexpr auto FILE_ATTRIBUTE_NOT_CONTENT_INDEXED{ 0x00002000 }; + inline constexpr auto FILE_ATTRIBUTE_ENCRYPTED{ 0x00004000 }; + inline constexpr auto FILE_ATTRIBUTE_INTEGRITY_STREAM{ 0x00008000 }; + inline constexpr auto FILE_ATTRIBUTE_VIRTUAL{ 0x00010000 }; + inline constexpr auto FILE_ATTRIBUTE_NO_SCRUB_DATA{ 0x00020000 }; + inline constexpr auto FILE_ATTRIBUTE_EA{ 0x00040000 }; + inline constexpr auto FILE_ATTRIBUTE_PINNED{ 0x00080000 }; + inline constexpr auto FILE_ATTRIBUTE_UNPINNED{ 0x00100000 }; + inline constexpr auto FILE_ATTRIBUTE_RECALL_ON_OPEN{ 0x00040000 }; + inline constexpr auto FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS{ 0x00400000 }; + + // file creation diposition + inline constexpr auto CREATE_NEW{ 1 }; + inline constexpr auto CREATE_ALWAYS{ 2 }; + inline constexpr auto OPEN_EXISTING{ 3 }; + inline constexpr auto OPEN_ALWAYS{ 4 }; + inline constexpr auto TRUNCATE_EXISTING{ 5 }; + + // file share mode + inline constexpr auto FILE_SHARE_READ{ 0x00000001 }; + inline constexpr auto FILE_SHARE_WRITE{ 0x00000002 }; + inline constexpr auto FILE_SHARE_DELETE{ 0x00000004 }; // file mapping flags inline constexpr auto FILE_MAP_ALL_ACCESS{ SECTION_ALL_ACCESS }; @@ -426,6 +455,8 @@ namespace REX::W32 namespace REX::W32 { bool CloseHandle(HANDLE a_handle) noexcept; + HANDLE CreateFileA(const char* a_fileName, std::uint32_t a_desiredAccess, std::uint32_t a_shareMode, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_creationDisposition, std::uint32_t a_flags, HANDLE a_templateFile); + HANDLE CreateFileW(const wchar_t* a_fileName, std::uint32_t a_desiredAccess, std::uint32_t a_shareMode, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_creationDisposition, std::uint32_t a_flags, HANDLE a_templateFile); HANDLE CreateFileMappingA(HANDLE a_file, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_protect, std::uint32_t a_maxSizeHigh, std::uint32_t a_maxSizeLow, const char* a_name) noexcept; HANDLE CreateFileMappingW(HANDLE a_file, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_protect, std::uint32_t a_maxSizeHigh, std::uint32_t a_maxSizeLow, const wchar_t* a_name) noexcept; bool CreateProcessA(const char* a_name, char* a_cmd, SECURITY_ATTRIBUTES* a_procAttr, SECURITY_ATTRIBUTES* a_threadAttr, bool a_inheritHandles, std::uint32_t a_flags, void* a_env, const char* a_curDir, STARTUPINFOA* a_startInfo, PROCESS_INFORMATION* a_procInfo) noexcept; @@ -435,8 +466,8 @@ namespace REX::W32 HANDLE CreateThread(SECURITY_ATTRIBUTES* a_threadAttr, std::size_t a_stackSize, THREAD_START_ROUTINE* a_startAddr, void* a_param, std::uint32_t a_flags, std::uint32_t* a_threadID) noexcept; void DeleteCriticalSection(CRITICAL_SECTION* a_criticalSection); void EnterCriticalSection(CRITICAL_SECTION* a_criticalSection); - std::uint32_t ExpandEnvironmentStrings(const char* a_src, char* a_dst, std::uint32_t a_dstLen) noexcept; - std::uint32_t ExpandEnvironmentStrings(const wchar_t* a_src, wchar_t* a_dst, std::uint32_t a_dstLen) noexcept; + std::uint32_t ExpandEnvironmentStringsA(const char* a_src, char* a_dst, std::uint32_t a_dstLen) noexcept; + std::uint32_t ExpandEnvironmentStringsW(const wchar_t* a_src, wchar_t* a_dst, std::uint32_t a_dstLen) noexcept; bool FindClose(HANDLE a_file) noexcept; HANDLE FindFirstFileA(const char* a_name, WIN32_FIND_DATAA* a_data) noexcept; HANDLE FindFirstFileW(const wchar_t* a_name, WIN32_FIND_DATAW* a_data) noexcept; @@ -451,6 +482,7 @@ namespace REX::W32 std::uint32_t GetCurrentThreadId() noexcept; std::uint32_t GetEnvironmentVariableA(const char* a_name, char* a_buf, std::uint32_t a_bufLen) noexcept; std::uint32_t GetEnvironmentVariableW(const wchar_t* a_name, wchar_t* a_buf, std::uint32_t a_bufLen) noexcept; + bool GetFileSizeEx(HANDLE a_file, LARGE_INTEGER* a_fileSize) noexcept; std::uint32_t GetLastError() noexcept; std::uint32_t GetModuleFileNameA(HMODULE a_module, char* a_name, std::uint32_t a_nameLen) noexcept; std::uint32_t GetModuleFileNameW(HMODULE a_module, wchar_t* a_name, std::uint32_t a_nameLen) noexcept; diff --git a/CommonLibF4/src/REX/W32.cpp b/CommonLibF4/src/REX/W32.cpp new file mode 100644 index 00000000..82572f3c --- /dev/null +++ b/CommonLibF4/src/REX/W32.cpp @@ -0,0 +1,925 @@ +#include "REX/W32/ADVAPI32.h" +#include "REX/W32/BCRYPT.h" +#include "REX/W32/D3D11.h" +#include "REX/W32/D3DCOMPILER.h" +#include "REX/W32/DBGHELP.h" +#include "REX/W32/DXGI.h" +#include "REX/W32/KERNEL32.h" +#include "REX/W32/OLE32.h" +#include "REX/W32/SHELL32.h" +#include "REX/W32/USER32.h" +#include "REX/W32/VERSION.h" + +// ADVAPI32 + +REX_W32_IMPORT(std::int32_t, RegGetValueA, REX::W32::HKEY, const char*, const char*, std::uint32_t, std::uint32_t*, void*, std::uint32_t*); +REX_W32_IMPORT(std::int32_t, RegGetValueW, REX::W32::HKEY, const wchar_t*, const wchar_t*, std::uint32_t, std::uint32_t*, void*, std::uint32_t*); + +namespace REX::W32 +{ + std::int32_t RegGetValueA(HKEY a_key, const char* a_subKey, const char* a_value, std::uint32_t a_flags, std::uint32_t* a_type, void* a_data, std::uint32_t* a_dataLen) + { + return ::W32_IMPL_RegGetValueA(a_key, a_subKey, a_value, a_flags, a_type, a_data, a_dataLen); + } + + std::int32_t RegGetValueW(HKEY a_key, const wchar_t* a_subKey, const wchar_t* a_value, std::uint32_t a_flags, std::uint32_t* a_type, void* a_data, std::uint32_t* a_dataLen) + { + return ::W32_IMPL_RegGetValueW(a_key, a_subKey, a_value, a_flags, a_type, a_data, a_dataLen); + } +} + +// BCRYPT + +REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptOpenAlgorithmProvider, REX::W32::BCRYPT_ALG_HANDLE*, const wchar_t*, const wchar_t*, std::uint32_t); +REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptCloseAlgorithmProvider, REX::W32::BCRYPT_ALG_HANDLE, std::uint32_t); +REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptCreateHash, REX::W32::BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE*, std::uint8_t*, std::uint32_t, std::uint8_t*, std::uint32_t, std::uint32_t); +REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptDestroyHash, REX::W32::BCRYPT_HASH_HANDLE); +REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptFinishHash, REX::W32::BCRYPT_HASH_HANDLE, std::uint8_t*, std::uint32_t, std::uint32_t); +REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptGetProperty, REX::W32::BCRYPT_HANDLE, const wchar_t*, std::uint8_t*, std::uint32_t, std::uint32_t*, std::uint32_t); +REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptHashData, REX::W32::BCRYPT_HASH_HANDLE, std::uint8_t*, std::uint32_t, std::uint32_t); + +namespace REX::W32 +{ + NTSTATUS BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE* a_algorithm, const wchar_t* a_id, const wchar_t* a_impl, std::uint32_t a_flags) + { + return ::W32_IMPL_BCryptOpenAlgorithmProvider(a_algorithm, a_id, a_impl, a_flags); + } + + NTSTATUS BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE a_algorithm, std::uint32_t a_flags) + { + return ::W32_IMPL_BCryptCloseAlgorithmProvider(a_algorithm, a_flags); + } + + NTSTATUS BCryptCreateHash(BCRYPT_ALG_HANDLE a_algorithm, BCRYPT_HASH_HANDLE* a_hash, std::uint8_t* a_hashObject, std::uint32_t a_hashObjectSize, std::uint8_t* a_secret, std::uint32_t a_secretSize, std::uint32_t a_flags) + { + return ::W32_IMPL_BCryptCreateHash(a_algorithm, a_hash, a_hashObject, a_hashObjectSize, a_secret, a_secretSize, a_flags); + } + + NTSTATUS BCryptDestroyHash(BCRYPT_HASH_HANDLE a_hash) + { + return ::W32_IMPL_BCryptDestroyHash(a_hash); + } + + NTSTATUS BCryptFinishHash(BCRYPT_HASH_HANDLE a_hash, std::uint8_t* a_output, std::uint32_t a_outputSize, std::uint32_t a_flags) + { + return ::W32_IMPL_BCryptFinishHash(a_hash, a_output, a_outputSize, a_flags); + } + + NTSTATUS BCryptGetProperty(BCRYPT_HANDLE a_object, const wchar_t* a_property, std::uint8_t* a_output, std::uint32_t a_outputSize, std::uint32_t* a_result, std::uint32_t a_flags) + { + return ::W32_IMPL_BCryptGetProperty(a_object, a_property, a_output, a_outputSize, a_result, a_flags); + } + + NTSTATUS BCryptHashData(BCRYPT_HASH_HANDLE a_hash, std::uint8_t* a_input, std::uint32_t a_inputSize, std::uint32_t a_flags) + { + return ::W32_IMPL_BCryptHashData(a_hash, a_input, a_inputSize, a_flags); + } +} + +// D3D11 + +REX_W32_IMPORT(std::int32_t, D3D11CreateDevice, REX::W32::IDXGIAdapter*, REX::W32::D3D_DRIVER_TYPE, REX::W32::HMODULE, std::uint32_t, const REX::W32::D3D_FEATURE_LEVEL*, std::uint32_t, std::uint32_t, REX::W32::ID3D11Device**, REX::W32::D3D_FEATURE_LEVEL*, REX::W32::ID3D11DeviceContext**); +REX_W32_IMPORT(std::int32_t, D3D11CreateDeviceAndSwapChain, REX::W32::IDXGIAdapter*, REX::W32::D3D_DRIVER_TYPE, REX::W32::HMODULE, std::uint32_t, const REX::W32::D3D_FEATURE_LEVEL*, std::uint32_t, std::uint32_t, const REX::W32::DXGI_SWAP_CHAIN_DESC*, REX::W32::IDXGISwapChain**, REX::W32::ID3D11Device**, REX::W32::D3D_FEATURE_LEVEL*, REX::W32::ID3D11DeviceContext**); + +namespace REX::W32 +{ + HRESULT D3D11CreateDevice(IDXGIAdapter* a_adapter, D3D_DRIVER_TYPE a_driverType, HMODULE a_software, std::uint32_t a_flags, const D3D_FEATURE_LEVEL* a_pFeatureLevels, std::uint32_t a_featureLevels, std::uint32_t a_sdkVersion, ID3D11Device** a_device, D3D_FEATURE_LEVEL* a_pFeatureLevel, ID3D11DeviceContext** a_immediateContext) noexcept + { + return ::W32_IMPL_D3D11CreateDevice(a_adapter, a_driverType, a_software, a_flags, a_pFeatureLevels, a_featureLevels, a_sdkVersion, a_device, a_pFeatureLevel, a_immediateContext); + } + + HRESULT D3D11CreateDeviceAndSwapChain(IDXGIAdapter* a_adapter, D3D_DRIVER_TYPE a_driverType, HMODULE a_software, std::uint32_t a_flags, const D3D_FEATURE_LEVEL* a_pFeatureLevels, std::uint32_t a_featureLevels, std::uint32_t a_sdkVersion, const DXGI_SWAP_CHAIN_DESC* a_swapChainDesc, IDXGISwapChain** a_swapChain, ID3D11Device** a_device, D3D_FEATURE_LEVEL* a_pFeatureLevel, ID3D11DeviceContext** a_immediateContext) noexcept + { + return ::W32_IMPL_D3D11CreateDeviceAndSwapChain(a_adapter, a_driverType, a_software, a_flags, a_pFeatureLevels, a_featureLevels, a_sdkVersion, a_swapChainDesc, a_swapChain, a_device, a_pFeatureLevel, a_immediateContext); + } +} + +// D3DCOMPILER + +REX_W32_IMPORT(std::int32_t, D3DCompile, const void*, std::size_t, const char*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, const char*, const char*, std::uint32_t, std::uint32_t, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DCompile2, const void*, std::size_t, const char*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, const char*, const char*, std::uint32_t, std::uint32_t, std::uint32_t, const void*, std::size_t, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DCompileFromFile, const wchar_t*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, const char*, const char*, std::uint32_t, std::uint32_t, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DCompressShaders, std::uint32_t, REX::W32::D3D_SHADER_DATA*, std::uint32_t, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DCreateBlob, std::size_t, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DCreateFunctionLinkingGraph, std::uint32_t, REX::W32::ID3D11FunctionLinkingGraph**); +REX_W32_IMPORT(std::int32_t, D3DCreateLinker, REX::W32::ID3D11Linker**); +REX_W32_IMPORT(std::int32_t, D3DDecompressShaders, const void*, std::size_t, std::uint32_t, std::uint32_t, std::uint32_t*, std::uint32_t, REX::W32::ID3DBlob**, std::uint32_t*); +REX_W32_IMPORT(std::int32_t, D3DDisassemble, const void*, std::size_t, std::uint32_t, const char*, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DDisassemble10Effect, REX::W32::ID3D10Effect*, std::uint32_t, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DDisassembleRegion, const void*, std::size_t, std::uint32_t, const char*, std::size_t, std::size_t, std::size_t*, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DGetBlobPart, const void*, std::size_t, REX::W32::D3D_BLOB_PART, std::uint32_t a_flags, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DGetDebugInfo, const void*, std::size_t, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DGetInputSignatureBlob, const void*, std::size_t, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DGetInputAndOutputSignatureBlob, const void*, std::size_t, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DGetOutputSignatureBlob, const void*, std::size_t, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DGetTraceInstructionOffsets, const void*, std::size_t, std::uint32_t, std::size_t, std::size_t, std::size_t*, std::size_t*); +REX_W32_IMPORT(std::int32_t, D3DLoadModule, const void*, std::size_t, REX::W32::ID3D11Module**); +REX_W32_IMPORT(std::int32_t, D3DPreprocess, const void*, std::size_t, const char*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DReadFileToBlob, const wchar_t*, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DReflect, const void*, std::size_t, const REX::W32::IID&, void**); +REX_W32_IMPORT(std::int32_t, D3DReflectLibrary, const void*, std::size_t, const REX::W32::IID&, void**); +REX_W32_IMPORT(std::int32_t, D3DSetBlobPart, const void*, std::size_t, REX::W32::D3D_BLOB_PART, std::uint32_t, const void*, std::size_t, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DStripShader, const void*, std::size_t, std::uint32_t, REX::W32::ID3DBlob**); +REX_W32_IMPORT(std::int32_t, D3DWriteBlobToFile, REX::W32::ID3DBlob*, const wchar_t*, REX::W32::BOOL); + +namespace REX::W32 +{ + HRESULT D3DCompile(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob** a_code, ID3DBlob** a_errorMsgs) + { + return ::W32_IMPL_D3DCompile(a_srcData, a_srcDataSize, a_sourceName, a_defines, a_include, a_entrypoint, a_target, a_flags1, a_flags2, a_code, a_errorMsgs); + } + + HRESULT D3DCompile2(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, std::uint32_t a_secondaryDataFlags, const void* a_secondaryData, std::size_t a_secondaryDataSize, ID3DBlob** a_code, ID3DBlob** a_errorMsgs) + { + return ::W32_IMPL_D3DCompile2(a_srcData, a_srcDataSize, a_sourceName, a_defines, a_include, a_entrypoint, a_target, a_flags1, a_flags2, a_secondaryDataFlags, a_secondaryData, a_secondaryDataSize, a_code, a_errorMsgs); + } + + HRESULT D3DCompileFromFile(const wchar_t* a_fileName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob** a_code, ID3DBlob** a_errorMsgs) + { + return ::W32_IMPL_D3DCompileFromFile(a_fileName, a_defines, a_include, a_entrypoint, a_target, a_flags1, a_flags2, a_code, a_errorMsgs); + } + + HRESULT D3DCompressShaders(std::uint32_t a_numShaders, D3D_SHADER_DATA* a_shaderData, std::uint32_t a_flags, ID3DBlob** a_compressedData) + { + return ::W32_IMPL_D3DCompressShaders(a_numShaders, a_shaderData, a_flags, a_compressedData); + } + + HRESULT D3DCreateBlob(std::size_t a_size, ID3DBlob** a_blob) + { + return ::W32_IMPL_D3DCreateBlob(a_size, a_blob); + } + + HRESULT D3DCreateFunctionLinkingGraph(std::uint32_t a_flags, ID3D11FunctionLinkingGraph** a_functionLinkingGraph) + { + return ::W32_IMPL_D3DCreateFunctionLinkingGraph(a_flags, a_functionLinkingGraph); + } + + HRESULT D3DCreateLinker(ID3D11Linker** a_linker) + { + return ::W32_IMPL_D3DCreateLinker(a_linker); + } + + HRESULT D3DDecompressShaders(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_numShaders, std::uint32_t a_startIndex, std::uint32_t* a_indices, std::uint32_t a_flags, ID3DBlob** a_shaders, std::uint32_t* a_totalShaders) + { + return ::W32_IMPL_D3DDecompressShaders(a_srcData, a_srcDataSize, a_numShaders, a_startIndex, a_indices, a_flags, a_shaders, a_totalShaders); + } + + HRESULT D3DDisassemble(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char* a_comments, ID3DBlob** a_disassembly) + { + return ::W32_IMPL_D3DDisassemble(a_srcData, a_srcDataSize, a_flags, a_comments, a_disassembly); + } + + HRESULT D3DDisassemble10Effect(ID3D10Effect* a_effect, std::uint32_t a_flags, ID3DBlob** a_disassembly) + { + return ::W32_IMPL_D3DDisassemble10Effect(a_effect, a_flags, a_disassembly); + } + + HRESULT D3DDisassembleRegion(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char* a_comments, std::size_t a_startByteOffset, std::size_t a_numInsts, std::size_t* a_finishByteOffset, ID3DBlob** a_disassembly) + { + return ::W32_IMPL_D3DDisassembleRegion(a_srcData, a_srcDataSize, a_flags, a_comments, a_startByteOffset, a_numInsts, a_finishByteOffset, a_disassembly); + } + + HRESULT D3DGetBlobPart(const void* a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, ID3DBlob** a_part) + { + return ::W32_IMPL_D3DGetBlobPart(a_srcData, a_srcDataSize, a_partType, a_flags, a_part); + } + + HRESULT D3DGetDebugInfo(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_debugInfo) + { + return ::W32_IMPL_D3DGetDebugInfo(a_srcData, a_srcDataSize, a_debugInfo); + } + + HRESULT D3DGetInputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob) + { + return ::W32_IMPL_D3DGetInputSignatureBlob(a_srcData, a_srcDataSize, a_signatureBlob); + } + + HRESULT D3DGetInputAndOutputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob) + { + return ::W32_IMPL_D3DGetInputAndOutputSignatureBlob(a_srcData, a_srcDataSize, a_signatureBlob); + } + + HRESULT D3DGetOutputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob) + { + return ::W32_IMPL_D3DGetOutputSignatureBlob(a_srcData, a_srcDataSize, a_signatureBlob); + } + + HRESULT D3DGetTraceInstructionOffsets(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, std::size_t a_startInstIndex, std::size_t a_numInsts, std::size_t* a_offsets, std::size_t* a_totalInsts) + { + return ::W32_IMPL_D3DGetTraceInstructionOffsets(a_srcData, a_srcDataSize, a_flags, a_startInstIndex, a_numInsts, a_offsets, a_totalInsts); + } + + HRESULT D3DLoadModule(const void* a_srcData, std::size_t a_srcDataSize, ID3D11Module** a_module) + { + return ::W32_IMPL_D3DLoadModule(a_srcData, a_srcDataSize, a_module); + } + + HRESULT D3DPreprocess(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, ID3DBlob** a_codeText, ID3DBlob** a_errorMsgs) + { + return ::W32_IMPL_D3DPreprocess(a_srcData, a_srcDataSize, a_sourceName, a_defines, a_include, a_codeText, a_errorMsgs); + } + + HRESULT D3DReadFileToBlob(const wchar_t* a_fileName, ID3DBlob** a_contents) + { + return ::W32_IMPL_D3DReadFileToBlob(a_fileName, a_contents); + } + + HRESULT D3DReflect(const void* a_srcData, std::size_t a_srcDataSize, const IID& a_iid, void** a_reflector) + { + return ::W32_IMPL_D3DReflect(a_srcData, a_srcDataSize, a_iid, a_reflector); + } + + HRESULT D3DReflectLibrary(const void* a_srcData, std::size_t a_srcDataSize, const IID& a_iid, void** a_reflector) + { + return ::W32_IMPL_D3DReflectLibrary(a_srcData, a_srcDataSize, a_iid, a_reflector); + } + + HRESULT D3DSetBlobPart(const void* a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, const void* a_part, std::size_t a_partSize, ID3DBlob** a_newShader) + { + return ::W32_IMPL_D3DSetBlobPart(a_srcData, a_srcDataSize, a_partType, a_flags, a_part, a_partSize, a_newShader); + } + + HRESULT D3DStripShader(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_stripFlags, ID3DBlob** a_strippedBlob) + { + return ::W32_IMPL_D3DStripShader(a_srcData, a_srcDataSize, a_stripFlags, a_strippedBlob); + } + + HRESULT D3DWriteBlobToFile(ID3DBlob* a_blob, const wchar_t* a_fileName, bool a_overwrite) + { + return ::W32_IMPL_D3DWriteBlobToFile(a_blob, a_fileName, static_cast(a_overwrite)); + } +} + +// DBGHELP + +REX_W32_IMPORT(std::uint32_t, UnDecorateSymbolName, const char*, char*, std::uint32_t, std::uint32_t); +REX_W32_IMPORT(std::uint32_t, UnDecorateSymbolNameW, const wchar_t*, wchar_t*, std::uint32_t, std::uint32_t); + +namespace REX::W32 +{ + std::uint32_t UnDecorateSymbolName(const char* a_name, char* a_buf, std::uint32_t a_bufLen, std::uint32_t a_flags) noexcept + { + return ::W32_IMPL_UnDecorateSymbolName(a_name, a_buf, a_bufLen, a_flags); + } + + std::uint32_t UnDecorateSymbolNameW(const wchar_t* a_name, wchar_t* a_buf, std::uint32_t a_bufLen, std::uint32_t a_flags) noexcept + { + return ::W32_IMPL_UnDecorateSymbolNameW(a_name, a_buf, a_bufLen, a_flags); + } +} + +// DXGI + +REX_W32_IMPORT(std::int32_t, CreateDXGIFactory, const IID&, void**); +REX_W32_IMPORT(std::int32_t, CreateDXGIFactory1, const IID&, void**); + +namespace REX::W32 +{ + HRESULT CreateDXGIFactory(const IID& a_iid, void** a_factory) noexcept + { + return ::W32_IMPL_CreateDXGIFactory(a_iid, a_factory); + } + + HRESULT CreateDXGIFactory1(const IID& a_iid, void** a_factory) noexcept + { + return ::W32_IMPL_CreateDXGIFactory1(a_iid, a_factory); + } +} + +// KERNEL32 + +REX_W32_IMPORT(REX::W32::BOOL, CloseHandle, REX::W32::HANDLE); +REX_W32_IMPORT(REX::W32::HANDLE, CreateFileA, const char*, std::uint32_t, std::uint32_t, REX::W32::SECURITY_ATTRIBUTES*, std::uint32_t, std::uint32_t, REX::W32::HANDLE); +REX_W32_IMPORT(REX::W32::HANDLE, CreateFileW, const wchar_t*, std::uint32_t, std::uint32_t, REX::W32::SECURITY_ATTRIBUTES*, std::uint32_t, std::uint32_t, REX::W32::HANDLE); +REX_W32_IMPORT(REX::W32::HANDLE, CreateFileMappingA, REX::W32::HANDLE, REX::W32::SECURITY_ATTRIBUTES*, std::uint32_t, std::uint32_t, std::uint32_t, const char*); +REX_W32_IMPORT(REX::W32::HANDLE, CreateFileMappingW, REX::W32::HANDLE, REX::W32::SECURITY_ATTRIBUTES*, std::uint32_t, std::uint32_t, std::uint32_t, const wchar_t*); +REX_W32_IMPORT(REX::W32::BOOL, CreateProcessA, const char*, char*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::BOOL, std::uint32_t, void*, const char*, REX::W32::STARTUPINFOA*, REX::W32::PROCESS_INFORMATION*); +REX_W32_IMPORT(REX::W32::BOOL, CreateProcessW, const wchar_t*, wchar_t*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::BOOL, std::uint32_t, void*, const wchar_t*, REX::W32::STARTUPINFOW*, REX::W32::PROCESS_INFORMATION*); +REX_W32_IMPORT(REX::W32::HANDLE, CreateRemoteThread, REX::W32::HANDLE, REX::W32::SECURITY_ATTRIBUTES*, std::size_t, REX::W32::THREAD_START_ROUTINE*, void*, std::uint32_t, std::uint32_t*); +REX_W32_IMPORT(REX::W32::HANDLE, CreateSemaphoreA, REX::W32::SECURITY_ATTRIBUTES*, std::int32_t, std::int32_t, const char*); +REX_W32_IMPORT(REX::W32::HANDLE, CreateThread, REX::W32::SECURITY_ATTRIBUTES*, std::size_t, REX::W32::THREAD_START_ROUTINE*, void*, std::uint32_t, std::uint32_t*); +REX_W32_IMPORT(void, DeleteCriticalSection, REX::W32::CRITICAL_SECTION*); +REX_W32_IMPORT(void, EnterCriticalSection, REX::W32::CRITICAL_SECTION*); +REX_W32_IMPORT(std::uint32_t, ExpandEnvironmentStringsA, const char*, char*, std::uint32_t); +REX_W32_IMPORT(std::uint32_t, ExpandEnvironmentStringsW, const wchar_t*, wchar_t*, std::uint32_t); +REX_W32_IMPORT(REX::W32::BOOL, FindClose, REX::W32::HANDLE); +REX_W32_IMPORT(REX::W32::HANDLE, FindFirstFileA, const char*, REX::W32::WIN32_FIND_DATAA*); +REX_W32_IMPORT(REX::W32::HANDLE, FindFirstFileW, const wchar_t*, REX::W32::WIN32_FIND_DATAW*); +REX_W32_IMPORT(REX::W32::BOOL, FindNextFileA, REX::W32::HANDLE, REX::W32::WIN32_FIND_DATAA*); +REX_W32_IMPORT(REX::W32::BOOL, FindNextFileW, REX::W32::HANDLE, REX::W32::WIN32_FIND_DATAW*); +REX_W32_IMPORT(REX::W32::BOOL, FlushInstructionCache, REX::W32::HANDLE, const void*, std::size_t); +REX_W32_IMPORT(REX::W32::BOOL, FreeLibrary, REX::W32::HMODULE); +REX_W32_IMPORT(REX::W32::BOOL, GetComputerNameA, char*, std::uint32_t*); +REX_W32_IMPORT(REX::W32::BOOL, GetComputerNameW, wchar_t*, std::uint32_t*); +REX_W32_IMPORT(REX::W32::HANDLE, GetCurrentProcess); +REX_W32_IMPORT(std::uint32_t, GetCurrentThreadId); +REX_W32_IMPORT(std::uint32_t, GetEnvironmentVariableA, const char*, char*, std::uint32_t); +REX_W32_IMPORT(std::uint32_t, GetEnvironmentVariableW, const wchar_t*, wchar_t*, std::uint32_t); +REX_W32_IMPORT(REX::W32::BOOL, GetFileSizeEx, REX::W32::HANDLE, REX::W32::LARGE_INTEGER*); +REX_W32_IMPORT(std::uint32_t, GetLastError); +REX_W32_IMPORT(std::uint32_t, GetModuleFileNameA, REX::W32::HMODULE, char*, std::uint32_t); +REX_W32_IMPORT(std::uint32_t, GetModuleFileNameW, REX::W32::HMODULE, wchar_t*, std::uint32_t); +REX_W32_IMPORT(REX::W32::HMODULE, GetModuleHandleA, const char*); +REX_W32_IMPORT(REX::W32::HMODULE, GetModuleHandleW, const wchar_t*); +REX_W32_IMPORT(std::uint32_t, GetPrivateProfileStringA, const char*, const char*, const char*, char*, std::uint32_t, const char*); +REX_W32_IMPORT(std::uint32_t, GetPrivateProfileStringW, const wchar_t*, const wchar_t*, const wchar_t*, wchar_t*, std::uint32_t, const wchar_t*); +REX_W32_IMPORT(void*, GetProcAddress, REX::W32::HMODULE, const char*); +REX_W32_IMPORT(void, GetSystemInfo, REX::W32::SYSTEM_INFO*); +REX_W32_IMPORT(REX::W32::BOOL, InitializeCriticalSectionAndSpinCount, REX::W32::CRITICAL_SECTION*, std::uint32_t); +REX_W32_IMPORT(REX::W32::BOOL, IsDebuggerPresent); +REX_W32_IMPORT(std::int32_t, LCMapStringEx, const wchar_t*, std::uint32_t, const wchar_t*, std::int32_t, wchar_t*, std::int32_t, REX::W32::NLSVERSIONINFO*, void*, std::intptr_t); +REX_W32_IMPORT(void, LeaveCriticalSection, REX::W32::CRITICAL_SECTION*); +REX_W32_IMPORT(REX::W32::HMODULE, LoadLibraryA, const char*); +REX_W32_IMPORT(REX::W32::HMODULE, LoadLibraryW, const wchar_t*); +REX_W32_IMPORT(void*, MapViewOfFile, REX::W32::HANDLE, std::uint32_t, std::uint32_t, std::uint32_t, std::size_t); +REX_W32_IMPORT(void*, MapViewOfFileEx, REX::W32::HANDLE, std::uint32_t, std::uint32_t, std::uint32_t, std::size_t, void*); +REX_W32_IMPORT(std::int32_t, MultiByteToWideChar, std::uint32_t, std::uint32_t, const char*, std::int32_t, wchar_t*, std::int32_t); +REX_W32_IMPORT(REX::W32::HANDLE, OpenFileMappingA, std::uint32_t, REX::W32::BOOL, const char*); +REX_W32_IMPORT(REX::W32::HANDLE, OpenFileMappingW, std::uint32_t, REX::W32::BOOL, const wchar_t*); +REX_W32_IMPORT(void, OutputDebugStringA, const char*); +REX_W32_IMPORT(void, OutputDebugStringW, const wchar_t*); +REX_W32_IMPORT(REX::W32::BOOL, QueryPerformanceCounter, std::int64_t*); +REX_W32_IMPORT(REX::W32::BOOL, QueryPerformanceFrequency, std::int64_t*); +REX_W32_IMPORT(std::uint32_t, ResumeThread, REX::W32::HANDLE); +REX_W32_IMPORT(REX::W32::BOOL, SetEnvironmentVariableA, const char*, const char*); +REX_W32_IMPORT(REX::W32::BOOL, SetEnvironmentVariableW, const wchar_t*, const wchar_t*); +REX_W32_IMPORT(void, Sleep, std::uint32_t); +REX_W32_IMPORT(REX::W32::BOOL, TerminateProcess, REX::W32::HANDLE, std::uint32_t); +REX_W32_IMPORT(void*, TlsGetValue, std::uint32_t); +REX_W32_IMPORT(REX::W32::BOOL, TlsSetValue, std::uint32_t, void*); +REX_W32_IMPORT(REX::W32::BOOL, UnmapViewOfFile, const void*); +REX_W32_IMPORT(void*, VirtualAlloc, void*, std::size_t, std::uint32_t, std::uint32_t); +REX_W32_IMPORT(void*, VirtualAllocEx, REX::W32::HANDLE, void*, std::size_t, std::uint32_t, std::uint32_t); +REX_W32_IMPORT(REX::W32::BOOL, VirtualFree, void*, std::size_t, std::uint32_t); +REX_W32_IMPORT(REX::W32::BOOL, VirtualFreeEx, REX::W32::HANDLE, void*, std::size_t, std::uint32_t); +REX_W32_IMPORT(REX::W32::BOOL, VirtualProtect, void*, std::size_t, std::uint32_t, std::uint32_t*); +REX_W32_IMPORT(REX::W32::BOOL, VirtualProtectEx, REX::W32::HANDLE, void*, std::size_t, std::uint32_t, std::uint32_t*); +REX_W32_IMPORT(std::size_t, VirtualQuery, const void*, MEMORY_BASIC_INFORMATION*, std::size_t); +REX_W32_IMPORT(std::size_t, VirtualQueryEx, REX::W32::HANDLE, const void*, MEMORY_BASIC_INFORMATION*, std::size_t); +REX_W32_IMPORT(std::uint32_t, WaitForSingleObject, REX::W32::HANDLE, std::uint32_t); +REX_W32_IMPORT(std::uint32_t, WaitForSingleObjectEx, REX::W32::HANDLE, std::uint32_t, REX::W32::BOOL); +REX_W32_IMPORT(std::int32_t, WideCharToMultiByte, std::uint32_t, std::uint32_t, const wchar_t*, std::int32_t, char*, std::int32_t, const char*, std::int32_t*); +REX_W32_IMPORT(REX::W32::BOOL, WriteProcessMemory, REX::W32::HANDLE, void*, const void*, std::size_t, std::size_t*); + +extern "C" REX::W32::IMAGE_DOS_HEADER __ImageBase; + +namespace REX::W32 +{ + bool CloseHandle(HANDLE a_handle) noexcept + { + return ::W32_IMPL_CloseHandle(a_handle); + } + + HANDLE CreateFileA(const char* a_fileName, std::uint32_t a_desiredAccess, std::uint32_t a_shareMode, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_creationDisposition, std::uint32_t a_flags, HANDLE a_templateFile) + { + return ::W32_IMPL_CreateFileA(a_fileName, a_desiredAccess, a_shareMode, a_attributes, a_creationDisposition, a_flags, a_templateFile); + } + + HANDLE CreateFileW(const wchar_t* a_fileName, std::uint32_t a_desiredAccess, std::uint32_t a_shareMode, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_creationDisposition, std::uint32_t a_flags, HANDLE a_templateFile) + { + return ::W32_IMPL_CreateFileW(a_fileName, a_desiredAccess, a_shareMode, a_attributes, a_creationDisposition, a_flags, a_templateFile); + } + + HANDLE CreateFileMappingA(HANDLE a_file, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_protect, std::uint32_t a_maxSizeHigh, std::uint32_t a_maxSizeLow, const char* a_name) noexcept + { + return ::W32_IMPL_CreateFileMappingA(a_file, a_attributes, a_protect, a_maxSizeHigh, a_maxSizeLow, a_name); + } + + HANDLE CreateFileMappingW(HANDLE a_file, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_protect, std::uint32_t a_maxSizeHigh, std::uint32_t a_maxSizeLow, const wchar_t* a_name) noexcept + { + return ::W32_IMPL_CreateFileMappingW(a_file, a_attributes, a_protect, a_maxSizeHigh, a_maxSizeLow, a_name); + } + + bool CreateProcessA(const char* a_name, char* a_cmd, SECURITY_ATTRIBUTES* a_procAttr, SECURITY_ATTRIBUTES* a_threadAttr, bool a_inheritHandles, std::uint32_t a_flags, void* a_env, const char* a_curDir, STARTUPINFOA* a_startInfo, PROCESS_INFORMATION* a_procInfo) noexcept + { + return ::W32_IMPL_CreateProcessA(a_name, a_cmd, a_procAttr, a_threadAttr, a_inheritHandles, a_flags, a_env, a_curDir, a_startInfo, a_procInfo); + } + + bool CreateProcessW(const wchar_t* a_name, wchar_t* a_cmd, SECURITY_ATTRIBUTES* a_procAttr, SECURITY_ATTRIBUTES* a_threadAttr, bool a_inheritHandles, std::uint32_t a_flags, void* a_env, const wchar_t* a_curDir, STARTUPINFOW* a_startInfo, PROCESS_INFORMATION* a_procInfo) noexcept + { + return ::W32_IMPL_CreateProcessW(a_name, a_cmd, a_procAttr, a_threadAttr, a_inheritHandles, a_flags, a_env, a_curDir, a_startInfo, a_procInfo); + } + + HANDLE CreateRemoteThread(HANDLE a_process, SECURITY_ATTRIBUTES* a_threadAttr, std::size_t a_stackSize, THREAD_START_ROUTINE* a_startAddr, void* a_param, std::uint32_t a_flags, std::uint32_t* a_threadID) noexcept + { + return ::W32_IMPL_CreateRemoteThread(a_process, a_threadAttr, a_stackSize, a_startAddr, a_param, a_flags, a_threadID); + } + + HANDLE CreateSemaphoreA(SECURITY_ATTRIBUTES* a_semaphoreAttr, std::int32_t a_initCount, std::int32_t a_maxCount, const char* a_name) + { + return ::W32_IMPL_CreateSemaphoreA(a_semaphoreAttr, a_initCount, a_maxCount, a_name); + } + + HANDLE CreateThread(SECURITY_ATTRIBUTES* a_threadAttr, std::size_t a_stackSize, THREAD_START_ROUTINE* a_startAddr, void* a_param, std::uint32_t a_flags, std::uint32_t* a_threadID) noexcept + { + return ::W32_IMPL_CreateThread(a_threadAttr, a_stackSize, a_startAddr, a_param, a_flags, a_threadID); + } + + void DeleteCriticalSection(CRITICAL_SECTION* a_criticalSection) + { + ::W32_IMPL_DeleteCriticalSection(a_criticalSection); + } + + void EnterCriticalSection(CRITICAL_SECTION* a_criticalSection) + { + ::W32_IMPL_EnterCriticalSection(a_criticalSection); + } + + std::uint32_t ExpandEnvironmentStringsA(const char* a_src, char* a_dst, std::uint32_t a_dstLen) noexcept + { + return ::W32_IMPL_ExpandEnvironmentStringsA(a_src, a_dst, a_dstLen); + } + + std::uint32_t ExpandEnvironmentStringsW(const wchar_t* a_src, wchar_t* a_dst, std::uint32_t a_dstLen) noexcept + { + return ::W32_IMPL_ExpandEnvironmentStringsW(a_src, a_dst, a_dstLen); + } + + bool FindClose(HANDLE a_file) noexcept + { + return ::W32_IMPL_FindClose(a_file); + } + + HANDLE FindFirstFileA(const char* a_name, WIN32_FIND_DATAA* a_data) noexcept + { + return ::W32_IMPL_FindFirstFileA(a_name, a_data); + } + + HANDLE FindFirstFileW(const wchar_t* a_name, WIN32_FIND_DATAW* a_data) noexcept + { + return ::W32_IMPL_FindFirstFileW(a_name, a_data); + } + + bool FindNextFileA(HANDLE a_file, WIN32_FIND_DATAA* a_data) noexcept + { + return ::W32_IMPL_FindNextFileA(a_file, a_data); + } + + bool FindNextFileW(HANDLE a_file, WIN32_FIND_DATAW* a_data) noexcept + { + return ::W32_IMPL_FindNextFileW(a_file, a_data); + } + + bool FlushInstructionCache(HANDLE a_process, const void* a_baseAddr, std::size_t a_size) noexcept + { + return ::W32_IMPL_FlushInstructionCache(a_process, a_baseAddr, a_size); + } + + bool FreeLibrary(HMODULE a_module) noexcept + { + return ::W32_IMPL_FreeLibrary(a_module); + } + + bool GetComputerNameA(char* a_buffer, std::uint32_t* a_size) noexcept + { + return ::W32_IMPL_GetComputerNameA(a_buffer, a_size); + } + + bool GetComputerNameW(wchar_t* a_buffer, std::uint32_t* a_size) noexcept + { + return ::W32_IMPL_GetComputerNameW(a_buffer, a_size); + } + + HMODULE GetCurrentModule() noexcept + { + return reinterpret_cast(std::addressof(__ImageBase)); + } + + HANDLE GetCurrentProcess() noexcept + { + return ::W32_IMPL_GetCurrentProcess(); + } + + std::uint32_t GetCurrentThreadId() noexcept + { + return ::W32_IMPL_GetCurrentThreadId(); + } + + std::uint32_t GetEnvironmentVariableA(const char* a_name, char* a_buf, std::uint32_t a_bufLen) noexcept + { + return ::W32_IMPL_GetEnvironmentVariableA(a_name, a_buf, a_bufLen); + } + + std::uint32_t GetEnvironmentVariableW(const wchar_t* a_name, wchar_t* a_buf, std::uint32_t a_bufLen) noexcept + { + return ::W32_IMPL_GetEnvironmentVariableW(a_name, a_buf, a_bufLen); + } + + bool GetFileSizeEx(HANDLE a_file, LARGE_INTEGER* a_fileSize) noexcept + { + return ::W32_IMPL_GetFileSizeEx(a_file, a_fileSize); + } + + std::uint32_t GetLastError() noexcept + { + return ::W32_IMPL_GetLastError(); + } + + std::uint32_t GetModuleFileNameA(HMODULE a_module, char* a_name, std::uint32_t a_nameLen) noexcept + { + return ::W32_IMPL_GetModuleFileNameA(a_module, a_name, a_nameLen); + } + + std::uint32_t GetModuleFileNameW(HMODULE a_module, wchar_t* a_name, std::uint32_t a_nameLen) noexcept + { + return ::W32_IMPL_GetModuleFileNameW(a_module, a_name, a_nameLen); + } + + HMODULE GetModuleHandleA(const char* a_name) noexcept + { + return ::W32_IMPL_GetModuleHandleA(a_name); + } + + HMODULE GetModuleHandleW(const wchar_t* a_name) noexcept + { + return ::W32_IMPL_GetModuleHandleW(a_name); + } + + std::uint32_t GetPrivateProfileStringA(const char* a_app, const char* a_key, const char* a_default, char* a_buf, std::uint32_t a_bufLen, const char* a_name) noexcept + { + return ::W32_IMPL_GetPrivateProfileStringA(a_app, a_key, a_default, a_buf, a_bufLen, a_name); + } + + std::uint32_t GetPrivateProfileStringW(const wchar_t* a_app, const wchar_t* a_key, const wchar_t* a_default, wchar_t* a_buf, std::uint32_t a_bufLen, const wchar_t* a_name) noexcept + { + return ::W32_IMPL_GetPrivateProfileStringW(a_app, a_key, a_default, a_buf, a_bufLen, a_name); + } + + void* GetProcAddress(HMODULE a_module, const char* a_name) noexcept + { + return ::W32_IMPL_GetProcAddress(a_module, a_name); + } + + void GetSystemInfo(SYSTEM_INFO* a_info) noexcept + { + return ::W32_IMPL_GetSystemInfo(a_info); + } + + bool IMAGE_SNAP_BY_ORDINAL64(std::uint64_t a_ordinal) noexcept + { + return (a_ordinal & IMAGE_ORDINAL_FLAG64) != 0; + } + + IMAGE_SECTION_HEADER* IMAGE_FIRST_SECTION(const IMAGE_NT_HEADERS64* a_header) noexcept + { + constexpr auto opt = __builtin_offsetof(IMAGE_NT_HEADERS64, optionalHeader); + const auto optSize = a_header->fileHeader.optionalHeaderSize; + const auto section = reinterpret_cast(a_header) + opt + optSize; + return reinterpret_cast(section); + } + + bool InitializeCriticalSectionAndSpinCount(CRITICAL_SECTION* a_criticalSection, std::uint32_t a_spinCount) + { + return ::W32_IMPL_InitializeCriticalSectionAndSpinCount(a_criticalSection, a_spinCount); + } + + std::uint32_t InterlockedCompareExchange(volatile std::uint32_t* a_target, std::uint32_t a_value, std::uint32_t a_compare) noexcept + { + return _InterlockedCompareExchange((volatile long*)a_target, a_value, a_compare); + } + + std::uint64_t InterlockedCompareExchange64(volatile std::uint64_t* a_target, std::uint64_t a_value, std::uint64_t a_compare) noexcept + { + return _InterlockedCompareExchange64((volatile long long*)a_target, a_value, a_compare); + } + + std::uint32_t InterlockedDecrement(volatile std::uint32_t* a_target) noexcept + { + return _InterlockedDecrement((volatile long*)a_target); + } + + std::uint64_t InterlockedDecrement64(volatile std::uint64_t* a_target) noexcept + { + return _InterlockedDecrement64((volatile long long*)a_target); + } + + std::uint32_t InterlockedExchange(volatile std::uint32_t* a_target, std::uint32_t a_value) noexcept + { + return _InterlockedExchange((volatile long*)a_target, a_value); + } + + std::uint64_t InterlockedExchange64(volatile std::uint64_t* a_target, std::uint64_t a_value) noexcept + { + return _InterlockedExchange64((volatile long long*)a_target, a_value); + } + + std::uint32_t InterlockedIncrement(volatile std::uint32_t* a_target) noexcept + { + return _InterlockedIncrement((volatile long*)a_target); + } + + std::uint64_t InterlockedIncrement64(volatile std::uint64_t* a_target) noexcept + { + return _InterlockedIncrement64((volatile long long*)a_target); + } + + bool IsDebuggerPresent() noexcept + { + return ::W32_IMPL_IsDebuggerPresent(); + } + + std::int32_t LCMapStringEx(const wchar_t* a_locale, std::uint32_t a_flags, const wchar_t* a_src, std::int32_t a_srcLen, wchar_t* a_dst, std::int32_t a_dstLen, NLSVERSIONINFO* a_info, void* a_reserved, std::intptr_t a_sortHandle) noexcept + { + return ::W32_IMPL_LCMapStringEx(a_locale, a_flags, a_src, a_srcLen, a_dst, a_dstLen, a_info, a_reserved, a_sortHandle); + } + + void LeaveCriticalSection(CRITICAL_SECTION* a_criticalSection) + { + ::W32_IMPL_LeaveCriticalSection(a_criticalSection); + } + + HMODULE LoadLibraryA(const char* a_name) noexcept + { + return ::W32_IMPL_LoadLibraryA(a_name); + } + + HMODULE LoadLibraryW(const wchar_t* a_name) noexcept + { + return ::W32_IMPL_LoadLibraryW(a_name); + } + + void* MapViewOfFile(HANDLE a_object, std::uint32_t a_desiredAccess, std::uint32_t a_fileOffsetHi, std::uint32_t a_fileOffsetLo, std::size_t a_numBytes) noexcept + { + return ::W32_IMPL_MapViewOfFile(a_object, a_desiredAccess, a_fileOffsetHi, a_fileOffsetLo, a_numBytes); + } + + void* MapViewOfFileEx(HANDLE a_object, std::uint32_t a_desiredAccess, std::uint32_t a_fileOffsetHi, std::uint32_t a_fileOffsetLo, std::size_t a_numBytes, void* a_baseAddr) noexcept + { + return ::W32_IMPL_MapViewOfFileEx(a_object, a_desiredAccess, a_fileOffsetHi, a_fileOffsetLo, a_numBytes, a_baseAddr); + } + + std::int32_t MultiByteToWideChar(std::uint32_t a_codePage, std::uint32_t a_flags, const char* a_src, std::int32_t a_srcLen, wchar_t* a_dst, std::int32_t a_dstLen) noexcept + { + return ::W32_IMPL_MultiByteToWideChar(a_codePage, a_flags, a_src, a_srcLen, a_dst, a_dstLen); + } + + HANDLE OpenFileMappingA(std::uint32_t a_desiredAccess, bool a_inheritHandle, const char* a_name) noexcept + { + return ::W32_IMPL_OpenFileMappingA(a_desiredAccess, a_inheritHandle, a_name); + } + + HANDLE OpenFileMappingW(std::uint32_t a_desiredAccess, bool a_inheritHandle, const wchar_t* a_name) noexcept + { + return ::W32_IMPL_OpenFileMappingW(a_desiredAccess, a_inheritHandle, a_name); + } + + void OutputDebugStringA(const char* a_str) noexcept + { + ::W32_IMPL_OutputDebugStringA(a_str); + } + + void OutputDebugStringW(const wchar_t* a_str) noexcept + { + ::W32_IMPL_OutputDebugStringW(a_str); + } + + bool QueryPerformanceCounter(std::int64_t* a_counter) noexcept + { + return ::W32_IMPL_QueryPerformanceCounter(a_counter); + } + + bool QueryPerformanceFrequency(std::int64_t* a_frequency) noexcept + { + return ::W32_IMPL_QueryPerformanceFrequency(a_frequency); + } + + std::uint32_t ResumeThread(HANDLE a_handle) noexcept + { + return ::W32_IMPL_ResumeThread(a_handle); + } + + bool SetEnvironmentVariableA(const char* a_name, const char* a_value) noexcept + { + return ::W32_IMPL_SetEnvironmentVariableA(a_name, a_value); + } + + bool SetEnvironmentVariableW(const wchar_t* a_name, const wchar_t* a_value) noexcept + { + return ::W32_IMPL_SetEnvironmentVariableW(a_name, a_value); + } + + void Sleep(std::uint32_t a_milliseconds) noexcept + { + ::W32_IMPL_Sleep(a_milliseconds); + } + + bool TerminateProcess(HANDLE a_process, std::uint32_t a_exitCode) noexcept + { + return ::W32_IMPL_TerminateProcess(a_process, a_exitCode); + } + + void* TlsGetValue(std::uint32_t a_index) noexcept + { + return ::W32_IMPL_TlsGetValue(a_index); + } + + bool TlsSetValue(std::uint32_t a_index, void* a_value) noexcept + { + return ::W32_IMPL_TlsSetValue(a_index, a_value); + } + + bool UnmapViewOfFile(const void* a_baseAddress) noexcept + { + return ::W32_IMPL_UnmapViewOfFile(a_baseAddress); + } + + void* VirtualAlloc(void* a_address, std::size_t a_size, std::uint32_t a_type, std::uint32_t a_protect) noexcept + { + return ::W32_IMPL_VirtualAlloc(a_address, a_size, a_type, a_protect); + } + + void* VirtualAllocEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_type, std::uint32_t a_protect) noexcept + { + return ::W32_IMPL_VirtualAllocEx(a_process, a_address, a_size, a_type, a_protect); + } + + bool VirtualFree(void* a_address, std::size_t a_size, std::uint32_t a_type) noexcept + { + return ::W32_IMPL_VirtualFree(a_address, a_size, a_type); + } + + bool VirtualFreeEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_type) noexcept + { + return ::W32_IMPL_VirtualFreeEx(a_process, a_address, a_size, a_type); + } + + bool VirtualProtect(void* a_address, std::size_t a_size, std::uint32_t a_newProtect, std::uint32_t* a_oldProtect) noexcept + { + return ::W32_IMPL_VirtualProtect(a_address, a_size, a_newProtect, a_oldProtect); + } + + bool VirtualProtectEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_newProtect, std::uint32_t* a_oldProtect) noexcept + { + return ::W32_IMPL_VirtualProtectEx(a_process, a_address, a_size, a_newProtect, a_oldProtect); + } + + std::size_t VirtualQuery(const void* a_address, MEMORY_BASIC_INFORMATION* a_buf, std::size_t a_bufLen) noexcept + { + return ::W32_IMPL_VirtualQuery(a_address, a_buf, a_bufLen); + } + + std::size_t VirtualQueryEx(HANDLE a_process, const void* a_address, MEMORY_BASIC_INFORMATION* a_buf, std::size_t a_bufLen) noexcept + { + return ::W32_IMPL_VirtualQueryEx(a_process, a_address, a_buf, a_bufLen); + } + + std::uint32_t WaitForSingleObject(HANDLE a_handle, std::uint32_t a_milliseconds) noexcept + { + return ::W32_IMPL_WaitForSingleObject(a_handle, a_milliseconds); + } + + std::uint32_t WaitForSingleObjectEx(HANDLE a_handle, std::uint32_t a_milliseconds, bool a_alertable) noexcept + { + return ::W32_IMPL_WaitForSingleObjectEx(a_handle, a_milliseconds, a_alertable); + } + + std::int32_t WideCharToMultiByte(std::uint32_t a_codePage, std::uint32_t a_flags, const wchar_t* a_src, std::int32_t a_srcLen, char* a_dst, std::int32_t a_dstLen, const char* a_default, std::int32_t* a_defaultLen) + { + return ::W32_IMPL_WideCharToMultiByte(a_codePage, a_flags, a_src, a_srcLen, a_dst, a_dstLen, a_default, a_defaultLen); + } + + bool WriteProcessMemory(HANDLE a_process, void* a_address, const void* a_buf, std::size_t a_bufLen, std::size_t* a_bufWritten) noexcept + { + return ::W32_IMPL_WriteProcessMemory(a_process, a_address, a_buf, a_bufLen, a_bufWritten); + } +} + +// OLE32 + +REX_W32_IMPORT(void, CoTaskMemFree, void*); + +namespace REX::W32 +{ + void CoTaskMemFree(void* a_block) noexcept + { + ::W32_IMPL_CoTaskMemFree(a_block); + } +} + +// SHELL32 + +REX_W32_IMPORT(std::int32_t, SHGetKnownFolderPath, const REX::W32::GUID&, std::uint32_t, void*, wchar_t**); + +namespace REX::W32 +{ + std::int32_t SHGetKnownFolderPath(const GUID& a_id, std::uint32_t a_flags, void* a_token, wchar_t** a_path) noexcept + { + return ::W32_IMPL_SHGetKnownFolderPath(a_id, a_flags, a_token, a_path); + } +} + +// USER32 + +REX_W32_IMPORT(REX::W32::BOOL, GetClientRect, REX::W32::HWND, REX::W32::RECT*); +REX_W32_IMPORT(std::int32_t, GetKeyNameTextA, std::int32_t, char*, std::int32_t); +REX_W32_IMPORT(std::int32_t, GetKeyNameTextW, std::int32_t, wchar_t*, std::int32_t); +REX_W32_IMPORT(std::int16_t, GetKeyState, std::int32_t); +REX_W32_IMPORT(REX::W32::BOOL, GetWindowRect, REX::W32::HWND, REX::W32::RECT*); +REX_W32_IMPORT(std::int32_t, MessageBoxA, REX::W32::HWND, const char*, const char*, std::uint32_t); +REX_W32_IMPORT(std::int32_t, MessageBoxW, REX::W32::HWND, const wchar_t*, const wchar_t*, std::uint32_t); +REX_W32_IMPORT(std::intptr_t, SetWindowLongPtrA, REX::W32::HWND, std::int32_t, std::intptr_t); +REX_W32_IMPORT(std::int32_t, ShowCursor, REX::W32::BOOL); + +namespace REX::W32 +{ + bool GetClientRect(HWND a_wnd, RECT* a_rect) noexcept + { + return ::W32_IMPL_GetClientRect(a_wnd, a_rect); + } + + std::int32_t GetKeyNameTextA(std::int32_t a_param, char* a_buf, std::int32_t a_bufLen) noexcept + { + return ::W32_IMPL_GetKeyNameTextA(a_param, a_buf, a_bufLen); + } + + std::int32_t GetKeyNameTextW(std::int32_t a_param, wchar_t* a_buf, std::int32_t a_bufLen) noexcept + { + return ::W32_IMPL_GetKeyNameTextW(a_param, a_buf, a_bufLen); + } + + std::int16_t GetKeyState(std::int32_t a_key) noexcept + { + return ::W32_IMPL_GetKeyState(a_key); + } + + bool GetWindowRect(HWND a_wnd, RECT* a_rect) noexcept + { + return ::W32_IMPL_GetWindowRect(a_wnd, a_rect); + } + + std::int32_t MessageBoxA(HWND a_wnd, const char* a_text, const char* a_caption, std::uint32_t a_type) noexcept + { + return ::W32_IMPL_MessageBoxA(a_wnd, a_text, a_caption, a_type); + } + + std::int32_t MessageBoxW(HWND a_wnd, const wchar_t* a_text, const wchar_t* a_caption, std::uint32_t a_type) noexcept + { + return ::W32_IMPL_MessageBoxW(a_wnd, a_text, a_caption, a_type); + } + + std::intptr_t SetWindowLongPtrA(HWND a_wnd, std::int32_t a_index, std::intptr_t a_newPtr) noexcept + { + return ::W32_IMPL_SetWindowLongPtrA(a_wnd, a_index, a_newPtr); + } + + std::int32_t ShowCursor(bool a_show) noexcept + { + return ::W32_IMPL_ShowCursor(a_show); + } +} + +// VERSION + +REX_W32_IMPORT(REX::W32::BOOL, GetFileVersionInfoA, const char*, std::uint32_t, std::uint32_t, void*); +REX_W32_IMPORT(REX::W32::BOOL, GetFileVersionInfoW, const wchar_t*, std::uint32_t, std::uint32_t, void*); +REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeA, const char*, std::uint32_t*); +//REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeExA, std::uint32_t, const char*, std::uint32_t*); +REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeExW, std::uint32_t, const wchar_t*, std::uint32_t*); +REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeW, const wchar_t*, std::uint32_t*); +REX_W32_IMPORT(REX::W32::BOOL, VerQueryValueA, const void*, const char*, void**, std::uint32_t*); +REX_W32_IMPORT(REX::W32::BOOL, VerQueryValueW, const void*, const wchar_t*, void**, std::uint32_t*); + +namespace REX::W32 +{ + bool GetFileVersionInfoA(const char* a_name, std::uint32_t a_handle, std::uint32_t a_dataLen, void* a_data) noexcept + { + return ::W32_IMPL_GetFileVersionInfoA(a_name, a_handle, a_dataLen, a_data); + } + + std::uint32_t GetFileVersionInfoSizeA(const char* a_name, std::uint32_t* a_handle) noexcept + { + return ::W32_IMPL_GetFileVersionInfoSizeA(a_name, a_handle); + } + + /* + std::uint32_t GetFileVersionInfoSizeExA(std::uint32_t a_flags, const char* a_name, std::uint32_t* a_handle) noexcept + { + return ::W32_IMPL_GetFileVersionInfoSizeExA(a_flags, a_name, a_handle); + } + */ + + std::uint32_t GetFileVersionInfoSizeExW(std::uint32_t a_flags, const wchar_t* a_name, std::uint32_t* a_handle) noexcept + { + return ::W32_IMPL_GetFileVersionInfoSizeExW(a_flags, a_name, a_handle); + } + + std::uint32_t GetFileVersionInfoSizeW(const wchar_t* a_name, std::uint32_t* a_handle) noexcept + { + return ::W32_IMPL_GetFileVersionInfoSizeW(a_name, a_handle); + } + + bool GetFileVersionInfoW(const wchar_t* a_name, std::uint32_t a_handle, std::uint32_t a_dataLen, void* a_data) noexcept + { + return ::W32_IMPL_GetFileVersionInfoW(a_name, a_handle, a_dataLen, a_data); + } + + bool VerQueryValueA(const void* a_block, const char* a_subBlock, void** a_buf, std::uint32_t* a_bufLen) noexcept + { + return ::W32_IMPL_VerQueryValueA(a_block, a_subBlock, a_buf, a_bufLen); + } + + bool VerQueryValueW(const void* a_block, const wchar_t* a_subBlock, void** a_buf, std::uint32_t* a_bufLen) noexcept + { + return ::W32_IMPL_VerQueryValueW(a_block, a_subBlock, a_buf, a_bufLen); + } +} diff --git a/CommonLibF4/src/REX/W32/ADVAPI32.cpp b/CommonLibF4/src/REX/W32/ADVAPI32.cpp deleted file mode 100644 index a84eb0b0..00000000 --- a/CommonLibF4/src/REX/W32/ADVAPI32.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "REX/W32/ADVAPI32.h" - -REX_W32_IMPORT(std::int32_t, RegGetValueA, REX::W32::HKEY, const char*, const char*, std::uint32_t, std::uint32_t*, void*, std::uint32_t*); -REX_W32_IMPORT(std::int32_t, RegGetValueW, REX::W32::HKEY, const wchar_t*, const wchar_t*, std::uint32_t, std::uint32_t*, void*, std::uint32_t*); - -namespace REX::W32 -{ - std::int32_t RegGetValueA(HKEY a_key, const char* a_subKey, const char* a_value, std::uint32_t a_flags, std::uint32_t* a_type, void* a_data, std::uint32_t* a_dataLen) - { - return ::W32_IMPL_RegGetValueA(a_key, a_subKey, a_value, a_flags, a_type, a_data, a_dataLen); - } - - std::int32_t RegGetValueW(HKEY a_key, const wchar_t* a_subKey, const wchar_t* a_value, std::uint32_t a_flags, std::uint32_t* a_type, void* a_data, std::uint32_t* a_dataLen) - { - return ::W32_IMPL_RegGetValueW(a_key, a_subKey, a_value, a_flags, a_type, a_data, a_dataLen); - } -} diff --git a/CommonLibF4/src/REX/W32/BCRYPT.cpp b/CommonLibF4/src/REX/W32/BCRYPT.cpp deleted file mode 100644 index 787c3453..00000000 --- a/CommonLibF4/src/REX/W32/BCRYPT.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "REX/W32/BCRYPT.h" - -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptOpenAlgorithmProvider, REX::W32::BCRYPT_ALG_HANDLE*, const wchar_t*, const wchar_t*, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptCloseAlgorithmProvider, REX::W32::BCRYPT_ALG_HANDLE, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptCreateHash, REX::W32::BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE*, std::uint8_t*, std::uint32_t, std::uint8_t*, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptDestroyHash, REX::W32::BCRYPT_HASH_HANDLE); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptFinishHash, REX::W32::BCRYPT_HASH_HANDLE, std::uint8_t*, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptGetProperty, REX::W32::BCRYPT_HANDLE, const wchar_t*, std::uint8_t*, std::uint32_t, std::uint32_t*, std::uint32_t); -REX_W32_IMPORT(REX::W32::NTSTATUS, BCryptHashData, REX::W32::BCRYPT_HASH_HANDLE, std::uint8_t*, std::uint32_t, std::uint32_t); - -namespace REX::W32 -{ - NTSTATUS BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE* a_algorithm, const wchar_t* a_id, const wchar_t* a_impl, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptOpenAlgorithmProvider(a_algorithm, a_id, a_impl, a_flags); - } - - NTSTATUS BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE a_algorithm, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptCloseAlgorithmProvider(a_algorithm, a_flags); - } - - NTSTATUS BCryptCreateHash(BCRYPT_ALG_HANDLE a_algorithm, BCRYPT_HASH_HANDLE* a_hash, std::uint8_t* a_hashObject, std::uint32_t a_hashObjectSize, std::uint8_t* a_secret, std::uint32_t a_secretSize, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptCreateHash(a_algorithm, a_hash, a_hashObject, a_hashObjectSize, a_secret, a_secretSize, a_flags); - } - - NTSTATUS BCryptDestroyHash(BCRYPT_HASH_HANDLE a_hash) - { - return ::W32_IMPL_BCryptDestroyHash(a_hash); - } - - NTSTATUS BCryptFinishHash(BCRYPT_HASH_HANDLE a_hash, std::uint8_t* a_output, std::uint32_t a_outputSize, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptFinishHash(a_hash, a_output, a_outputSize, a_flags); - } - - NTSTATUS BCryptGetProperty(BCRYPT_HANDLE a_object, const wchar_t* a_property, std::uint8_t* a_output, std::uint32_t a_outputSize, std::uint32_t* a_result, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptGetProperty(a_object, a_property, a_output, a_outputSize, a_result, a_flags); - } - - NTSTATUS BCryptHashData(BCRYPT_HASH_HANDLE a_hash, std::uint8_t* a_input, std::uint32_t a_inputSize, std::uint32_t a_flags) - { - return ::W32_IMPL_BCryptHashData(a_hash, a_input, a_inputSize, a_flags); - } -} diff --git a/CommonLibF4/src/REX/W32/D3D11.cpp b/CommonLibF4/src/REX/W32/D3D11.cpp deleted file mode 100644 index f69676ae..00000000 --- a/CommonLibF4/src/REX/W32/D3D11.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "REX/W32/D3D11.h" - -REX_W32_IMPORT(std::int32_t, D3D11CreateDevice, REX::W32::IDXGIAdapter*, REX::W32::D3D_DRIVER_TYPE, REX::W32::HMODULE, std::uint32_t, const REX::W32::D3D_FEATURE_LEVEL*, std::uint32_t, std::uint32_t, REX::W32::ID3D11Device**, REX::W32::D3D_FEATURE_LEVEL*, REX::W32::ID3D11DeviceContext**); -REX_W32_IMPORT(std::int32_t, D3D11CreateDeviceAndSwapChain, REX::W32::IDXGIAdapter*, REX::W32::D3D_DRIVER_TYPE, REX::W32::HMODULE, std::uint32_t, const REX::W32::D3D_FEATURE_LEVEL*, std::uint32_t, std::uint32_t, const REX::W32::DXGI_SWAP_CHAIN_DESC*, REX::W32::IDXGISwapChain**, REX::W32::ID3D11Device**, REX::W32::D3D_FEATURE_LEVEL*, REX::W32::ID3D11DeviceContext**); - -namespace REX::W32 -{ - HRESULT D3D11CreateDevice(IDXGIAdapter* a_adapter, D3D_DRIVER_TYPE a_driverType, HMODULE a_software, std::uint32_t a_flags, const D3D_FEATURE_LEVEL* a_pFeatureLevels, std::uint32_t a_featureLevels, std::uint32_t a_sdkVersion, ID3D11Device** a_device, D3D_FEATURE_LEVEL* a_pFeatureLevel, ID3D11DeviceContext** a_immediateContext) noexcept - { - return ::W32_IMPL_D3D11CreateDevice(a_adapter, a_driverType, a_software, a_flags, a_pFeatureLevels, a_featureLevels, a_sdkVersion, a_device, a_pFeatureLevel, a_immediateContext); - } - - HRESULT D3D11CreateDeviceAndSwapChain(IDXGIAdapter* a_adapter, D3D_DRIVER_TYPE a_driverType, HMODULE a_software, std::uint32_t a_flags, const D3D_FEATURE_LEVEL* a_pFeatureLevels, std::uint32_t a_featureLevels, std::uint32_t a_sdkVersion, const DXGI_SWAP_CHAIN_DESC* a_swapChainDesc, IDXGISwapChain** a_swapChain, ID3D11Device** a_device, D3D_FEATURE_LEVEL* a_pFeatureLevel, ID3D11DeviceContext** a_immediateContext) noexcept - { - return ::W32_IMPL_D3D11CreateDeviceAndSwapChain(a_adapter, a_driverType, a_software, a_flags, a_pFeatureLevels, a_featureLevels, a_sdkVersion, a_swapChainDesc, a_swapChain, a_device, a_pFeatureLevel, a_immediateContext); - } -} diff --git a/CommonLibF4/src/REX/W32/D3DCOMPILER.cpp b/CommonLibF4/src/REX/W32/D3DCOMPILER.cpp deleted file mode 100644 index d4964425..00000000 --- a/CommonLibF4/src/REX/W32/D3DCOMPILER.cpp +++ /dev/null @@ -1,155 +0,0 @@ -#include "REX/W32/D3DCOMPILER.h" - -REX_W32_IMPORT(std::int32_t, D3DCompile, const void*, std::size_t, const char*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, const char*, const char*, std::uint32_t, std::uint32_t, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCompile2, const void*, std::size_t, const char*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, const char*, const char*, std::uint32_t, std::uint32_t, std::uint32_t, const void*, std::size_t, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCompileFromFile, const wchar_t*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, const char*, const char*, std::uint32_t, std::uint32_t, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCompressShaders, std::uint32_t, REX::W32::D3D_SHADER_DATA*, std::uint32_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCreateBlob, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DCreateFunctionLinkingGraph, std::uint32_t, REX::W32::ID3D11FunctionLinkingGraph**); -REX_W32_IMPORT(std::int32_t, D3DCreateLinker, REX::W32::ID3D11Linker**); -REX_W32_IMPORT(std::int32_t, D3DDecompressShaders, const void*, std::size_t, std::uint32_t, std::uint32_t, std::uint32_t*, std::uint32_t, REX::W32::ID3DBlob**, std::uint32_t*); -REX_W32_IMPORT(std::int32_t, D3DDisassemble, const void*, std::size_t, std::uint32_t, const char*, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DDisassemble10Effect, REX::W32::ID3D10Effect*, std::uint32_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DDisassembleRegion, const void*, std::size_t, std::uint32_t, const char*, std::size_t, std::size_t, std::size_t*, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetBlobPart, const void*, std::size_t, REX::W32::D3D_BLOB_PART, std::uint32_t a_flags, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetDebugInfo, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetInputSignatureBlob, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetInputAndOutputSignatureBlob, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetOutputSignatureBlob, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DGetTraceInstructionOffsets, const void*, std::size_t, std::uint32_t, std::size_t, std::size_t, std::size_t*, std::size_t*); -REX_W32_IMPORT(std::int32_t, D3DLoadModule, const void*, std::size_t, REX::W32::ID3D11Module**); -REX_W32_IMPORT(std::int32_t, D3DPreprocess, const void*, std::size_t, const char*, const REX::W32::D3D_SHADER_MACRO*, REX::W32::ID3DInclude*, REX::W32::ID3DBlob**, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DReadFileToBlob, const wchar_t*, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DReflect, const void*, std::size_t, const REX::W32::IID&, void**); -REX_W32_IMPORT(std::int32_t, D3DReflectLibrary, const void*, std::size_t, const REX::W32::IID&, void**); -REX_W32_IMPORT(std::int32_t, D3DSetBlobPart, const void*, std::size_t, REX::W32::D3D_BLOB_PART, std::uint32_t, const void*, std::size_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DStripShader, const void*, std::size_t, std::uint32_t, REX::W32::ID3DBlob**); -REX_W32_IMPORT(std::int32_t, D3DWriteBlobToFile, REX::W32::ID3DBlob*, const wchar_t*, REX::W32::BOOL); - -namespace REX::W32 -{ - HRESULT D3DCompile(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob** a_code, ID3DBlob** a_errorMsgs) - { - return ::W32_IMPL_D3DCompile(a_srcData, a_srcDataSize, a_sourceName, a_defines, a_include, a_entrypoint, a_target, a_flags1, a_flags2, a_code, a_errorMsgs); - } - - HRESULT D3DCompile2(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, std::uint32_t a_secondaryDataFlags, const void* a_secondaryData, std::size_t a_secondaryDataSize, ID3DBlob** a_code, ID3DBlob** a_errorMsgs) - { - return ::W32_IMPL_D3DCompile2(a_srcData, a_srcDataSize, a_sourceName, a_defines, a_include, a_entrypoint, a_target, a_flags1, a_flags2, a_secondaryDataFlags, a_secondaryData, a_secondaryDataSize, a_code, a_errorMsgs); - } - - HRESULT D3DCompileFromFile(const wchar_t* a_fileName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, const char* a_entrypoint, const char* a_target, std::uint32_t a_flags1, std::uint32_t a_flags2, ID3DBlob** a_code, ID3DBlob** a_errorMsgs) - { - return ::W32_IMPL_D3DCompileFromFile(a_fileName, a_defines, a_include, a_entrypoint, a_target, a_flags1, a_flags2, a_code, a_errorMsgs); - } - - HRESULT D3DCompressShaders(std::uint32_t a_numShaders, D3D_SHADER_DATA* a_shaderData, std::uint32_t a_flags, ID3DBlob** a_compressedData) - { - return ::W32_IMPL_D3DCompressShaders(a_numShaders, a_shaderData, a_flags, a_compressedData); - } - - HRESULT D3DCreateBlob(std::size_t a_size, ID3DBlob** a_blob) - { - return ::W32_IMPL_D3DCreateBlob(a_size, a_blob); - } - - HRESULT D3DCreateFunctionLinkingGraph(std::uint32_t a_flags, ID3D11FunctionLinkingGraph** a_functionLinkingGraph) - { - return ::W32_IMPL_D3DCreateFunctionLinkingGraph(a_flags, a_functionLinkingGraph); - } - - HRESULT D3DCreateLinker(ID3D11Linker** a_linker) - { - return ::W32_IMPL_D3DCreateLinker(a_linker); - } - - HRESULT D3DDecompressShaders(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_numShaders, std::uint32_t a_startIndex, std::uint32_t* a_indices, std::uint32_t a_flags, ID3DBlob** a_shaders, std::uint32_t* a_totalShaders) - { - return ::W32_IMPL_D3DDecompressShaders(a_srcData, a_srcDataSize, a_numShaders, a_startIndex, a_indices, a_flags, a_shaders, a_totalShaders); - } - - HRESULT D3DDisassemble(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char* a_comments, ID3DBlob** a_disassembly) - { - return ::W32_IMPL_D3DDisassemble(a_srcData, a_srcDataSize, a_flags, a_comments, a_disassembly); - } - - HRESULT D3DDisassemble10Effect(ID3D10Effect* a_effect, std::uint32_t a_flags, ID3DBlob** a_disassembly) - { - return ::W32_IMPL_D3DDisassemble10Effect(a_effect, a_flags, a_disassembly); - } - - HRESULT D3DDisassembleRegion(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, const char* a_comments, std::size_t a_startByteOffset, std::size_t a_numInsts, std::size_t* a_finishByteOffset, ID3DBlob** a_disassembly) - { - return ::W32_IMPL_D3DDisassembleRegion(a_srcData, a_srcDataSize, a_flags, a_comments, a_startByteOffset, a_numInsts, a_finishByteOffset, a_disassembly); - } - - HRESULT D3DGetBlobPart(const void* a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, ID3DBlob** a_part) - { - return ::W32_IMPL_D3DGetBlobPart(a_srcData, a_srcDataSize, a_partType, a_flags, a_part); - } - - HRESULT D3DGetDebugInfo(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_debugInfo) - { - return ::W32_IMPL_D3DGetDebugInfo(a_srcData, a_srcDataSize, a_debugInfo); - } - - HRESULT D3DGetInputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob) - { - return ::W32_IMPL_D3DGetInputSignatureBlob(a_srcData, a_srcDataSize, a_signatureBlob); - } - - HRESULT D3DGetInputAndOutputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob) - { - return ::W32_IMPL_D3DGetInputAndOutputSignatureBlob(a_srcData, a_srcDataSize, a_signatureBlob); - } - - HRESULT D3DGetOutputSignatureBlob(const void* a_srcData, std::size_t a_srcDataSize, ID3DBlob** a_signatureBlob) - { - return ::W32_IMPL_D3DGetOutputSignatureBlob(a_srcData, a_srcDataSize, a_signatureBlob); - } - - HRESULT D3DGetTraceInstructionOffsets(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_flags, std::size_t a_startInstIndex, std::size_t a_numInsts, std::size_t* a_offsets, std::size_t* a_totalInsts) - { - return ::W32_IMPL_D3DGetTraceInstructionOffsets(a_srcData, a_srcDataSize, a_flags, a_startInstIndex, a_numInsts, a_offsets, a_totalInsts); - } - - HRESULT D3DLoadModule(const void* a_srcData, std::size_t a_srcDataSize, ID3D11Module** a_module) - { - return ::W32_IMPL_D3DLoadModule(a_srcData, a_srcDataSize, a_module); - } - - HRESULT D3DPreprocess(const void* a_srcData, std::size_t a_srcDataSize, const char* a_sourceName, const D3D_SHADER_MACRO* a_defines, ID3DInclude* a_include, ID3DBlob** a_codeText, ID3DBlob** a_errorMsgs) - { - return ::W32_IMPL_D3DPreprocess(a_srcData, a_srcDataSize, a_sourceName, a_defines, a_include, a_codeText, a_errorMsgs); - } - - HRESULT D3DReadFileToBlob(const wchar_t* a_fileName, ID3DBlob** a_contents) - { - return ::W32_IMPL_D3DReadFileToBlob(a_fileName, a_contents); - } - - HRESULT D3DReflect(const void* a_srcData, std::size_t a_srcDataSize, const IID& a_iid, void** a_reflector) - { - return ::W32_IMPL_D3DReflect(a_srcData, a_srcDataSize, a_iid, a_reflector); - } - - HRESULT D3DReflectLibrary(const void* a_srcData, std::size_t a_srcDataSize, const IID& a_iid, void** a_reflector) - { - return ::W32_IMPL_D3DReflectLibrary(a_srcData, a_srcDataSize, a_iid, a_reflector); - } - - HRESULT D3DSetBlobPart(const void* a_srcData, std::size_t a_srcDataSize, D3D_BLOB_PART a_partType, std::uint32_t a_flags, const void* a_part, std::size_t a_partSize, ID3DBlob** a_newShader) - { - return ::W32_IMPL_D3DSetBlobPart(a_srcData, a_srcDataSize, a_partType, a_flags, a_part, a_partSize, a_newShader); - } - - HRESULT D3DStripShader(const void* a_srcData, std::size_t a_srcDataSize, std::uint32_t a_stripFlags, ID3DBlob** a_strippedBlob) - { - return ::W32_IMPL_D3DStripShader(a_srcData, a_srcDataSize, a_stripFlags, a_strippedBlob); - } - - HRESULT D3DWriteBlobToFile(ID3DBlob* a_blob, const wchar_t* a_fileName, bool a_overwrite) - { - return ::W32_IMPL_D3DWriteBlobToFile(a_blob, a_fileName, static_cast(a_overwrite)); - } -} diff --git a/CommonLibF4/src/REX/W32/DBGHELP.cpp b/CommonLibF4/src/REX/W32/DBGHELP.cpp deleted file mode 100644 index dc532bc3..00000000 --- a/CommonLibF4/src/REX/W32/DBGHELP.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "REX/W32/DBGHELP.h" - -REX_W32_IMPORT(std::uint32_t, UnDecorateSymbolName, const char*, char*, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, UnDecorateSymbolNameW, const wchar_t*, wchar_t*, std::uint32_t, std::uint32_t); - -namespace REX::W32 -{ - std::uint32_t UnDecorateSymbolName(const char* a_name, char* a_buf, std::uint32_t a_bufLen, std::uint32_t a_flags) noexcept - { - return ::W32_IMPL_UnDecorateSymbolName(a_name, a_buf, a_bufLen, a_flags); - } - - std::uint32_t UnDecorateSymbolNameW(const wchar_t* a_name, wchar_t* a_buf, std::uint32_t a_bufLen, std::uint32_t a_flags) noexcept - { - return ::W32_IMPL_UnDecorateSymbolNameW(a_name, a_buf, a_bufLen, a_flags); - } -} diff --git a/CommonLibF4/src/REX/W32/DXGI.cpp b/CommonLibF4/src/REX/W32/DXGI.cpp deleted file mode 100644 index 0d96643d..00000000 --- a/CommonLibF4/src/REX/W32/DXGI.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "REX/W32/DXGI.h" - -REX_W32_IMPORT(std::int32_t, CreateDXGIFactory, const IID&, void**); -REX_W32_IMPORT(std::int32_t, CreateDXGIFactory1, const IID&, void**); - -namespace REX::W32 -{ - HRESULT CreateDXGIFactory(const IID& a_iid, void** a_factory) noexcept - { - return ::W32_IMPL_CreateDXGIFactory(a_iid, a_factory); - } - - HRESULT CreateDXGIFactory1(const IID& a_iid, void** a_factory) noexcept - { - return ::W32_IMPL_CreateDXGIFactory1(a_iid, a_factory); - } -} diff --git a/CommonLibF4/src/REX/W32/KERNEL32.cpp b/CommonLibF4/src/REX/W32/KERNEL32.cpp deleted file mode 100644 index 1ed810e2..00000000 --- a/CommonLibF4/src/REX/W32/KERNEL32.cpp +++ /dev/null @@ -1,479 +0,0 @@ -#include "REX/W32/KERNEL32.h" - -REX_W32_IMPORT(REX::W32::BOOL, CloseHandle, REX::W32::HANDLE); -REX_W32_IMPORT(REX::W32::HANDLE, CreateFileMappingA, REX::W32::HANDLE, REX::W32::SECURITY_ATTRIBUTES*, std::uint32_t, std::uint32_t, std::uint32_t, const char*); -REX_W32_IMPORT(REX::W32::HANDLE, CreateFileMappingW, REX::W32::HANDLE, REX::W32::SECURITY_ATTRIBUTES*, std::uint32_t, std::uint32_t, std::uint32_t, const wchar_t*); -REX_W32_IMPORT(REX::W32::BOOL, CreateProcessA, const char*, char*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::BOOL, std::uint32_t, void*, const char*, REX::W32::STARTUPINFOA*, REX::W32::PROCESS_INFORMATION*); -REX_W32_IMPORT(REX::W32::BOOL, CreateProcessW, const wchar_t*, wchar_t*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::SECURITY_ATTRIBUTES*, REX::W32::BOOL, std::uint32_t, void*, const wchar_t*, REX::W32::STARTUPINFOW*, REX::W32::PROCESS_INFORMATION*); -REX_W32_IMPORT(REX::W32::HANDLE, CreateRemoteThread, REX::W32::HANDLE, REX::W32::SECURITY_ATTRIBUTES*, std::size_t, REX::W32::THREAD_START_ROUTINE*, void*, std::uint32_t, std::uint32_t*); -REX_W32_IMPORT(REX::W32::HANDLE, CreateSemaphoreA, REX::W32::SECURITY_ATTRIBUTES*, std::int32_t, std::int32_t, const char*); -REX_W32_IMPORT(REX::W32::HANDLE, CreateThread, REX::W32::SECURITY_ATTRIBUTES*, std::size_t, REX::W32::THREAD_START_ROUTINE*, void*, std::uint32_t, std::uint32_t*); -REX_W32_IMPORT(void, DeleteCriticalSection, REX::W32::CRITICAL_SECTION*); -REX_W32_IMPORT(void, EnterCriticalSection, REX::W32::CRITICAL_SECTION*); -REX_W32_IMPORT(std::uint32_t, ExpandEnvironmentStringsA, const char*, char*, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, ExpandEnvironmentStringsW, const wchar_t*, wchar_t*, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, FindClose, REX::W32::HANDLE); -REX_W32_IMPORT(REX::W32::HANDLE, FindFirstFileA, const char*, REX::W32::WIN32_FIND_DATAA*); -REX_W32_IMPORT(REX::W32::HANDLE, FindFirstFileW, const wchar_t*, REX::W32::WIN32_FIND_DATAW*); -REX_W32_IMPORT(REX::W32::BOOL, FindNextFileA, REX::W32::HANDLE, REX::W32::WIN32_FIND_DATAA*); -REX_W32_IMPORT(REX::W32::BOOL, FindNextFileW, REX::W32::HANDLE, REX::W32::WIN32_FIND_DATAW*); -REX_W32_IMPORT(REX::W32::BOOL, FlushInstructionCache, REX::W32::HANDLE, const void*, std::size_t); -REX_W32_IMPORT(REX::W32::BOOL, FreeLibrary, REX::W32::HMODULE); -REX_W32_IMPORT(REX::W32::BOOL, GetComputerNameA, char*, std::uint32_t*); -REX_W32_IMPORT(REX::W32::BOOL, GetComputerNameW, wchar_t*, std::uint32_t*); -REX_W32_IMPORT(REX::W32::HANDLE, GetCurrentProcess); -REX_W32_IMPORT(std::uint32_t, GetCurrentThreadId); -REX_W32_IMPORT(std::uint32_t, GetEnvironmentVariableA, const char*, char*, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, GetEnvironmentVariableW, const wchar_t*, wchar_t*, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, GetLastError); -REX_W32_IMPORT(std::uint32_t, GetModuleFileNameA, REX::W32::HMODULE, char*, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, GetModuleFileNameW, REX::W32::HMODULE, wchar_t*, std::uint32_t); -REX_W32_IMPORT(REX::W32::HMODULE, GetModuleHandleA, const char*); -REX_W32_IMPORT(REX::W32::HMODULE, GetModuleHandleW, const wchar_t*); -REX_W32_IMPORT(std::uint32_t, GetPrivateProfileStringA, const char*, const char*, const char*, char*, std::uint32_t, const char*); -REX_W32_IMPORT(std::uint32_t, GetPrivateProfileStringW, const wchar_t*, const wchar_t*, const wchar_t*, wchar_t*, std::uint32_t, const wchar_t*); -REX_W32_IMPORT(void*, GetProcAddress, REX::W32::HMODULE, const char*); -REX_W32_IMPORT(void, GetSystemInfo, REX::W32::SYSTEM_INFO*); -REX_W32_IMPORT(REX::W32::BOOL, InitializeCriticalSectionAndSpinCount, REX::W32::CRITICAL_SECTION*, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, IsDebuggerPresent); -REX_W32_IMPORT(std::int32_t, LCMapStringEx, const wchar_t*, std::uint32_t, const wchar_t*, std::int32_t, wchar_t*, std::int32_t, REX::W32::NLSVERSIONINFO*, void*, std::intptr_t); -REX_W32_IMPORT(void, LeaveCriticalSection, REX::W32::CRITICAL_SECTION*); -REX_W32_IMPORT(REX::W32::HMODULE, LoadLibraryA, const char*); -REX_W32_IMPORT(REX::W32::HMODULE, LoadLibraryW, const wchar_t*); -REX_W32_IMPORT(void*, MapViewOfFile, REX::W32::HANDLE, std::uint32_t, std::uint32_t, std::uint32_t, std::size_t); -REX_W32_IMPORT(void*, MapViewOfFileEx, REX::W32::HANDLE, std::uint32_t, std::uint32_t, std::uint32_t, std::size_t, void*); -REX_W32_IMPORT(std::int32_t, MultiByteToWideChar, std::uint32_t, std::uint32_t, const char*, std::int32_t, wchar_t*, std::int32_t); -REX_W32_IMPORT(REX::W32::HANDLE, OpenFileMappingA, std::uint32_t, REX::W32::BOOL, const char*); -REX_W32_IMPORT(REX::W32::HANDLE, OpenFileMappingW, std::uint32_t, REX::W32::BOOL, const wchar_t*); -REX_W32_IMPORT(void, OutputDebugStringA, const char*); -REX_W32_IMPORT(void, OutputDebugStringW, const wchar_t*); -REX_W32_IMPORT(REX::W32::BOOL, QueryPerformanceCounter, std::int64_t*); -REX_W32_IMPORT(REX::W32::BOOL, QueryPerformanceFrequency, std::int64_t*); -REX_W32_IMPORT(std::uint32_t, ResumeThread, REX::W32::HANDLE); -REX_W32_IMPORT(REX::W32::BOOL, SetEnvironmentVariableA, const char*, const char*); -REX_W32_IMPORT(REX::W32::BOOL, SetEnvironmentVariableW, const wchar_t*, const wchar_t*); -REX_W32_IMPORT(void, Sleep, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, TerminateProcess, REX::W32::HANDLE, std::uint32_t); -REX_W32_IMPORT(void*, TlsGetValue, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, TlsSetValue, std::uint32_t, void*); -REX_W32_IMPORT(REX::W32::BOOL, UnmapViewOfFile, const void*); -REX_W32_IMPORT(void*, VirtualAlloc, void*, std::size_t, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(void*, VirtualAllocEx, REX::W32::HANDLE, void*, std::size_t, std::uint32_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, VirtualFree, void*, std::size_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, VirtualFreeEx, REX::W32::HANDLE, void*, std::size_t, std::uint32_t); -REX_W32_IMPORT(REX::W32::BOOL, VirtualProtect, void*, std::size_t, std::uint32_t, std::uint32_t*); -REX_W32_IMPORT(REX::W32::BOOL, VirtualProtectEx, REX::W32::HANDLE, void*, std::size_t, std::uint32_t, std::uint32_t*); -REX_W32_IMPORT(std::size_t, VirtualQuery, const void*, MEMORY_BASIC_INFORMATION*, std::size_t); -REX_W32_IMPORT(std::size_t, VirtualQueryEx, REX::W32::HANDLE, const void*, MEMORY_BASIC_INFORMATION*, std::size_t); -REX_W32_IMPORT(std::uint32_t, WaitForSingleObject, REX::W32::HANDLE, std::uint32_t); -REX_W32_IMPORT(std::uint32_t, WaitForSingleObjectEx, REX::W32::HANDLE, std::uint32_t, REX::W32::BOOL); -REX_W32_IMPORT(std::int32_t, WideCharToMultiByte, std::uint32_t, std::uint32_t, const wchar_t*, std::int32_t, char*, std::int32_t, const char*, std::int32_t*); -REX_W32_IMPORT(REX::W32::BOOL, WriteProcessMemory, REX::W32::HANDLE, void*, const void*, std::size_t, std::size_t*); - -extern "C" REX::W32::IMAGE_DOS_HEADER __ImageBase; - -namespace REX::W32 -{ - bool CloseHandle(HANDLE a_handle) noexcept - { - return ::W32_IMPL_CloseHandle(a_handle); - } - - HANDLE CreateFileMappingA(HANDLE a_file, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_protect, std::uint32_t a_maxSizeHigh, std::uint32_t a_maxSizeLow, const char* a_name) noexcept - { - return ::W32_IMPL_CreateFileMappingA(a_file, a_attributes, a_protect, a_maxSizeHigh, a_maxSizeLow, a_name); - } - - HANDLE CreateFileMappingW(HANDLE a_file, SECURITY_ATTRIBUTES* a_attributes, std::uint32_t a_protect, std::uint32_t a_maxSizeHigh, std::uint32_t a_maxSizeLow, const wchar_t* a_name) noexcept - { - return ::W32_IMPL_CreateFileMappingW(a_file, a_attributes, a_protect, a_maxSizeHigh, a_maxSizeLow, a_name); - } - - bool CreateProcessA(const char* a_name, char* a_cmd, SECURITY_ATTRIBUTES* a_procAttr, SECURITY_ATTRIBUTES* a_threadAttr, bool a_inheritHandles, std::uint32_t a_flags, void* a_env, const char* a_curDir, STARTUPINFOA* a_startInfo, PROCESS_INFORMATION* a_procInfo) noexcept - { - return ::W32_IMPL_CreateProcessA(a_name, a_cmd, a_procAttr, a_threadAttr, a_inheritHandles, a_flags, a_env, a_curDir, a_startInfo, a_procInfo); - } - - bool CreateProcessW(const wchar_t* a_name, wchar_t* a_cmd, SECURITY_ATTRIBUTES* a_procAttr, SECURITY_ATTRIBUTES* a_threadAttr, bool a_inheritHandles, std::uint32_t a_flags, void* a_env, const wchar_t* a_curDir, STARTUPINFOW* a_startInfo, PROCESS_INFORMATION* a_procInfo) noexcept - { - return ::W32_IMPL_CreateProcessW(a_name, a_cmd, a_procAttr, a_threadAttr, a_inheritHandles, a_flags, a_env, a_curDir, a_startInfo, a_procInfo); - } - - HANDLE CreateRemoteThread(HANDLE a_process, SECURITY_ATTRIBUTES* a_threadAttr, std::size_t a_stackSize, THREAD_START_ROUTINE* a_startAddr, void* a_param, std::uint32_t a_flags, std::uint32_t* a_threadID) noexcept - { - return ::W32_IMPL_CreateRemoteThread(a_process, a_threadAttr, a_stackSize, a_startAddr, a_param, a_flags, a_threadID); - } - - HANDLE CreateSemaphoreA(SECURITY_ATTRIBUTES* a_semaphoreAttr, std::int32_t a_initCount, std::int32_t a_maxCount, const char* a_name) - { - return ::W32_IMPL_CreateSemaphoreA(a_semaphoreAttr, a_initCount, a_maxCount, a_name); - } - - HANDLE CreateThread(SECURITY_ATTRIBUTES* a_threadAttr, std::size_t a_stackSize, THREAD_START_ROUTINE* a_startAddr, void* a_param, std::uint32_t a_flags, std::uint32_t* a_threadID) noexcept - { - return ::W32_IMPL_CreateThread(a_threadAttr, a_stackSize, a_startAddr, a_param, a_flags, a_threadID); - } - - void DeleteCriticalSection(CRITICAL_SECTION* a_criticalSection) - { - ::W32_IMPL_DeleteCriticalSection(a_criticalSection); - } - - void EnterCriticalSection(CRITICAL_SECTION* a_criticalSection) - { - ::W32_IMPL_EnterCriticalSection(a_criticalSection); - } - - std::uint32_t ExpandEnvironmentStringsA(const char* a_src, char* a_dst, std::uint32_t a_dstLen) noexcept - { - return ::W32_IMPL_ExpandEnvironmentStringsA(a_src, a_dst, a_dstLen); - } - - std::uint32_t ExpandEnvironmentStringsW(const wchar_t* a_src, wchar_t* a_dst, std::uint32_t a_dstLen) noexcept - { - return ::W32_IMPL_ExpandEnvironmentStringsW(a_src, a_dst, a_dstLen); - } - - bool FindClose(HANDLE a_file) noexcept - { - return ::W32_IMPL_FindClose(a_file); - } - - HANDLE FindFirstFileA(const char* a_name, WIN32_FIND_DATAA* a_data) noexcept - { - return ::W32_IMPL_FindFirstFileA(a_name, a_data); - } - - HANDLE FindFirstFileW(const wchar_t* a_name, WIN32_FIND_DATAW* a_data) noexcept - { - return ::W32_IMPL_FindFirstFileW(a_name, a_data); - } - - bool FindNextFileA(HANDLE a_file, WIN32_FIND_DATAA* a_data) noexcept - { - return ::W32_IMPL_FindNextFileA(a_file, a_data); - } - - bool FindNextFileW(HANDLE a_file, WIN32_FIND_DATAW* a_data) noexcept - { - return ::W32_IMPL_FindNextFileW(a_file, a_data); - } - - bool FlushInstructionCache(HANDLE a_process, const void* a_baseAddr, std::size_t a_size) noexcept - { - return ::W32_IMPL_FlushInstructionCache(a_process, a_baseAddr, a_size); - } - - bool FreeLibrary(HMODULE a_module) noexcept - { - return ::W32_IMPL_FreeLibrary(a_module); - } - - bool GetComputerNameA(char* a_buffer, std::uint32_t* a_size) noexcept - { - return ::W32_IMPL_GetComputerNameA(a_buffer, a_size); - } - - bool GetComputerNameW(wchar_t* a_buffer, std::uint32_t* a_size) noexcept - { - return ::W32_IMPL_GetComputerNameW(a_buffer, a_size); - } - - HMODULE GetCurrentModule() noexcept - { - return reinterpret_cast(std::addressof(__ImageBase)); - } - - HANDLE GetCurrentProcess() noexcept - { - return ::W32_IMPL_GetCurrentProcess(); - } - - std::uint32_t GetCurrentThreadId() noexcept - { - return ::W32_IMPL_GetCurrentThreadId(); - } - - std::uint32_t GetEnvironmentVariableA(const char* a_name, char* a_buf, std::uint32_t a_bufLen) noexcept - { - return ::W32_IMPL_GetEnvironmentVariableA(a_name, a_buf, a_bufLen); - } - - std::uint32_t GetEnvironmentVariableW(const wchar_t* a_name, wchar_t* a_buf, std::uint32_t a_bufLen) noexcept - { - return ::W32_IMPL_GetEnvironmentVariableW(a_name, a_buf, a_bufLen); - } - - std::uint32_t GetLastError() noexcept - { - return ::W32_IMPL_GetLastError(); - } - - std::uint32_t GetModuleFileNameA(HMODULE a_module, char* a_name, std::uint32_t a_nameLen) noexcept - { - return ::W32_IMPL_GetModuleFileNameA(a_module, a_name, a_nameLen); - } - - std::uint32_t GetModuleFileNameW(HMODULE a_module, wchar_t* a_name, std::uint32_t a_nameLen) noexcept - { - return ::W32_IMPL_GetModuleFileNameW(a_module, a_name, a_nameLen); - } - - HMODULE GetModuleHandleA(const char* a_name) noexcept - { - return ::W32_IMPL_GetModuleHandleA(a_name); - } - - HMODULE GetModuleHandleW(const wchar_t* a_name) noexcept - { - return ::W32_IMPL_GetModuleHandleW(a_name); - } - - std::uint32_t GetPrivateProfileStringA(const char* a_app, const char* a_key, const char* a_default, char* a_buf, std::uint32_t a_bufLen, const char* a_name) noexcept - { - return ::W32_IMPL_GetPrivateProfileStringA(a_app, a_key, a_default, a_buf, a_bufLen, a_name); - } - - std::uint32_t GetPrivateProfileStringW(const wchar_t* a_app, const wchar_t* a_key, const wchar_t* a_default, wchar_t* a_buf, std::uint32_t a_bufLen, const wchar_t* a_name) noexcept - { - return ::W32_IMPL_GetPrivateProfileStringW(a_app, a_key, a_default, a_buf, a_bufLen, a_name); - } - - void* GetProcAddress(HMODULE a_module, const char* a_name) noexcept - { - return ::W32_IMPL_GetProcAddress(a_module, a_name); - } - - void GetSystemInfo(SYSTEM_INFO* a_info) noexcept - { - return ::W32_IMPL_GetSystemInfo(a_info); - } - - bool IMAGE_SNAP_BY_ORDINAL64(std::uint64_t a_ordinal) noexcept - { - return (a_ordinal & IMAGE_ORDINAL_FLAG64) != 0; - } - - IMAGE_SECTION_HEADER* IMAGE_FIRST_SECTION(const IMAGE_NT_HEADERS64* a_header) noexcept - { - constexpr auto opt = __builtin_offsetof(IMAGE_NT_HEADERS64, optionalHeader); - const auto optSize = a_header->fileHeader.optionalHeaderSize; - const auto section = reinterpret_cast(a_header) + opt + optSize; - return reinterpret_cast(section); - } - - bool InitializeCriticalSectionAndSpinCount(CRITICAL_SECTION* a_criticalSection, std::uint32_t a_spinCount) - { - return ::W32_IMPL_InitializeCriticalSectionAndSpinCount(a_criticalSection, a_spinCount); - } - - std::uint32_t InterlockedCompareExchange(volatile std::uint32_t* a_target, std::uint32_t a_value, std::uint32_t a_compare) noexcept - { - return _InterlockedCompareExchange((volatile long*)a_target, a_value, a_compare); - } - - std::uint64_t InterlockedCompareExchange64(volatile std::uint64_t* a_target, std::uint64_t a_value, std::uint64_t a_compare) noexcept - { - return _InterlockedCompareExchange64((volatile long long*)a_target, a_value, a_compare); - } - - std::uint32_t InterlockedDecrement(volatile std::uint32_t* a_target) noexcept - { - return _InterlockedDecrement((volatile long*)a_target); - } - - std::uint64_t InterlockedDecrement64(volatile std::uint64_t* a_target) noexcept - { - return _InterlockedDecrement64((volatile long long*)a_target); - } - - std::uint32_t InterlockedExchange(volatile std::uint32_t* a_target, std::uint32_t a_value) noexcept - { - return _InterlockedExchange((volatile long*)a_target, a_value); - } - - std::uint64_t InterlockedExchange64(volatile std::uint64_t* a_target, std::uint64_t a_value) noexcept - { - return _InterlockedExchange64((volatile long long*)a_target, a_value); - } - - std::uint32_t InterlockedIncrement(volatile std::uint32_t* a_target) noexcept - { - return _InterlockedIncrement((volatile long*)a_target); - } - - std::uint64_t InterlockedIncrement64(volatile std::uint64_t* a_target) noexcept - { - return _InterlockedIncrement64((volatile long long*)a_target); - } - - bool IsDebuggerPresent() noexcept - { - return ::W32_IMPL_IsDebuggerPresent(); - } - - std::int32_t LCMapStringEx(const wchar_t* a_locale, std::uint32_t a_flags, const wchar_t* a_src, std::int32_t a_srcLen, wchar_t* a_dst, std::int32_t a_dstLen, NLSVERSIONINFO* a_info, void* a_reserved, std::intptr_t a_sortHandle) noexcept - { - return ::W32_IMPL_LCMapStringEx(a_locale, a_flags, a_src, a_srcLen, a_dst, a_dstLen, a_info, a_reserved, a_sortHandle); - } - - void LeaveCriticalSection(CRITICAL_SECTION* a_criticalSection) - { - ::W32_IMPL_LeaveCriticalSection(a_criticalSection); - } - - HMODULE LoadLibraryA(const char* a_name) noexcept - { - return ::W32_IMPL_LoadLibraryA(a_name); - } - - HMODULE LoadLibraryW(const wchar_t* a_name) noexcept - { - return ::W32_IMPL_LoadLibraryW(a_name); - } - - void* MapViewOfFile(HANDLE a_object, std::uint32_t a_desiredAccess, std::uint32_t a_fileOffsetHi, std::uint32_t a_fileOffsetLo, std::size_t a_numBytes) noexcept - { - return ::W32_IMPL_MapViewOfFile(a_object, a_desiredAccess, a_fileOffsetHi, a_fileOffsetLo, a_numBytes); - } - - void* MapViewOfFileEx(HANDLE a_object, std::uint32_t a_desiredAccess, std::uint32_t a_fileOffsetHi, std::uint32_t a_fileOffsetLo, std::size_t a_numBytes, void* a_baseAddr) noexcept - { - return ::W32_IMPL_MapViewOfFileEx(a_object, a_desiredAccess, a_fileOffsetHi, a_fileOffsetLo, a_numBytes, a_baseAddr); - } - - std::int32_t MultiByteToWideChar(std::uint32_t a_codePage, std::uint32_t a_flags, const char* a_src, std::int32_t a_srcLen, wchar_t* a_dst, std::int32_t a_dstLen) noexcept - { - return ::W32_IMPL_MultiByteToWideChar(a_codePage, a_flags, a_src, a_srcLen, a_dst, a_dstLen); - } - - HANDLE OpenFileMappingA(std::uint32_t a_desiredAccess, bool a_inheritHandle, const char* a_name) noexcept - { - return ::W32_IMPL_OpenFileMappingA(a_desiredAccess, a_inheritHandle, a_name); - } - - HANDLE OpenFileMappingW(std::uint32_t a_desiredAccess, bool a_inheritHandle, const wchar_t* a_name) noexcept - { - return ::W32_IMPL_OpenFileMappingW(a_desiredAccess, a_inheritHandle, a_name); - } - - void OutputDebugStringA(const char* a_str) noexcept - { - ::W32_IMPL_OutputDebugStringA(a_str); - } - - void OutputDebugStringW(const wchar_t* a_str) noexcept - { - ::W32_IMPL_OutputDebugStringW(a_str); - } - - bool QueryPerformanceCounter(std::int64_t* a_counter) noexcept - { - return ::W32_IMPL_QueryPerformanceCounter(a_counter); - } - - bool QueryPerformanceFrequency(std::int64_t* a_frequency) noexcept - { - return ::W32_IMPL_QueryPerformanceFrequency(a_frequency); - } - - std::uint32_t ResumeThread(HANDLE a_handle) noexcept - { - return ::W32_IMPL_ResumeThread(a_handle); - } - - bool SetEnvironmentVariableA(const char* a_name, const char* a_value) noexcept - { - return ::W32_IMPL_SetEnvironmentVariableA(a_name, a_value); - } - - bool SetEnvironmentVariableW(const wchar_t* a_name, const wchar_t* a_value) noexcept - { - return ::W32_IMPL_SetEnvironmentVariableW(a_name, a_value); - } - - void Sleep(std::uint32_t a_milliseconds) noexcept - { - ::W32_IMPL_Sleep(a_milliseconds); - } - - bool TerminateProcess(HANDLE a_process, std::uint32_t a_exitCode) noexcept - { - return ::W32_IMPL_TerminateProcess(a_process, a_exitCode); - } - - void* TlsGetValue(std::uint32_t a_index) noexcept - { - return ::W32_IMPL_TlsGetValue(a_index); - } - - bool TlsSetValue(std::uint32_t a_index, void* a_value) noexcept - { - return ::W32_IMPL_TlsSetValue(a_index, a_value); - } - - bool UnmapViewOfFile(const void* a_baseAddress) noexcept - { - return ::W32_IMPL_UnmapViewOfFile(a_baseAddress); - } - - void* VirtualAlloc(void* a_address, std::size_t a_size, std::uint32_t a_type, std::uint32_t a_protect) noexcept - { - return ::W32_IMPL_VirtualAlloc(a_address, a_size, a_type, a_protect); - } - - void* VirtualAllocEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_type, std::uint32_t a_protect) noexcept - { - return ::W32_IMPL_VirtualAllocEx(a_process, a_address, a_size, a_type, a_protect); - } - - bool VirtualFree(void* a_address, std::size_t a_size, std::uint32_t a_type) noexcept - { - return ::W32_IMPL_VirtualFree(a_address, a_size, a_type); - } - - bool VirtualFreeEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_type) noexcept - { - return ::W32_IMPL_VirtualFreeEx(a_process, a_address, a_size, a_type); - } - - bool VirtualProtect(void* a_address, std::size_t a_size, std::uint32_t a_newProtect, std::uint32_t* a_oldProtect) noexcept - { - return ::W32_IMPL_VirtualProtect(a_address, a_size, a_newProtect, a_oldProtect); - } - - bool VirtualProtectEx(HANDLE a_process, void* a_address, std::size_t a_size, std::uint32_t a_newProtect, std::uint32_t* a_oldProtect) noexcept - { - return ::W32_IMPL_VirtualProtectEx(a_process, a_address, a_size, a_newProtect, a_oldProtect); - } - - std::size_t VirtualQuery(const void* a_address, MEMORY_BASIC_INFORMATION* a_buf, std::size_t a_bufLen) noexcept - { - return ::W32_IMPL_VirtualQuery(a_address, a_buf, a_bufLen); - } - - std::size_t VirtualQueryEx(HANDLE a_process, const void* a_address, MEMORY_BASIC_INFORMATION* a_buf, std::size_t a_bufLen) noexcept - { - return ::W32_IMPL_VirtualQueryEx(a_process, a_address, a_buf, a_bufLen); - } - - std::uint32_t WaitForSingleObject(HANDLE a_handle, std::uint32_t a_milliseconds) noexcept - { - return ::W32_IMPL_WaitForSingleObject(a_handle, a_milliseconds); - } - - std::uint32_t WaitForSingleObjectEx(HANDLE a_handle, std::uint32_t a_milliseconds, bool a_alertable) noexcept - { - return ::W32_IMPL_WaitForSingleObjectEx(a_handle, a_milliseconds, a_alertable); - } - - std::int32_t WideCharToMultiByte(std::uint32_t a_codePage, std::uint32_t a_flags, const wchar_t* a_src, std::int32_t a_srcLen, char* a_dst, std::int32_t a_dstLen, const char* a_default, std::int32_t* a_defaultLen) - { - return ::W32_IMPL_WideCharToMultiByte(a_codePage, a_flags, a_src, a_srcLen, a_dst, a_dstLen, a_default, a_defaultLen); - } - - bool WriteProcessMemory(HANDLE a_process, void* a_address, const void* a_buf, std::size_t a_bufLen, std::size_t* a_bufWritten) noexcept - { - return ::W32_IMPL_WriteProcessMemory(a_process, a_address, a_buf, a_bufLen, a_bufWritten); - } -} diff --git a/CommonLibF4/src/REX/W32/OLE32.cpp b/CommonLibF4/src/REX/W32/OLE32.cpp deleted file mode 100644 index 2e20d0b7..00000000 --- a/CommonLibF4/src/REX/W32/OLE32.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "REX/W32/OLE32.h" - -REX_W32_IMPORT(void, CoTaskMemFree, void*); - -namespace REX::W32 -{ - void CoTaskMemFree(void* a_block) noexcept - { - ::W32_IMPL_CoTaskMemFree(a_block); - } -} diff --git a/CommonLibF4/src/REX/W32/SHELL32.cpp b/CommonLibF4/src/REX/W32/SHELL32.cpp deleted file mode 100644 index fd52204e..00000000 --- a/CommonLibF4/src/REX/W32/SHELL32.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "REX/W32/SHELL32.h" - -REX_W32_IMPORT(std::int32_t, SHGetKnownFolderPath, const REX::W32::GUID&, std::uint32_t, void*, wchar_t**); - -namespace REX::W32 -{ - std::int32_t SHGetKnownFolderPath(const GUID& a_id, std::uint32_t a_flags, void* a_token, wchar_t** a_path) noexcept - { - return ::W32_IMPL_SHGetKnownFolderPath(a_id, a_flags, a_token, a_path); - } -} diff --git a/CommonLibF4/src/REX/W32/USER32.cpp b/CommonLibF4/src/REX/W32/USER32.cpp deleted file mode 100644 index aac4229d..00000000 --- a/CommonLibF4/src/REX/W32/USER32.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "REX/W32/KERNEL32.h" - -REX_W32_IMPORT(REX::W32::BOOL, GetClientRect, REX::W32::HWND, REX::W32::RECT*); -REX_W32_IMPORT(std::int32_t, GetKeyNameTextA, std::int32_t, char*, std::int32_t); -REX_W32_IMPORT(std::int32_t, GetKeyNameTextW, std::int32_t, wchar_t*, std::int32_t); -REX_W32_IMPORT(std::int16_t, GetKeyState, std::int32_t); -REX_W32_IMPORT(REX::W32::BOOL, GetWindowRect, REX::W32::HWND, REX::W32::RECT*); -REX_W32_IMPORT(std::int32_t, MessageBoxA, REX::W32::HWND, const char*, const char*, std::uint32_t); -REX_W32_IMPORT(std::int32_t, MessageBoxW, REX::W32::HWND, const wchar_t*, const wchar_t*, std::uint32_t); -REX_W32_IMPORT(std::intptr_t, SetWindowLongPtrA, REX::W32::HWND, std::int32_t, std::intptr_t); -REX_W32_IMPORT(std::int32_t, ShowCursor, REX::W32::BOOL); - -namespace REX::W32 -{ - bool GetClientRect(HWND a_wnd, RECT* a_rect) noexcept - { - return ::W32_IMPL_GetClientRect(a_wnd, a_rect); - } - - std::int32_t GetKeyNameTextA(std::int32_t a_param, char* a_buf, std::int32_t a_bufLen) noexcept - { - return ::W32_IMPL_GetKeyNameTextA(a_param, a_buf, a_bufLen); - } - - std::int32_t GetKeyNameTextW(std::int32_t a_param, wchar_t* a_buf, std::int32_t a_bufLen) noexcept - { - return ::W32_IMPL_GetKeyNameTextW(a_param, a_buf, a_bufLen); - } - - std::int16_t GetKeyState(std::int32_t a_key) noexcept - { - return ::W32_IMPL_GetKeyState(a_key); - } - - bool GetWindowRect(HWND a_wnd, RECT* a_rect) noexcept - { - return ::W32_IMPL_GetWindowRect(a_wnd, a_rect); - } - - std::int32_t MessageBoxA(HWND a_wnd, const char* a_text, const char* a_caption, std::uint32_t a_type) noexcept - { - return ::W32_IMPL_MessageBoxA(a_wnd, a_text, a_caption, a_type); - } - - std::int32_t MessageBoxW(HWND a_wnd, const wchar_t* a_text, const wchar_t* a_caption, std::uint32_t a_type) noexcept - { - return ::W32_IMPL_MessageBoxW(a_wnd, a_text, a_caption, a_type); - } - - std::intptr_t SetWindowLongPtrA(HWND a_wnd, std::int32_t a_index, std::intptr_t a_newPtr) noexcept - { - return ::W32_IMPL_SetWindowLongPtrA(a_wnd, a_index, a_newPtr); - } - - std::int32_t ShowCursor(bool a_show) noexcept - { - return ::W32_IMPL_ShowCursor(a_show); - } -} diff --git a/CommonLibF4/src/REX/W32/VERSION.cpp b/CommonLibF4/src/REX/W32/VERSION.cpp deleted file mode 100644 index ce249a49..00000000 --- a/CommonLibF4/src/REX/W32/VERSION.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "REX/W32/VERSION.h" - -REX_W32_IMPORT(REX::W32::BOOL, GetFileVersionInfoA, const char*, std::uint32_t, std::uint32_t, void*); -REX_W32_IMPORT(REX::W32::BOOL, GetFileVersionInfoW, const wchar_t*, std::uint32_t, std::uint32_t, void*); -REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeA, const char*, std::uint32_t*); -//REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeExA, std::uint32_t, const char*, std::uint32_t*); -REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeExW, std::uint32_t, const wchar_t*, std::uint32_t*); -REX_W32_IMPORT(std::uint32_t, GetFileVersionInfoSizeW, const wchar_t*, std::uint32_t*); -REX_W32_IMPORT(REX::W32::BOOL, VerQueryValueA, const void*, const char*, void**, std::uint32_t*); -REX_W32_IMPORT(REX::W32::BOOL, VerQueryValueW, const void*, const wchar_t*, void**, std::uint32_t*); - -namespace REX::W32 -{ - bool GetFileVersionInfoA(const char* a_name, std::uint32_t a_handle, std::uint32_t a_dataLen, void* a_data) noexcept - { - return ::W32_IMPL_GetFileVersionInfoA(a_name, a_handle, a_dataLen, a_data); - } - - std::uint32_t GetFileVersionInfoSizeA(const char* a_name, std::uint32_t* a_handle) noexcept - { - return ::W32_IMPL_GetFileVersionInfoSizeA(a_name, a_handle); - } - - //std::uint32_t GetFileVersionInfoSizeExA(std::uint32_t a_flags, const char* a_name, std::uint32_t* a_handle) noexcept - //{ - // return ::W32_IMPL_GetFileVersionInfoSizeExA(a_flags, a_name, a_handle); - //} - - std::uint32_t GetFileVersionInfoSizeExW(std::uint32_t a_flags, const wchar_t* a_name, std::uint32_t* a_handle) noexcept - { - return ::W32_IMPL_GetFileVersionInfoSizeExW(a_flags, a_name, a_handle); - } - - std::uint32_t GetFileVersionInfoSizeW(const wchar_t* a_name, std::uint32_t* a_handle) noexcept - { - return ::W32_IMPL_GetFileVersionInfoSizeW(a_name, a_handle); - } - - bool GetFileVersionInfoW(const wchar_t* a_name, std::uint32_t a_handle, std::uint32_t a_dataLen, void* a_data) noexcept - { - return ::W32_IMPL_GetFileVersionInfoW(a_name, a_handle, a_dataLen, a_data); - } - - bool VerQueryValueA(const void* a_block, const char* a_subBlock, void** a_buf, std::uint32_t* a_bufLen) noexcept - { - return ::W32_IMPL_VerQueryValueA(a_block, a_subBlock, a_buf, a_bufLen); - } - - bool VerQueryValueW(const void* a_block, const wchar_t* a_subBlock, void** a_buf, std::uint32_t* a_bufLen) noexcept - { - return ::W32_IMPL_VerQueryValueW(a_block, a_subBlock, a_buf, a_bufLen); - } -} From b414a3b3fd0e93da5bd19eafdf86a309b20244c2 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sun, 2 Jun 2024 01:10:37 -0500 Subject: [PATCH 2/6] feat: add `BSCoreTypes` --- CommonLibF4/include/F4SE/Impl/PCH.h | 2 ++ CommonLibF4/include/RE/Bethesda/BGSMod.h | 4 ++-- CommonLibF4/include/RE/Bethesda/BSCoreTypes.h | 6 ++++++ CommonLibF4/include/RE/Bethesda/BSExtraData.h | 2 +- CommonLibF4/include/RE/Bethesda/Events.h | 6 +++--- CommonLibF4/include/RE/Bethesda/FormComponents.h | 2 +- CommonLibF4/include/RE/Bethesda/PlayerCharacter.h | 2 +- CommonLibF4/include/RE/Bethesda/TESDataHandler.h | 10 +++++----- CommonLibF4/include/RE/Bethesda/TESFile.h | 4 ++-- CommonLibF4/include/RE/Bethesda/TESForms.h | 13 +++++++------ CommonLibF4/include/RE/Bethesda/Workshop.h | 4 ++-- CommonLibF4/src/RE/Bethesda/FormComponents.cpp | 2 +- 12 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 CommonLibF4/include/RE/Bethesda/BSCoreTypes.h diff --git a/CommonLibF4/include/F4SE/Impl/PCH.h b/CommonLibF4/include/F4SE/Impl/PCH.h index 9f3fa9a0..087c9441 100644 --- a/CommonLibF4/include/F4SE/Impl/PCH.h +++ b/CommonLibF4/include/F4SE/Impl/PCH.h @@ -535,5 +535,7 @@ namespace REL #include "RE/RTTI_IDs.h" #include "RE/VTABLE_IDs.h" +#include "RE/Bethesda/BSCoreTypes.h" + #include "RE/msvc/memory.h" #include "RE/msvc/typeinfo.h" diff --git a/CommonLibF4/include/RE/Bethesda/BGSMod.h b/CommonLibF4/include/RE/Bethesda/BGSMod.h index e7cc237c..5cf2e0ff 100644 --- a/CommonLibF4/include/RE/Bethesda/BGSMod.h +++ b/CommonLibF4/include/RE/Bethesda/BGSMod.h @@ -68,8 +68,8 @@ namespace RE::BGSMod { public: // members - std::uint32_t formID; // 0 - float value; // 4 + TESFormID formID; // 0 + float value; // 4 }; static_assert(sizeof(FormValuePair) == 0x8); diff --git a/CommonLibF4/include/RE/Bethesda/BSCoreTypes.h b/CommonLibF4/include/RE/Bethesda/BSCoreTypes.h new file mode 100644 index 00000000..29c9f638 --- /dev/null +++ b/CommonLibF4/include/RE/Bethesda/BSCoreTypes.h @@ -0,0 +1,6 @@ +#pragma once + +namespace RE +{ + using TESFormID = std::uint32_t; +} diff --git a/CommonLibF4/include/RE/Bethesda/BSExtraData.h b/CommonLibF4/include/RE/Bethesda/BSExtraData.h index d0a0419a..95d8b9ea 100644 --- a/CommonLibF4/include/RE/Bethesda/BSExtraData.h +++ b/CommonLibF4/include/RE/Bethesda/BSExtraData.h @@ -654,7 +654,7 @@ namespace RE { public: // members - std::uint32_t formID; // 0 + TESFormID formID; // 0 std::uint32_t linkType; // 4 }; static_assert(sizeof(Element) == 0x8); diff --git a/CommonLibF4/include/RE/Bethesda/Events.h b/CommonLibF4/include/RE/Bethesda/Events.h index c3324c41..fbd4ff63 100644 --- a/CommonLibF4/include/RE/Bethesda/Events.h +++ b/CommonLibF4/include/RE/Bethesda/Events.h @@ -623,7 +623,7 @@ namespace RE } // members - std::uint32_t formID; // 00 + TESFormID formID; // 00 }; static_assert(sizeof(TESFormDeleteEvent) == 0x04); @@ -770,8 +770,8 @@ namespace RE } // members - std::uint32_t formId; // 00 - bool loaded; // 04 + TESFormID formID; // 00 + bool loaded; // 04 }; static_assert(sizeof(TESObjectLoadedEvent) == 0x8); diff --git a/CommonLibF4/include/RE/Bethesda/FormComponents.h b/CommonLibF4/include/RE/Bethesda/FormComponents.h index 6797bded..d7d84bf0 100644 --- a/CommonLibF4/include/RE/Bethesda/FormComponents.h +++ b/CommonLibF4/include/RE/Bethesda/FormComponents.h @@ -913,7 +913,7 @@ namespace RE bool AddKeywords(const std::vector& a_keywords); [[nodiscard]] bool ContainsKeywordString(std::string_view a_editorID) const; - [[nodiscard]] bool HasKeywordID(std::uint32_t a_formID) const; + [[nodiscard]] bool HasKeywordID(TESFormID a_formID) const; [[nodiscard]] bool HasKeywordString(std::string_view a_editorID) const; void ForEachKeyword(std::function a_callback) const diff --git a/CommonLibF4/include/RE/Bethesda/PlayerCharacter.h b/CommonLibF4/include/RE/Bethesda/PlayerCharacter.h index 9b2616e9..369acbcf 100644 --- a/CommonLibF4/include/RE/Bethesda/PlayerCharacter.h +++ b/CommonLibF4/include/RE/Bethesda/PlayerCharacter.h @@ -342,7 +342,7 @@ namespace RE return func(this); } - void SelectPerk(std::uint32_t a_formID, std::int8_t a_rank = 0) + void SelectPerk(TESFormID a_formID, std::int8_t a_rank = 0) { using func_t = decltype(&PlayerCharacter::SelectPerk); REL::Relocation func{ REL::ID(1397326) }; diff --git a/CommonLibF4/include/RE/Bethesda/TESDataHandler.h b/CommonLibF4/include/RE/Bethesda/TESDataHandler.h index 4c5b3357..c4844b8e 100644 --- a/CommonLibF4/include/RE/Bethesda/TESDataHandler.h +++ b/CommonLibF4/include/RE/Bethesda/TESDataHandler.h @@ -100,28 +100,28 @@ namespace RE return reinterpret_cast&>(formArrays[std::to_underlying(T::FORM_ID)]); } - std::uint32_t LookupFormID(std::uint32_t a_rawFormID, std::string_view a_modName) + TESFormID LookupFormID(TESFormID a_rawFormID, std::string_view a_modName) { auto file = LookupModByName(a_modName); if (!file || file->compileIndex == 0xFF) { return 0; } - std::uint32_t formID = file->compileIndex << 24; + TESFormID formID = file->compileIndex << 24; formID += file->smallFileCompileIndex << 12; formID += a_rawFormID; return formID; } - TESForm* LookupForm(std::uint32_t a_rawFormID, std::string_view a_modName) + TESForm* LookupForm(TESFormID a_rawFormID, std::string_view a_modName) { auto formID = LookupFormID(a_rawFormID, a_modName); return formID != 0 ? TESForm::GetFormByID(formID) : nullptr; } template - T* LookupForm(std::uint32_t a_rawFormID, std::string_view a_modName) + T* LookupForm(TESFormID a_rawFormID, std::string_view a_modName) { auto form = LookupForm(a_rawFormID, a_modName); if (!form) { @@ -202,7 +202,7 @@ namespace RE return mod ? std::make_optional(mod->smallFileCompileIndex) : std::nullopt; } - bool IsFormIDInuse(std::uint32_t a_formID) + bool IsFormIDInuse(TESFormID a_formID) { using func_t = decltype(&TESDataHandler::IsFormIDInuse); REL::Relocation func{ REL::ID(2192351) }; diff --git a/CommonLibF4/include/RE/Bethesda/TESFile.h b/CommonLibF4/include/RE/Bethesda/TESFile.h index 12bdbaa6..04be93ec 100644 --- a/CommonLibF4/include/RE/Bethesda/TESFile.h +++ b/CommonLibF4/include/RE/Bethesda/TESFile.h @@ -56,7 +56,7 @@ namespace RE std::uint32_t form; // 00 std::uint32_t length; // 04 std::uint32_t flags; // 08 - std::uint32_t formID; // 0C + TESFormID formID; // 0C std::uint32_t versionControl; // 10 std::uint16_t formVersion; // 14 std::uint16_t vcVersion; // 16 @@ -117,7 +117,7 @@ namespace RE return GetChunkData(a_data, 0); } - [[nodiscard]] bool IsFormInMod(std::uint32_t a_formID) const + [[nodiscard]] bool IsFormInMod(TESFormID a_formID) const { if (!IsLight() && (a_formID >> 24) == compileIndex) { return true; diff --git a/CommonLibF4/include/RE/Bethesda/TESForms.h b/CommonLibF4/include/RE/Bethesda/TESForms.h index 3cd28ab2..9e7f886c 100644 --- a/CommonLibF4/include/RE/Bethesda/TESForms.h +++ b/CommonLibF4/include/RE/Bethesda/TESForms.h @@ -2,6 +2,7 @@ #include "RE/Bethesda/Atomic.h" #include "RE/Bethesda/BGSBodyPartDefs.h" +#include "RE/Bethesda/BSCoreTypes.h" #include "RE/Bethesda/BSFixedString.h" #include "RE/Bethesda/BSLock.h" #include "RE/Bethesda/BSPointerHandle.h" @@ -703,7 +704,7 @@ namespace RE virtual bool IsFormTypeChild([[maybe_unused]] std::uint8_t a_type) { return false; } // 3E virtual bool LoopingActivate(TESObjectREFR* a_itemActivated, TESObjectREFR* a_actionRef) { return Activate(a_itemActivated, a_actionRef, nullptr, 1); } // 3F virtual bool Activate([[maybe_unused]] TESObjectREFR* a_itemActivated, [[maybe_unused]] TESObjectREFR* a_actionRef, [[maybe_unused]] TESBoundObject* a_objectToGet, [[maybe_unused]] std::int32_t a_count) { return false; } // 40 - virtual void SetFormID(std::uint32_t a_id, bool a_updateFile); // 41 + virtual void SetFormID(TESFormID a_formID, bool a_updateFile); // 41 virtual const char* GetObjectTypeName() const { return ""; } // 42 virtual bool QAvailableInGame() const { return true; } // 43 virtual BGSMod::Template::Items* GetObjectTemplate() { return nullptr; } // 44 @@ -752,7 +753,7 @@ namespace RE return func(this, a_index); } - [[nodiscard]] static TESForm* GetFormByID(std::uint32_t a_formID) + [[nodiscard]] static TESForm* GetFormByID(TESFormID a_formID) { const auto& [map, lock] = GetAllForms(); BSAutoReadLock l{ lock }; @@ -765,7 +766,7 @@ namespace RE } template - [[nodiscard]] static T* GetFormByID(std::uint32_t a_formID) + [[nodiscard]] static T* GetFormByID(TESFormID a_formID) { const auto form = GetFormByID(a_formID); return form ? form->As() : nullptr; @@ -815,10 +816,10 @@ namespace RE } [[nodiscard]] std::uint32_t GetFormFlags() const noexcept { return formFlags; } - [[nodiscard]] std::uint32_t GetFormID() const noexcept { return formID; } + [[nodiscard]] TESFormID GetFormID() const noexcept { return formID; } [[nodiscard]] ENUM_FORM_ID GetFormType() const noexcept { return *formType; } - [[nodiscard]] std::uint32_t GetLocalFormID() + [[nodiscard]] TESFormID GetLocalFormID() { auto file = GetFile(0); @@ -908,7 +909,7 @@ namespace RE // members TESFileContainer sourceFiles; // 08 std::uint32_t formFlags; // 10 - std::uint32_t formID; // 14 + TESFormID formID; // 14 std::uint16_t inGameFormFlags; // 18 REX::EnumSet formType; // 1A }; diff --git a/CommonLibF4/include/RE/Bethesda/Workshop.h b/CommonLibF4/include/RE/Bethesda/Workshop.h index e517e011..904e6135 100644 --- a/CommonLibF4/include/RE/Bethesda/Workshop.h +++ b/CommonLibF4/include/RE/Bethesda/Workshop.h @@ -60,8 +60,8 @@ namespace RE ~DeletedItemInfo() noexcept {} // NOLINT(modernize-use-equals-default) // members - std::uint32_t formID; // 0 - std::uint32_t count; // 4 + TESFormID formID; // 0 + std::uint32_t count; // 4 }; static_assert(sizeof(DeletedItemInfo) == 0x8); diff --git a/CommonLibF4/src/RE/Bethesda/FormComponents.cpp b/CommonLibF4/src/RE/Bethesda/FormComponents.cpp index 93aebec7..629745f2 100644 --- a/CommonLibF4/src/RE/Bethesda/FormComponents.cpp +++ b/CommonLibF4/src/RE/Bethesda/FormComponents.cpp @@ -56,7 +56,7 @@ namespace RE return result; } - bool BGSKeywordForm::HasKeywordID(std::uint32_t a_formID) const + bool BGSKeywordForm::HasKeywordID(TESFormID a_formID) const { bool result = false; ForEachKeyword([&](const BGSKeyword* a_keyword) { From 9562274ed9c9e230786a4ecf92c11385f9901437 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sun, 2 Jun 2024 01:12:03 -0500 Subject: [PATCH 3/6] feat: events --- CommonLibF4/include/RE/Bethesda/Events.h | 34 ++++++++++++++------ CommonLibF4/include/RE/Bethesda/PowerArmor.h | 18 +++++------ CommonLibF4/include/RE/Fallout.h | 1 + 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/CommonLibF4/include/RE/Bethesda/Events.h b/CommonLibF4/include/RE/Bethesda/Events.h index fbd4ff63..d196cecb 100644 --- a/CommonLibF4/include/RE/Bethesda/Events.h +++ b/CommonLibF4/include/RE/Bethesda/Events.h @@ -534,7 +534,7 @@ namespace RE [[nodiscard]] static BSTEventSource* GetEventSource() { using func_t = decltype(&TerminalHacked::GetEventSource); - REL::Relocation func{ REL::ID(425579) }; + static REL::Relocation func{ REL::ID(425579) }; return func(); } }; @@ -546,7 +546,7 @@ namespace RE [[nodiscard]] static BSTEventSource* GetEventSource() { using func_t = decltype(&TESActivateEvent::GetEventSource); - REL::Relocation func{ REL::ID(166230) }; + static REL::Relocation func{ REL::ID(166230) }; return func(); } @@ -562,7 +562,7 @@ namespace RE [[nodiscard]] static BSTEventSource* GetEventSource() { using func_t = decltype(&TESContainerChangedEvent::GetEventSource); - REL::Relocation func{ REL::ID(242538) }; + static REL::Relocation func{ REL::ID(242538) }; return func(); } @@ -582,7 +582,7 @@ namespace RE [[nodiscard]] static BSTEventSource* GetEventSource() { using func_t = decltype(&TESDeathEvent::GetEventSource); - REL::Relocation func{ REL::ID(2201833) }; + static REL::Relocation func{ REL::ID(2201833) }; return func(); } @@ -599,7 +599,7 @@ namespace RE [[nodiscard]] static BSTEventSource* GetEventSource() { using func_t = decltype(&TESEquipEvent::GetEventSource); - REL::Relocation func{ REL::ID(1251703) }; + static REL::Relocation func{ REL::ID(2201837) }; return func(); } @@ -618,7 +618,7 @@ namespace RE [[nodiscard]] static BSTEventSource* GetEventSource() { using func_t = decltype(&TESFormDeleteEvent::GetEventSource); - REL::Relocation func{ REL::ID(2201842) }; + static REL::Relocation func{ REL::ID(2201842) }; return func(); } @@ -639,7 +639,7 @@ namespace RE [[nodiscard]] static BSTEventSource* GetEventSource() { using func_t = decltype(&TESFurnitureEvent::GetEventSource); - REL::Relocation func{ REL::ID(678665) }; + static REL::Relocation func{ REL::ID(2201844) }; return func(); } @@ -727,7 +727,7 @@ namespace RE [[nodiscard]] static BSTEventSource* GetEventSource() { using func_t = decltype(&TESHitEvent::GetEventSource); - REL::Relocation func{ REL::ID(1411899) }; + static REL::Relocation func{ REL::ID(1411899) }; return func(); } @@ -748,7 +748,7 @@ namespace RE [[nodiscard]] static BSTEventSource* GetEventSource() { using func_t = decltype(&TESMagicEffectApplyEvent::GetEventSource); - REL::Relocation func{ REL::ID(1327824) }; + static REL::Relocation func{ REL::ID(1327824) }; return func(); } @@ -765,7 +765,7 @@ namespace RE [[nodiscard]] static BSTEventSource* GetEventSource() { using func_t = decltype(&TESObjectLoadedEvent::GetEventSource); - REL::Relocation func{ REL::ID(609604) }; + static REL::Relocation func{ REL::ID(2201853) }; return func(); } @@ -775,6 +775,20 @@ namespace RE }; static_assert(sizeof(TESObjectLoadedEvent) == 0x8); + struct TESSwitchRaceCompleteEvent + { + [[nodiscard]] static BSTEventSource* GetEventSource() + { + using func_t = decltype(&TESSwitchRaceCompleteEvent::GetEventSource); + static REL::Relocation func{ REL::ID(2201874) }; + return func(); + } + + // members + NiPointer actor; // 00 + }; + static_assert(sizeof(TESSwitchRaceCompleteEvent) == 0x8); + class TutorialEvent { public: diff --git a/CommonLibF4/include/RE/Bethesda/PowerArmor.h b/CommonLibF4/include/RE/Bethesda/PowerArmor.h index 83c2ee55..6a135977 100644 --- a/CommonLibF4/include/RE/Bethesda/PowerArmor.h +++ b/CommonLibF4/include/RE/Bethesda/PowerArmor.h @@ -21,7 +21,7 @@ namespace RE [[nodiscard]] inline bool ActorInPowerArmor(const Actor& a_actor) { using func_t = decltype(&ActorInPowerArmor); - REL::Relocation func{ REL::ID(1176757) }; + static REL::Relocation func{ REL::ID(2219437) }; return func(a_actor); } @@ -34,35 +34,35 @@ namespace RE [[nodiscard]] inline BGSKeyword* GetArmorKeyword() { using func_t = decltype(&GetArmorKeyword); - REL::Relocation func{ REL::ID(961172) }; + static REL::Relocation func{ REL::ID(961172) }; return func(); } [[nodiscard]] inline BGSKeyword* GetBatteryKeyword() { using func_t = decltype(&GetBatteryKeyword); - REL::Relocation func{ REL::ID(1493537) }; + static REL::Relocation func{ REL::ID(1493537) }; return func(); } [[nodiscard]] inline TESAmmo* GetDefaultBatteryObject() { using func_t = decltype(&GetDefaultBatteryObject); - REL::Relocation func{ REL::ID(1279247) }; + static REL::Relocation func{ REL::ID(1279247) }; return func(); } [[nodiscard]] inline bool IsPowerArmorBattery(const TESBoundObject* a_itemData) { using func_t = decltype(&IsPowerArmorBattery); - REL::Relocation func{ REL::ID(1012910) }; + static REL::Relocation func{ REL::ID(1012910) }; return func(a_itemData); } inline void SyncFurnitureVisualsToInventory(TESObjectREFR* a_furniture, bool a_force3DUpdate, BGSInventoryItem* a_tempItemToAdd, bool a_hideCore) { using func_t = decltype(&SyncFurnitureVisualsToInventory); - REL::Relocation func{ REL::ID(1078979) }; + static REL::Relocation func{ REL::ID(1078979) }; return func(a_furniture, a_force3DUpdate, a_tempItemToAdd, a_hideCore); } @@ -89,21 +89,21 @@ namespace RE [[nodiscard]] static PowerArmorGeometry* GetSingleton() { - REL::Relocation singleton{ REL::ID(1365745) }; + static REL::Relocation singleton{ REL::ID(1365745) }; return *singleton; } void HidePipboyPAGeometry() { using func_t = decltype(&PowerArmorGeometry::HidePipboyPAGeometry); - REL::Relocation func{ REL::ID(976332) }; + static REL::Relocation func{ REL::ID(976332) }; return func(this); } void ShowPipboyPAGeometry() { using func_t = decltype(&PowerArmorGeometry::ShowPipboyPAGeometry); - REL::Relocation func{ REL::ID(19066) }; + static REL::Relocation func{ REL::ID(19066) }; return func(this); } diff --git a/CommonLibF4/include/RE/Fallout.h b/CommonLibF4/include/RE/Fallout.h index 128b09ff..49ad82cb 100644 --- a/CommonLibF4/include/RE/Fallout.h +++ b/CommonLibF4/include/RE/Fallout.h @@ -34,6 +34,7 @@ #include "RE/Bethesda/BSBTreeFile.h" #include "RE/Bethesda/BSBound.h" #include "RE/Bethesda/BSContainer.h" +#include "RE/Bethesda/BSCoreTypes.h" #include "RE/Bethesda/BSExtraData.h" #include "RE/Bethesda/BSFadeNode.h" #include "RE/Bethesda/BSFixedString.h" From f732cf878cb4f3643ec3ada0db4cfac2aa20fba3 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sun, 2 Jun 2024 01:12:35 -0500 Subject: [PATCH 4/6] feat: add `SEX` enum class --- CommonLibF4/include/RE/Bethesda/TESBoundAnimObjects.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CommonLibF4/include/RE/Bethesda/TESBoundAnimObjects.h b/CommonLibF4/include/RE/Bethesda/TESBoundAnimObjects.h index 2605ba88..9b92a4ae 100644 --- a/CommonLibF4/include/RE/Bethesda/TESBoundAnimObjects.h +++ b/CommonLibF4/include/RE/Bethesda/TESBoundAnimObjects.h @@ -339,6 +339,15 @@ namespace RE }; static_assert(sizeof(CreatureSounds) == 0x20); + enum class SEX : std::uint32_t + { + kNone = static_cast>(-1), + kMale = 0, + kFemale = 1, + + kTotal = 2 + }; + class __declspec(novtable) TESNPC : public TESActorBase, // 000 public TESRaceForm, // 1B0 @@ -440,7 +449,7 @@ namespace RE return root; } - [[nodiscard]] uint32_t GetSex() noexcept + [[nodiscard]] SEX GetSex() noexcept { using func_t = decltype(&TESNPC::GetSex); REL::Relocation func{ REL::ID(2207107) }; From 7f57ad8913964f6c5c25e769ef23c610710db24c Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sun, 2 Jun 2024 11:20:46 -0500 Subject: [PATCH 5/6] build: make some `xmake` cxxflags public --- CommonLibF4/xmake.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CommonLibF4/xmake.lua b/CommonLibF4/xmake.lua index af90b687..d4648663 100644 --- a/CommonLibF4/xmake.lua +++ b/CommonLibF4/xmake.lua @@ -60,12 +60,14 @@ target("commonlibf4", function() add_cxxflags( "cl::/wd4200", -- nonstandard extension used : zero-sized array in struct/union "cl::/wd4201", -- nonstandard extension used : nameless struct/union - "cl::/wd4324" -- 'struct_name' : structure was padded due to __declspec(align()) + "cl::/wd4324", -- structure was padded due to alignment specifier + { public = true } ) -- add flags (cl: warnings -> errors) add_cxxflags( - "cl::/we4715" -- `function` : not all control paths return a value + "cl::/we4715", -- not all control paths return a value + { public = true } ) end) From df29d3b0bbf613c9e223fcdfe98a74eefe7f49b2 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Sun, 2 Jun 2024 20:57:12 -0500 Subject: [PATCH 6/6] fix: generate cmake sourcelist --- CommonLibF4/cmake/sourcelist.cmake | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/CommonLibF4/cmake/sourcelist.cmake b/CommonLibF4/cmake/sourcelist.cmake index f35053a5..30d2af66 100644 --- a/CommonLibF4/cmake/sourcelist.cmake +++ b/CommonLibF4/cmake/sourcelist.cmake @@ -39,6 +39,7 @@ set(SOURCES include/RE/Bethesda/BSBTreeFile.h include/RE/Bethesda/BSBound.h include/RE/Bethesda/BSContainer.h + include/RE/Bethesda/BSCoreTypes.h include/RE/Bethesda/BSExtraData.h include/RE/Bethesda/BSFadeNode.h include/RE/Bethesda/BSFixedString.h @@ -442,15 +443,5 @@ set(SOURCES src/REL/Module.cpp src/REL/Relocation.cpp src/REL/Version.cpp - src/REX/W32/ADVAPI32.cpp - src/REX/W32/BCRYPT.cpp - src/REX/W32/D3D11.cpp - src/REX/W32/D3DCOMPILER.cpp - src/REX/W32/DBGHELP.cpp - src/REX/W32/DXGI.cpp - src/REX/W32/KERNEL32.cpp - src/REX/W32/OLE32.cpp - src/REX/W32/SHELL32.cpp - src/REX/W32/USER32.cpp - src/REX/W32/VERSION.cpp + src/REX/W32.cpp )