| 142 | } |
| 143 | |
| 144 | uintptr_t FindFirstCallTarget(uintptr_t start, size_t maxBytes) { |
| 145 | if (!start || !maxBytes) return 0; |
| 146 | __try { |
| 147 | const auto* p = reinterpret_cast<const uint8_t*>(start); |
| 148 | for (size_t i = 0; i + 5 <= maxBytes; ++i) { |
| 149 | if (p[i] == 0xE8) { |
| 150 | int32_t disp = *reinterpret_cast<const int32_t*>(p + i + 1); |
| 151 | uintptr_t target = start + i + 5 + disp; |
| 152 | // Sanity: target should be within the image |
| 153 | if (target >= s_imageBase && target < s_imageBase + s_imageSize) |
| 154 | return target; |
| 155 | } |
| 156 | } |
| 157 | } __except (EXCEPTION_EXECUTE_HANDLER) { |
| 158 | return 0; |
| 159 | } |
| 160 | return 0; |
| 161 | } |
| 162 | |
| 163 | uintptr_t FindFirstRipRelMovTarget(uintptr_t start, size_t maxBytes) { |
| 164 | if (!start || !maxBytes) return 0; |
nothing calls this directly
no outgoing calls
no test coverage detected