Skip to content

Unused variables #220

@wcsicmp

Description

@wcsicmp

I wanted to write a documentation for this library, so i digged into source code (for VEH hooks especially). First of all, why not use inline static variables instead of regular static? Secondly, why don't check the result of VirtualProtect in mem_protect? If the function fails, it will trigger an exception and crush the program. I also suggest using [[nodiscard]] in getProtectionObject() of BreakPointHook, becuase if we don't save the result to local variable, the hook will be restored instantly, which will cause an infinity loop upon calling original function. Thirdly, PLH::AVehHook::Handler checks for m_onException and m_onUnhandledException, but you can't specify it, because library does not have an interface for that. Same goes for range-based type of VEH hook. Also if you have two hooks for the same address, the behavior is undefined, because hooks are stored in set. Thats what i spotted by glancing through the code. If the changes are acceptable, i am happy to make a commit. Let me know if the documentation is needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions