mirror of
https://github.com/revanced/smali.git
synced 2025-04-29 22:24:26 +02:00
Use dlerror() to clear any error before retrying with the mangled name
Thanks to Catalin Ontanu for reporting this, and then doing more investigation to find and test the solution.
This commit is contained in:
parent
e6423bd1e1
commit
20d4a3c2b4
@ -48,18 +48,20 @@ void main(int argc, char **argv) {
|
||||
void *libdvm = dlopen("libdvm.so", RTLD_LAZY);
|
||||
|
||||
if (libdvm == NULL) {
|
||||
printf("Failed to load libdvm\n");
|
||||
printf("Failed to load libdvm: %s\n", dlerror());
|
||||
return;
|
||||
}
|
||||
|
||||
dvmGetInlineOpsTablePtr dvmGetInlineOpsTable = dlsym(libdvm, "dvmGetInlineOpsTable");
|
||||
|
||||
if (dvmGetInlineOpsTable == NULL) {
|
||||
// clear the error, and retry with the c++ mangled name
|
||||
dlerror();
|
||||
dvmGetInlineOpsTable = dlsym(libdvm, "_Z20dvmGetInlineOpsTablev");
|
||||
}
|
||||
|
||||
if (dvmGetInlineOpsTable == NULL) {
|
||||
printf("Failed to load dvmGetInlineOpsTable\n");
|
||||
printf("Failed to load dvmGetInlineOpsTable: %s\n", dlerror());
|
||||
dlclose(libdvm);
|
||||
return;
|
||||
}
|
||||
@ -67,11 +69,13 @@ void main(int argc, char **argv) {
|
||||
dvmGetInlineOpsTableLengthPtr dvmGetInlineOpsTableLength = dlsym(libdvm, "dvmGetInlineOpsTableLength");
|
||||
|
||||
if (dvmGetInlineOpsTableLength == NULL) {
|
||||
// clear the error, and retry with the c++ mangled name
|
||||
dlerror();
|
||||
dvmGetInlineOpsTableLength = dlsym(libdvm, "_Z26dvmGetInlineOpsTableLengthv");
|
||||
}
|
||||
|
||||
if (dvmGetInlineOpsTableLength == NULL) {
|
||||
printf("Failed to load dvmGetInlineOpsTableLength\n");
|
||||
printf("Failed to load dvmGetInlineOpsTableLength: %s\n", dlerror());
|
||||
dlclose(libdvm);
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user