image_scan.h 1.1 KB

123456789101112131415161718192021222324252627282930
  1. #pragma once
  2. #include <cstddef>
  3. #include <span>
  4. #include "registry.h"
  5. #include "signature_text.h"
  6. namespace sunrise::client::patterns {
  7. /**
  8. * Scans the main image for one signature, independently of the shared registry.
  9. * A single-hook target belongs here, not in the shared sweep: one miss there kills the group.
  10. * @param signature Exact or wildcarded bytes.
  11. * @param name Diagnostic name only.
  12. * @return The unique match, or null when the image has no match or more than one.
  13. */
  14. [[nodiscard]] std::byte* scan_main_image_unique(std::span<const PatternByte> signature,
  15. const char* name) noexcept;
  16. /**
  17. * Decodes a RIP-relative operand into the absolute address it refers to.
  18. * @param operand Address of the 4-byte signed displacement.
  19. * @param nextInstruction Address just past the instruction being decoded.
  20. * @return The address the operand points at.
  21. */
  22. [[nodiscard]] std::byte* resolve_relative(const std::byte* operand,
  23. const std::byte* nextInstruction) noexcept;
  24. } // namespace sunrise::client::patterns