Skip to content

Commit

Permalink
feat: add Win32::GetCurrentDirectory (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
shad0wshayd3 authored Sep 6, 2024
1 parent c221e7b commit 4e9897e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/SFSE/Impl/WinAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,10 @@ namespace SFSE::WinAPI
bool FreeLibrary(
HMODULE a_module) noexcept;

[[nodiscard]] std::uint32_t GetCurrentDirectory(
std::uint32_t a_size,
char* a_buffer) noexcept;

[[nodiscard]] void* GetCurrentModule() noexcept;

[[nodiscard]] void* GetCurrentProcess() noexcept;
Expand Down
11 changes: 11 additions & 0 deletions src/SFSE/Impl/WinAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#undef ExpandEnvironmentStrings
#undef FindFirstFile
#undef FindNextFile
#undef GetCurrentDirectory
#undef GetEnvironmentVariable
#undef GetFileVersionInfo
#undef GetFileVersionInfoSize
Expand Down Expand Up @@ -264,6 +265,16 @@ namespace SFSE::WinAPI
reinterpret_cast<::HMODULE>(a_module)));
}

std::uint32_t GetCurrentDirectory(
std::uint32_t a_bufferLen,
char* a_buffer) noexcept
{
return static_cast<std::uint32_t>(
GetCurrentDirectoryA(
a_bufferLen,
a_buffer));
}

void* GetCurrentModule() noexcept
{
return std::addressof(__ImageBase);
Expand Down

0 comments on commit 4e9897e

Please sign in to comment.