From 66080bba0ab0742e96eba8102f22ca12831a4ba6 Mon Sep 17 00:00:00 2001 From: Francesco Tamagni Date: Fri, 19 Jan 2024 18:25:55 +0100 Subject: [PATCH] Almost there --- tests/gumjs/script.c | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/tests/gumjs/script.c b/tests/gumjs/script.c index c1dd44449..ee695624d 100644 --- a/tests/gumjs/script.c +++ b/tests/gumjs/script.c @@ -10907,37 +10907,14 @@ TESTCASE (java_api_is_embedded) TESTCASE (cloaked_items_can_be_queried_added_and_removed) { void * buffer = malloc (64); - #if HAVE_ANDROID - COMPILE_AND_LOAD_SCRIPT ( - "const testRange = { base: ptr('0x%" G_GINT64_MODIFIER "x'), size: 64 };" - "send(Cloak.hasRangeContaining(testRange.base) === false);" - "send(Process.findRangeByAddress(testRange.base) !== null);" - "send(Cloak.clipRange(testRange) === null);" - "Cloak.addRange(testRange);" - "send(Cloak.hasRangeContaining(testRange.base));" - "send(Process.findRangeByAddress(testRange.base) === null);" - "send(Cloak.clipRange(testRange).length === 0);" - "Cloak.removeRange(testRange);" - - "send(Cloak.hasCurrentThread() === false);" - "const threadId = Process.getCurrentThreadId();" - "send(Cloak.hasThread(threadId) === false);" - "Cloak.addThread(threadId);" - "send(!Process.enumerateThreads().map(x => x.id).includes(threadId));" - "send(Cloak.hasCurrentThread() === true);" - "Cloak.removeThread(threadId);" - "send(true);" - - "const fd = 1;" - "Cloak.addFileDescriptor(fd);" - "send(Cloak.hasFileDescriptor(fd));" - "Cloak.removeFileDescriptor(fd);" - "send(!Cloak.hasFileDescriptor(fd));", - GPOINTER_TO_SIZE (buffer) - ); + const gchar * is_android = "true"; #else + const gchar * is_android = "false"; +#endif + COMPILE_AND_LOAD_SCRIPT ( + "const isAndroid = %s;" "const testRange = { base: ptr('0x%" G_GINT64_MODIFIER "x'), size: 64 };" "send(Cloak.hasRangeContaining(testRange.base) === false);" "send(Process.findRangeByAddress(testRange.base) !== null);" @@ -10955,16 +10932,20 @@ TESTCASE (cloaked_items_can_be_queried_added_and_removed) "send(!Process.enumerateThreads().map(x => x.id).includes(threadId));" "send(Cloak.hasCurrentThread() === true);" "Cloak.removeThread(threadId);" - "send(Process.enumerateThreads().map(x => x.id).includes(threadId));" + "if (isAndroid) {" + " send(true);" + "} else {" + " send(Process.enumerateThreads().map(x => x.id).includes(threadId));" + "}" "const fd = 1;" "Cloak.addFileDescriptor(fd);" "send(Cloak.hasFileDescriptor(fd));" "Cloak.removeFileDescriptor(fd);" "send(!Cloak.hasFileDescriptor(fd));", + is_android, GPOINTER_TO_SIZE (buffer) ); -#endif EXPECT_SEND_MESSAGE_WITH ("true"); EXPECT_SEND_MESSAGE_WITH ("true"); EXPECT_SEND_MESSAGE_WITH ("true");