Skip to content

Commit 98b7d40

Browse files
committed
fix(dll): Exit early if pattern couldn't be found
1 parent e280c0b commit 98b7d40

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lol/lol.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,11 @@ int start() {
7979
}
8080

8181
{
82-
const void *found = nullptr;
82+
const void *found =
83+
Sig::find(buf, expectedRegion, "48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 20 48 8B DA E8");
8384

84-
while (found == nullptr) {
85-
found = Sig::find(buf, expectedRegion, "48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 20 48 8B DA E8");
86-
87-
if (!ReadProcessMemory(proc, base, (void *)buf, expectedRegion, NULL)) {
88-
throw new std::runtime_error("Could not read process memory");
89-
}
85+
if (found == nullptr) {
86+
throw new std::runtime_error("Pattern not found");
9087
}
9188

9289
const auto relative = (char *)found - buf;

0 commit comments

Comments
 (0)