При переходе на Android АПИ 30, невозможно записать адрес соседней библиотеки
(char**)(g_libGTASA + 0x5D1608) = "/storage/emulated/0/Example/";
Полный код:
uintptr_t FindLibrary(const char* library)
{
char filename[0xFF] = { 0 },
buffer[2048] = { 0 };
FILE* fp = 0;
uintptr_t address = 0;
sprintf(filename, "/proc/%d/maps", getpid());
fp = fopen(filename, "rt");
if (fp == 0)
{
Log("ERROR: can't open file %s", filename);
goto done;
}
while (fgets(buffer, sizeof(buffer), fp))
{
if (strstr(buffer, library))
{
address = (uintptr_t)strtoul(buffer, 0, 16);
break;
}
}
done:
if (fp)
fclose(fp);
return address;
}
jint JNI_OnLoad(JavaVM *vm, void *reserved)
{
javaVM = vm;
g_libGTASA = FindLibrary("libGTASA.so");
if(g_libGTASA == 0)
{
Log("ERROR: libGTASA.so address not found!");
return 0;
}
Log("libGTASA.so image base address: 0x%X", g_libGTASA);
(char**)(g_libGTASA + 0x5D1608) = "/storage/emulated/0/Example/"; // апи 28 все работает
return JNI_VERSION_1_4;
}
Ошибка adb:
type=1400 audit(0.0:24517832): avc: denied { execmod } for path="/data/app/~~nM6BEGZfaVHCkPa3a1_0tg==/com.example-Pt5zzgVVhMYDZF8awrMuew==/lib/arm/libGTASA.so" dev="dm-10" ino=448096 scontext=u:r:untrusted_app:s0:c117,c258,c512,c768 tcontext=u:object_r:apk_data_file:s0 tclass=file permissive=0 app=com.example