void* LocalStore;
void (*old_update)(void* instance);
void update(void* instance){
if(instance != NULL && LocalStore != NULL){
*(int *)((uint64_t)LocalStore + 0x3C) = 999;
}
old_update(instance);
}
__attribute__((constructor))
void libhook_main() {
do {
sleep(1);
} while (!isLibraryLoaded(OBFUSCATE("libil2cpp.so")));
LOGI(OBFUSCATE("lib loaded"));
HOOK_LIB("libil2cpp.so", "0x9A1F34", update, old_update);
LOGI(OBFUSCATE("lib hooked"));
}
Thanks, I will try! Another question is how to correctly find the required update method if it is not in the class?No, LocalStore is NULL because it's not initialized. I suppose that you're trying to hook field in LocalStore through Update function outside the LocalStore class.
To fix your hook initialize LocalStore before hooking the field
void *LocalStore; //DECLARING A GLOBAL VARIABLE
void (*old_update)(void *instance);
void update(void *instance) {
if (instance != NULL) //CHECK IF INSTANCE IS NOT NULL
{
LocalStore = *(void **) ((uint64_t)instance + (LOCALSTORE OFFSET)); //INITIAZLIZING LOCALSTORE
if (LocalStore == NULL) return; //REMOVE USELESS THINGS
//THIS IS WHERE YOU CAN HOOK THE FIELD
*(int *) ((uint64_t) LocalStore + 0x3C) = 999;
LOGD("FIELD HOOKED");
}
old_update(instance);
}
Нет, LocalStore имеет значение NULL, потому что оно не инициализировано. Я предполагаю, что вы пытаетесь перехватить поле в LocalStore через функцию Update вне класса LocalStore.
Чтобы исправить ваш хук, инициализируйте LocalStore перед подключением поля.
недействительным *LocalStore; // ОБЪЯВЛЕНИЕ ГЛОБАЛЬНОЙ ПЕРЕМЕННОЙ
void (*old_update)(void *instance);
недействительное обновление (недействительное * экземпляр) {
if (instance != NULL) // ПРОВЕРЯЕМ, ЕСЛИ ЭКЗЕМПЛЯР НЕ NULL
{
LocalStore = *(void **) ((uint64_t)экземпляр + (LOCALSTORE OFFSET)); // ИНИЦИАЛИЗАЦИЯ LOCALSTORE
если (LocalStore == NULL) вернуть; //УДАЛЯЕМ БЕСПОЛЕЗНЫЕ ВЕЩИ
// ЗДЕСЬ ВЫ МОЖЕТЕ ПРИСОЕДИНИТЬСЯ К ПОЛЕ
*(int *) ((uint64_t) LocalStore + 0x3C) = 999;
LOGD("ПОЛЕ ПОДКЛЮЧЕНО");
}
old_update (экземпляр);
}
[/ЦИТИРОВАТЬ]
No, LocalStore is NULL because it's not initialized. I suppose that you're trying to hook field in LocalStore through Update function outside the LocalStore class.
To fix your hook initialize LocalStore before hooking the field
void *LocalStore; //DECLARING A GLOBAL VARIABLE
void (*old_update)(void *instance);
void update(void *instance) {
if (instance != NULL) //CHECK IF INSTANCE IS NOT NULL
{
LocalStore = *(void **) ((uint64_t)instance + (LOCALSTORE OFFSET)); //INITIAZLIZING LOCALSTORE
if (LocalStore == NULL) return; //REMOVE USELESS THINGS
//THIS IS WHERE YOU CAN HOOK THE FIELD
*(int *) ((uint64_t) LocalStore + 0x3C) = 999;
LOGD("FIELD HOOKED");
}
old_update(instance);
}
Please look, did I do it right?No, LocalStore is NULL because it's not initialized. I suppose that you're trying to hook field in LocalStore through Update function outside the LocalStore class.
To fix your hook initialize LocalStore before hooking the field
void *LocalStore; //DECLARING A GLOBAL VARIABLE
void (*old_update)(void *instance);
void update(void *instance) {
if (instance != NULL) //CHECK IF INSTANCE IS NOT NULL
{
LocalStore = *(void **) ((uint64_t)instance + (LOCALSTORE OFFSET)); //INITIAZLIZING LOCALSTORE
if (LocalStore == NULL) return; //REMOVE USELESS THINGS
//THIS IS WHERE YOU CAN HOOK THE FIELD
*(int *) ((uint64_t) LocalStore + 0x3C) = 999;
LOGD("FIELD HOOKED");
}
old_update(instance);
}
void *LocalStore;No, LocalStore is NULL because it's not initialized. I suppose that you're trying to hook field in LocalStore through Update function outside the LocalStore class.
To fix your hook initialize LocalStore before hooking the field
void *LocalStore; //DECLARING A GLOBAL VARIABLE
void (*old_update)(void *instance);
void update(void *instance) {
if (instance != NULL) //CHECK IF INSTANCE IS NOT NULL
{
LocalStore = *(void **) ((uint64_t)instance + (LOCALSTORE OFFSET)); //INITIAZLIZING LOCALSTORE
if (LocalStore == NULL) return; //REMOVE USELESS THINGS
//THIS IS WHERE YOU CAN HOOK THE FIELD
*(int *) ((uint64_t) LocalStore + 0x3C) = 999;
LOGD("FIELD HOOKED");
}
old_update(instance);
}
void *LocalStore;No, LocalStore is NULL because it's not initialized. I suppose that you're trying to hook field in LocalStore through Update function outside the LocalStore class.
To fix your hook initialize LocalStore before hooking the field
void *LocalStore; //DECLARING A GLOBAL VARIABLE
void (*old_update)(void *instance);
void update(void *instance) {
if (instance != NULL) //CHECK IF INSTANCE IS NOT NULL
{
LocalStore = *(void **) ((uint64_t)instance + (LOCALSTORE OFFSET)); //INITIAZLIZING LOCALSTORE
if (LocalStore == NULL) return; //REMOVE USELESS THINGS
//THIS IS WHERE YOU CAN HOOK THE FIELD
*(int *) ((uint64_t) LocalStore + 0x3C) = 999;
LOGD("FIELD HOOKED");
}
old_update(instance);
}
Please look, did I do it right?
void *LocalStore;
void (*old_update)(void *instance);
void update(void *instance) {
if (instance != NULL)
{
LocalStore = *(void **) ((uint64_t)instance + (0x3C));
if (LocalStore == NULL) return;
*(int *) ((uint64_t) LocalStore + 0x3C) = 999;
LOGD("FIELD HOOKED");
}
old_update(instance);
}
Please look, did I do it right?
Thank you! But it doesn't work in both cases.No, remove the brackets like this
LocalStore = *(void **) ((uint64_t)instance + 0x3C);
Thank you! But it doesn't work in both cases.
Thank you!When you said it dosen't work, could you be more specific?
It doesn't work when building or the hook doesn't work?
If the hook doesn't work, try to check if 'LocalStore' is null
what it should look like:
void (*old_update)(void *instance);
void update(void *instance) {
if (instance != NULL)
{
LocalStore = *(void **) ((uint64_t)instance + 0x3C);
if (LocalStore != NULL)
{
*(int *) ((uint64_t) LocalStore + 0x3C) = 999;
LOGD("FIELD HOOKED");
old_update(instance);
}
}
old_update(instance);
}
Hello! Please help, I'm completely confused. Did I do right? The hook doesn't work! And how to correctly find the update method in the dump? I used any, probably it's not correct.When you said it dosen't work, could you be more specific?
It doesn't work when building or the hook doesn't work?
If the hook doesn't work, try to check if 'LocalStore' is null
what it should look like:
void (*old_update)(void *instance);
void update(void *instance) {
if (instance != NULL)
{
LocalStore = *(void **) ((uint64_t)instance + 0x3C);
if (LocalStore != NULL)
{
*(int *) ((uint64_t) LocalStore + 0x3C) = 999;
LOGD("FIELD HOOKED");
old_update(instance);
}
}
old_update(instance);
}
I don't know why it still doesn't work but maybe because of how you hooked the field? try to set to true or false not numberHello! Please help, I'm completely confused. Did I do right? The hook doesn't work! And how to correctly find the update method in the dump? I used any, probably it's not correct.
Thank you. I do not know what to do.I don't know why it still doesn't work but maybe because of how you hooked the field? try to set to true or false not number
Help me please! How to do it right?It didnt work bcs u using wrong update method, also theres no instance on that class pointing to class usersavedata
void* UserSaveData = *(void **) ((uint64_t) instance + 0x9); <--- your offset doesnt point to anything
We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share necessary information with our advertising and analytics partners to optimize your experience on our site.
Learn more about cookies
We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share necessary information with our advertising and analytics partners to optimize your experience on our site.
Learn more about cookies