diff --git a/shared/sdk/FName.cpp b/shared/sdk/FName.cpp index c9a52e03..1199a9e2 100644 --- a/shared/sdk/FName.cpp +++ b/shared/sdk/FName.cpp @@ -264,7 +264,16 @@ std::optional inlined_find_to_string() try { } if (result) { - SPDLOG_INFO("FName::get_to_string (inlined alternative): result={:x}", (uintptr_t)*result); + const auto stdio_dll = GetModuleHandleW(L"api-ms-win-crt-stdio-l1-1-0.dll"); + const auto vswprintf_func = stdio_dll != nullptr ? GetProcAddress(stdio_dll, "__stdio_common_vswprintf") : nullptr; + + // Double checking that the function we just found isn't sprintf. + if (vswprintf_func != nullptr && utility::find_pointer_in_path((uintptr_t)*result, vswprintf_func, false)) { + SPDLOG_ERROR("FName::get_to_string (inlined): Wrong function found, vswprintf"); + result = std::nullopt; + } else { + SPDLOG_INFO("FName::get_to_string (inlined alternative): result={:x}", (uintptr_t)*result); + } } else { SPDLOG_ERROR("FName::get_to_string (inlined alternative): Failed to find ToString function"); } diff --git a/shared/sdk/FName.hpp b/shared/sdk/FName.hpp index 59dc2e8a..ea139f19 100644 --- a/shared/sdk/FName.hpp +++ b/shared/sdk/FName.hpp @@ -19,6 +19,10 @@ struct FName { using ToStringFn = TArray* (*)(const FName*, TArray*); static std::optional get_to_string(); + FName() + { + + } FName(std::wstring_view name, EFindName find_type = EFindName::Add); std::wstring to_string() const;