Вопрос Помогите исправить PatternScanner (внешний x64)

dubdive

Следопыт
Сообщения
88
Реакции
5
Мне кажется функции чтения не хватает? как его присобачить сюда? трудно понимать, копипаст с чат жпт)))

C++:
uint64_t FindPatternExternal(DWORD processID, const char* moduleName, const char* pattern, const char* mask)
{


    // Open the target process with the necessary permissions
    HANDLE hProcess = OpenProcess(PROCESS_VM_READ, FALSE, processID);
    if (!hProcess) {
        //std::cerr << "Failed to open process." << std::endl;
        MessageBox(0, "Failed to open process.", "dubdives", MB_OK);
        return 0;
    }

    // Get the module information to determine its size
    HMODULE hModule;
    if (moduleName)
    {
         hModule = GetModuleHandleA(moduleName);
        if (!hModule) {
            //std::cerr << "Module not found: " << moduleName << std::endl;
            MessageBox(0, string("Module not found: " + string(moduleName)).c_str(), "dubdives", MB_OK);
            CloseHandle(hProcess);
            return 0;
        }
    }
    else
    {
         hModule = GetModuleHandleA(NULL);
        if (!hModule) {
            //std::cerr << "Module not found: " << moduleName << std::endl;
            MessageBox(0, string("Module not found: " + string(moduleName)).c_str(), "dubdives", MB_OK);
            MessageBox(0, string("Error: " + (_Post_equals_last_error_ GetLastError())).c_str(), "dubdives", MB_OK);
            CloseHandle(hProcess);
            return 0;
        }
    }
    

    MODULEINFO moduleInfo;
    GetModuleInformation(hProcess, hModule, &moduleInfo, sizeof(MODULEINFO));

    // Calculate the end address of the module
    uintptr_t endAddress = reinterpret_cast<uintptr_t>(hModule) + moduleInfo.SizeOfImage;

    // Iterate through the module's memory and search for the pattern
    for (uintptr_t i = reinterpret_cast<uintptr_t>(hModule); i < endAddress; i++) {
        bool patternFound = true;
        for (size_t j = 0; mask[j]; j++) {
            if (mask[j] != '?' && pattern[j] != *reinterpret_cast<char*>(i + j))
            {

                patternFound = false;
                break;
            }
        }

        if (patternFound) {
            //std::cout << "Pattern found at address: 0x" << std::hex << i << std::endl;
            MessageBox(0, string("Pattern found at address: " + INTtoHEX(i)).c_str(), "dubdives", MB_OK);
            CloseHandle(hProcess);
            return i;
        }
    }

    //std::cerr << "Pattern not found." << std::endl;
    MessageBox(0, "Pattern not found.", "dubdives", MB_OK);
    CloseHandle(hProcess);
    return 0;
}
 

PLATINA

Активный
Сообщения
120
Реакции
5
Так она вроде присутствует


C++:
MODULEINFO moduleInfo;

GetModuleInformation(hProcess, hModule, &moduleInfo, sizeof(MODULEINFO));



    // Calculate the end address of the module

    uintptr_t endAddress = reinterpret_cast<uintptr_t>(hModule) + moduleInfo.SizeOfImage;



    // Iterate through the module's memory and search for the pattern

    for (uintptr_t i = reinterpret_cast<uintptr_t>(hModule); i < endAddress; i++) {  вот тута чтение от начала до конца

        bool patternFound = true;

        for (size_t j = 0; mask[j]; j++) {

            if (mask[j] != '?' && pattern[j] != *reinterpret_cast<char*>(i + j))  а тут сравнивание

            {



                patternFound = false;

                break;

            }

        }



        if (patternFound) { а тут конец

            //std::cout << "Pattern found at address: 0x" << std::hex << i << std::endl;

            MessageBox(0, string("Pattern found at address: " + INTtoHEX(i)).c_str(), "dubdives", MB_OK);

            CloseHandle(hProcess);

            return i;

        }

    }


вот кусок
 
Верх Низ