Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 11 additions & 25 deletions BaseBin/rootlesshooks/SpringBoard.x
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,17 @@ bool string_has_prefix(const char *str, const char* prefix)

%end

%hookf(int, fcntl, int fildes, int cmd, ...) {
if (cmd == F_SETPROTECTIONCLASS) {
char filePath[PATH_MAX];
if (fcntl(fildes, F_GETPATH, filePath) != -1) {
// Skip setting protection class on jailbreak apps, this doesn't work and causes snapshots to not be saved correctly
if (string_has_prefix(filePath, JBROOT_PATH_CSTRING("/var/mobile/Library/SplashBoard/Snapshots"))) {
return 0;
}
}
}

va_list a;
va_start(a, cmd);
const char *arg1 = va_arg(a, void *);
const void *arg2 = va_arg(a, void *);
const void *arg3 = va_arg(a, void *);
const void *arg4 = va_arg(a, void *);
const void *arg5 = va_arg(a, void *);
const void *arg6 = va_arg(a, void *);
const void *arg7 = va_arg(a, void *);
const void *arg8 = va_arg(a, void *);
const void *arg9 = va_arg(a, void *);
const void *arg10 = va_arg(a, void *);
va_end(a);
return %orig(fildes, cmd, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
int __fcntl(int fd, int cmd, long arg);
%hookf(int, __fcntl, int fd, int cmd, long arg)
{
if (cmd == F_SETPROTECTIONCLASS) {
char path[PATH_MAX];
if (%orig(fd, F_GETPATH, (long)path) != -1 && string_has_prefix(path, JBROOT_PATH_CSTRING("/var/mobile/Library/SplashBoard/Snapshots")))
{
return 0; // Skip setting protection class on jailbreak apps, this doesn't work and causes snapshots to not be saved correctly
}
}
return %orig(fd, cmd, arg);
}

void springboardInit(void)
Expand Down
Loading