Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Win32::GetCurrentDirectory #267

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading