MCPcopy Create free account
hub / github.com/Selectively11/CloudRedirect / FindFirstCallTarget

Function FindFirstCallTarget

src/platform/win/sig_scanner.cpp:144–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144uintptr_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
163uintptr_t FindFirstRipRelMovTarget(uintptr_t start, size_t maxBytes) {
164 if (!start || !maxBytes) return 0;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected