update again

This commit is contained in:
Li 2024-04-17 19:36:15 +12:00
parent 41714fff62
commit a23e92b02d
3 changed files with 17 additions and 13 deletions

View File

@ -4,7 +4,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libpsmkdc_jni
LOCAL_CFLAGS := -Wno-error=format-security -fpermissive
LOCAL_CFLAGS += -fno-rtti -fno-exceptions
LOCAL_CFLAGS += -fno-rtti -fno-exceptions -fPIC
LOCAL_C_INCLUDES += $(MAIN_LOCAL_PATH)

View File

@ -9,7 +9,7 @@
static void* LIB_DEFAULT_HANDLE = NULL;
static void* LIB_DEFAULT_BASE = NULL;
int (*memcmp_orig)(char*, char*, int) = NULL;
int (*dlopen_orig)(char*, int) = NULL;
void* get_func_addr(char* function_name) {
if(LIB_DEFAULT_HANDLE != NULL){
@ -45,25 +45,23 @@ int get_addresses() {
}
int memcmp_patch(char* dst, char* src, int sz){
LOG("memcmp %p %p %x", dst, src, sz);
int dlopen_patch(char* lib, int param){
LOG("dlopen_patch %s %x", lib, param);
return memcmp_orig(dst, src, sz);
return dlopen_orig(lib, param);
}
int patch_libdefault() {
// hook the thing
int res = registerInlineHook((uintptr_t)memcmp, (uintptr_t)memcmp_patch, (uintptr_t**)&memcmp_orig);
LOG("res = %p", res);
res = inlineHook((uintptr_t)memcmp);
LOG("res = %p", res);
get_addresses();
LOG("HOOKING");
int res = registerInlineHook((uintptr_t)dlopen, (uintptr_t)dlopen_patch, (uintptr_t**)&dlopen_orig);
if(res == 0)
inlineHookAll();
//get_addresses();
return 0;
}

View File

@ -14,7 +14,9 @@ Java_com_playstation_psmKdcJni_Psmkdc_JNI_1scePsmDrmKdcInit(JNIEnv *env, jobject
jstring manu, jstring model, jstring product, jstring device,
jstring type) {
LOGFUNCTION();
patch_libdefault();
return 0;
}
@ -98,3 +100,7 @@ Java_com_playstation_psmKdcJni_Psmkdc_JNI_1scePsmDrmRemoveRif(JNIEnv *env, jobje
return 0;
}
/*JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
LOGFUNCTION();
return 0;
}*/