fix xiaomi.eu

This commit is contained in:
chiteroman
2023-11-14 13:57:07 +01:00
parent 9e4fcf39ce
commit ef920ff012
3 changed files with 13 additions and 10 deletions

View File

@@ -51,5 +51,4 @@ Their devs are already working on it: [click me](https://xiaomi.eu/community/thr
If Xiaomi.eu devs drop support for your device and this module doesn't work you must change the ROM if you want to pass DEVICE verdict. If Xiaomi.eu devs drop support for your device and this module doesn't work you must change the ROM if you want to pass DEVICE verdict.
## Thanks to ## Thanks to
- [libcxx-prefab](https://github.com/RikkaW/libcxx-prefab)
- [Dobby](https://github.com/jmpews/Dobby) - [Dobby](https://github.com/jmpews/Dobby)

View File

@@ -24,7 +24,7 @@ android {
externalNativeBuild { externalNativeBuild {
cmake { cmake {
arguments += "-DANDROID_STL=none" arguments += "-DANDROID_STL=none"
arguments += "-DCMAKE_BUILD_TYPE=Release" arguments += "-DCMAKE_BUILD_TYPE=MinSizeRel"
cFlags += "-fvisibility=hidden" cFlags += "-fvisibility=hidden"
cFlags += "-fvisibility-inlines-hidden" cFlags += "-fvisibility-inlines-hidden"

View File

@@ -45,6 +45,11 @@ my_system_property_read_callback(const prop_info *pi,
static void doHook() { static void doHook() {
void *handle = DobbySymbolResolver("libc.so", "__system_property_read_callback"); void *handle = DobbySymbolResolver("libc.so", "__system_property_read_callback");
if (handle == nullptr) {
LOGD("Couldn't find '__system_property_read_callback' handle. Report to @chiteroman");
return;
}
LOGD("Found '__system_property_read_callback' handle at %p", handle);
DobbyHook(handle, (void *) my_system_property_read_callback, DobbyHook(handle, (void *) my_system_property_read_callback,
(void **) &o_system_property_read_callback); (void **) &o_system_property_read_callback);
} }
@@ -92,18 +97,17 @@ public:
long size = 0; long size = 0;
read(fd, &size, sizeof(size)); read(fd, &size, sizeof(size));
if (size > 0) { if (size < 1) {
char buffer[size];
read(fd, buffer, size);
close(fd); close(fd);
LOGD("Couldn't load classes.dex, does the file exist?");
moduleDex.insert(moduleDex.end(), buffer, buffer + size);
return; return;
} }
char buffer[size];
read(fd, buffer, size);
moduleDex.insert(moduleDex.end(), buffer, buffer + size);
close(fd); close(fd);
} }