Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

56 lines
1.1KB

  1. #pragma once
  2. class AbstractHookEngine {
  3. private:
  4. const char* name_;
  5. public:
  6. /* boolean for each hook test case, which are set by the hooks */
  7. struct {
  8. bool small_;
  9. bool branch;
  10. bool rip_relative;
  11. bool avx;
  12. bool rdrand;
  13. bool loop;
  14. bool tail_recursion;
  15. };
  16. public:
  17. AbstractHookEngine(const char* name) :
  18. name_(name),
  19. small_(false),
  20. branch(false),
  21. rip_relative(false),
  22. avx(false),
  23. rdrand(false),
  24. loop(false),
  25. tail_recursion(false)
  26. {
  27. }
  28. virtual bool hook_all() = 0;
  29. virtual bool unhook_all() = 0;
  30. bool all_hooked() const {
  31. return small_ && branch && rip_relative && avx && rdrand && loop && tail_recursion;
  32. }
  33. const char* name() const {
  34. return name_;
  35. }
  36. friend std::ostream& operator<< (std::ostream& stream, const AbstractHookEngine& eng) {
  37. std::cout << '|' << std::setw(10) << eng.name() << std::setw(1) << '|' <<
  38. (eng.small_ ? 'X' : ' ') << '|' <<
  39. (eng.branch ? 'X' : ' ') << '|' <<
  40. (eng.rip_relative ? 'X' : ' ') << '|' <<
  41. (eng.avx ? 'X' : ' ') << '|' <<
  42. (eng.rdrand ? 'X' : ' ') << '|' <<
  43. (eng.loop ? 'X' : ' ') << '|' <<
  44. (eng.tail_recursion ? 'X' : ' ') << '|';
  45. return stream;
  46. }
  47. };