Help! getAbsoluteAddress problem

Daleon228_09

Solid & Active Platinian
Original poster
Aug 19, 2022
63
9
8
Poland
Hello i have a problem with getAbsoluteAddress, it cant find a library and i cant hook any address.

Im using a injector for arm64
 

Daleon228_09

Solid & Active Platinian
Original poster
Aug 19, 2022
63
9
8
Poland
here is findLibrary and getAbsoluteAddress code


C++:
DWORD findLibrary(const char *library) {
    char filename[0xFF] = {0},
            buffer[1024] = {0};
    FILE *fp = NULL;
    DWORD address = 0;

    sprintf(filename, OBFUSCATE("/proc/self/maps"));

    fp = fopen(filename, OBFUSCATE("rt"));
    if (fp == NULL) {
        perror(OBFUSCATE("fopen"));
        goto done;
    }

    while (fgets(buffer, sizeof(buffer), fp)) {
        if (strstr(buffer, library)) {
            address = (DWORD) strtoul(buffer, NULL, 16);
            goto done;
        }
    }

    done:

    if (fp) {
        fclose(fp);
    }

    return address;
}

DWORD getAbsoluteAddress(const char *libraryName, DWORD relativeAddr) {
    libBase = findLibrary(libraryName);
    if (libBase == 0)
        return 0;
    return (reinterpret_cast<DWORD>(libBase + relativeAddr));
}