Skip to content

Commit

Permalink
add REX::W32::GetComputerNameA/W
Browse files Browse the repository at this point in the history
  • Loading branch information
shad0wshayd3 committed May 16, 2024
1 parent 7526397 commit 5ea83ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CommonLibF4/include/REX/W32/KERNEL32.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions CommonLibF4/src/REX/W32/KERNEL32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<HMODULE>(std::addressof(__ImageBase));
Expand Down

0 comments on commit 5ea83ff

Please sign in to comment.