diff --git a/include/safetyhook/easy.hpp b/include/safetyhook/easy.hpp index e28e15a..466c352 100644 --- a/include/safetyhook/easy.hpp +++ b/include/safetyhook/easy.hpp @@ -21,8 +21,8 @@ namespace safetyhook { /// @param destination The address of the destination function. /// @param flags The flags to use. /// @return The InlineHook object. -template -[[nodiscard]] InlineHook create_inline(T target, T destination, InlineHook::Flags flags = InlineHook::Default) { +template +[[nodiscard]] InlineHook create_inline(T target, U destination, InlineHook::Flags flags = InlineHook::Default) { return create_inline(reinterpret_cast(target), reinterpret_cast(destination), flags); } @@ -31,7 +31,7 @@ template /// @param destination The destination function. /// @param flags The flags to use. /// @return The MidHook object. -[[nodiscard]] MidHook create_mid(void* target, MidHookFn destination, MidHook::Flags = MidHook::Default); +[[nodiscard]] MidHook create_mid(void* target, MidHookFn destination, MidHook::Flags flags = MidHook::Default); /// @brief Easy to use API for creating a MidHook. /// @param target the address of the function to hook. diff --git a/include/safetyhook/inline_hook.hpp b/include/safetyhook/inline_hook.hpp index becb89d..6270325 100644 --- a/include/safetyhook/inline_hook.hpp +++ b/include/safetyhook/inline_hook.hpp @@ -110,8 +110,8 @@ class InlineHook final { /// @return The InlineHook or an InlineHook::Error if an error occurred. /// @note This will use the default global Allocator. /// @note If you don't care about error handling, use the easy API (safetyhook::create_inline). - template - [[nodiscard]] static std::expected create(T target, T destination, Flags flags = Default) { + template + [[nodiscard]] static std::expected create(T target, U destination, Flags flags = Default) { return create(reinterpret_cast(target), reinterpret_cast(destination), flags); } @@ -132,9 +132,9 @@ class InlineHook final { /// @param flags The flags to use. /// @return The InlineHook or an InlineHook::Error if an error occurred. /// @note If you don't care about error handling, use the easy API (safetyhook::create_inline). - template + template [[nodiscard]] static std::expected create( - const std::shared_ptr& allocator, T target, T destination, Flags flags = Default) { + const std::shared_ptr& allocator, T target, U destination, Flags flags = Default) { return create(allocator, reinterpret_cast(target), reinterpret_cast(destination), flags); }