From d7a92624e35124ad4c5f573a9ffafa074126299e Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 14 Aug 2026 18:49:47 +0000 Subject: [PATCH] Delete scan.h --- scan.h | 75 ---------------------------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 scan.h diff --git a/scan.h b/scan.h deleted file mode 100644 index 9a542f7..0000000 --- a/scan.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once -#include -#include -#include - -static std::vector PatternToIntVector(const char* Pattern) -{ - std::vector PatternVector = std::vector{}; - - char* Start = const_cast(Pattern); - - char* End = const_cast(Pattern) + strlen(Pattern); - - for (char* Current = Start; Current < End; ++Current) - { - if (*Current == '?') - { - ++Current; - - PatternVector.push_back(-69); - } - else { - PatternVector.push_back(strtoul(Current, &Current, 16)); - } - } - - return PatternVector; -} - -static inline void* FindPointer(std::vector Pattern, uint8_t* Address, int Addition = 0) { - - int i = 0; - while (Pattern[i] != -69) i++; - - int Offset = *reinterpret_cast(Address + i); - - return reinterpret_cast(Address + i + 0x4 + Offset + Addition); -} - -template -static T PatternScan(const char* Pattern, uint64_t Start, size_t Size, bool bFindPointer = false, int Addition = 0) -{ - std::vector PatternVector = PatternToIntVector(Pattern); - - uint8_t* Search = reinterpret_cast(Start); - - const size_t SizeOfPattern = PatternVector.size(); - const int* PatternData = PatternVector.data(); - - for (int i = 0; i < Size - SizeOfPattern; ++i) - { - bool FoundSignature = true; - - for (int j = 0; j < SizeOfPattern; ++j) - { - if (Search[i + j] != PatternData[j] && PatternData[j] != -69) - { - FoundSignature = false; - break; - } - } - - if (FoundSignature) { - - if (bFindPointer) { - return reinterpret_cast(FindPointer(PatternVector, &Search[i], Addition)); - } - - return reinterpret_cast(&Search[i]); - - } - } - - return reinterpret_cast(nullptr); -} \ No newline at end of file