From 5ea83ff8198dd09c75a90809923b8778ceb73a43 Mon Sep 17 00:00:00 2001 From: shad0wshayd3 Date: Thu, 16 May 2024 17:05:02 -0600 Subject: [PATCH] add REX::W32::GetComputerNameA/W --- CommonLibF4/include/REX/W32/KERNEL32.h | 2 ++ CommonLibF4/src/REX/W32/KERNEL32.cpp | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/CommonLibF4/include/REX/W32/KERNEL32.h b/CommonLibF4/include/REX/W32/KERNEL32.h index 38b36a38..b00d2e52 100644 --- a/CommonLibF4/include/REX/W32/KERNEL32.h +++ b/CommonLibF4/include/REX/W32/KERNEL32.h @@ -444,6 +444,8 @@ namespace REX::W32 bool FindNextFileW(HANDLE a_file, WIN32_FIND_DATAW* a_data) noexcept; bool FlushInstructionCache(HANDLE a_process, const void* a_baseAddr, std::size_t a_size) noexcept; bool FreeLibrary(HMODULE a_module) noexcept; + bool GetComputerNameA(char* a_buffer, std::uint32_t* a_size) noexcept; + bool GetComputerNameW(wchar_t* a_buffer, std::uint32_t* a_size) noexcept; HMODULE GetCurrentModule() noexcept; HANDLE GetCurrentProcess() noexcept; std::uint32_t GetCurrentThreadId() noexcept; diff --git a/CommonLibF4/src/REX/W32/KERNEL32.cpp b/CommonLibF4/src/REX/W32/KERNEL32.cpp index cc480867..1ed810e2 100644 --- a/CommonLibF4/src/REX/W32/KERNEL32.cpp +++ b/CommonLibF4/src/REX/W32/KERNEL32.cpp @@ -19,6 +19,8 @@ REX_W32_IMPORT(REX::W32::BOOL, FindNextFileA, REX::W32::HANDLE, REX::W32::WIN32_ 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); @@ -167,6 +169,16 @@ namespace REX::W32 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));