mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-20 20:23:57 +00:00
Move get_system_dll_init_block_size to module_manager as free function
This commit is contained in:
@@ -13,6 +13,30 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
namespace
|
||||
{
|
||||
uint64_t get_system_dll_init_block_size(const windows_version_manager& version)
|
||||
{
|
||||
if (version.is_build_after_or_equal(WINDOWS_VERSION::WINDOWS_11_24H2))
|
||||
{
|
||||
return PS_SYSTEM_DLL_INIT_BLOCK_SIZE_V3;
|
||||
}
|
||||
if (version.is_build_after_or_equal(WINDOWS_VERSION::WINDOWS_10_2004))
|
||||
{
|
||||
return PS_SYSTEM_DLL_INIT_BLOCK_SIZE_V3_2004;
|
||||
}
|
||||
if (version.is_build_after_or_equal(WINDOWS_VERSION::WINDOWS_10_1709))
|
||||
{
|
||||
return PS_SYSTEM_DLL_INIT_BLOCK_SIZE_V2;
|
||||
}
|
||||
if (version.is_build_after_or_equal(WINDOWS_VERSION::WINDOWS_10_1703))
|
||||
{
|
||||
return PS_SYSTEM_DLL_INIT_BLOCK_SIZE_V2_1703;
|
||||
}
|
||||
return PS_SYSTEM_DLL_INIT_BLOCK_SIZE_V1;
|
||||
}
|
||||
}
|
||||
|
||||
namespace utils
|
||||
{
|
||||
static void serialize(buffer_serializer& buffer, const exported_symbol& sym)
|
||||
@@ -282,7 +306,7 @@ void module_manager::load_wow64_modules(const windows_path& executable_path, con
|
||||
}
|
||||
|
||||
PS_SYSTEM_DLL_INIT_BLOCK init_block = {};
|
||||
const auto init_block_size = version.get_system_dll_init_block_size();
|
||||
const auto init_block_size = get_system_dll_init_block_size(version);
|
||||
|
||||
init_block.Size = static_cast<ULONG>(init_block_size);
|
||||
|
||||
|
||||
@@ -100,27 +100,6 @@ bool windows_version_manager::is_build_within(uint32_t start_build, uint32_t end
|
||||
return is_build_after_or_equal(start_build, start_ubr) && is_build_before(end_build, end_ubr);
|
||||
}
|
||||
|
||||
uint64_t windows_version_manager::get_system_dll_init_block_size() const
|
||||
{
|
||||
if (is_build_after_or_equal(WINDOWS_VERSION::WINDOWS_11_24H2))
|
||||
{
|
||||
return PS_SYSTEM_DLL_INIT_BLOCK_SIZE_V3;
|
||||
}
|
||||
if (is_build_after_or_equal(WINDOWS_VERSION::WINDOWS_10_2004))
|
||||
{
|
||||
return PS_SYSTEM_DLL_INIT_BLOCK_SIZE_V3_2004;
|
||||
}
|
||||
if (is_build_after_or_equal(WINDOWS_VERSION::WINDOWS_10_1709))
|
||||
{
|
||||
return PS_SYSTEM_DLL_INIT_BLOCK_SIZE_V2;
|
||||
}
|
||||
if (is_build_after_or_equal(WINDOWS_VERSION::WINDOWS_10_1703))
|
||||
{
|
||||
return PS_SYSTEM_DLL_INIT_BLOCK_SIZE_V2_1703;
|
||||
}
|
||||
return PS_SYSTEM_DLL_INIT_BLOCK_SIZE_V1;
|
||||
}
|
||||
|
||||
void windows_version_manager::serialize(utils::buffer_serializer& buffer) const
|
||||
{
|
||||
buffer.write(info_.major_version);
|
||||
|
||||
@@ -29,8 +29,6 @@ class windows_version_manager
|
||||
bool is_build_within(uint32_t start_build, uint32_t end_build, std::optional<uint32_t> start_ubr = std::nullopt,
|
||||
std::optional<uint32_t> end_ubr = std::nullopt) const;
|
||||
|
||||
uint64_t get_system_dll_init_block_size() const;
|
||||
|
||||
void serialize(utils::buffer_serializer& buffer) const;
|
||||
void deserialize(utils::buffer_deserializer& buffer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user