Skip to content

Commit

Permalink
Move #if outside macro call for windows compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmacete committed Jan 19, 2024
1 parent 2186ebb commit ddc768b
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions tests/gumjs/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -10908,6 +10908,7 @@ TESTCASE (cloaked_items_can_be_queried_added_and_removed)
{
void * buffer = malloc (64);

#if HAVE_ANDROID
COMPILE_AND_LOAD_SCRIPT (
"const x = ptr('0x%" G_GINT64_MODIFIER "x');"
"send(Cloak.hasRangeContaining(x) === false);"
Expand All @@ -10926,11 +10927,35 @@ 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);"
#if HAVE_ANDROID
"send(true);"

"const fd = 1;"
"Cloak.addFileDescriptor(fd);"
"send(Cloak.hasFileDescriptor(fd));"
"Cloak.removeFileDescriptor(fd);"
"send(!Cloak.hasFileDescriptor(fd));",
GPOINTER_TO_SIZE (buffer)
);
#else
COMPILE_AND_LOAD_SCRIPT (
"const x = ptr('0x%" G_GINT64_MODIFIER "x');"
"send(Cloak.hasRangeContaining(x) === false);"
"send(Process.findRangeByAddress(x) !== null);"
"send(Cloak.clipRange(x, 64) === null);"
"Cloak.addRange(x, 64);"
"send(Cloak.hasRangeContaining(x));"
"send(Process.findRangeByAddress(x) === null);"
"send(Cloak.clipRange(x, 64).length === 0);"
"Cloak.removeRange(x, 64);"

"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(Process.enumerateThreads().map(x => x.id).includes(threadId));"
#endif

"const fd = 1;"
"Cloak.addFileDescriptor(fd);"
Expand All @@ -10939,6 +10964,7 @@ TESTCASE (cloaked_items_can_be_queried_added_and_removed)
"send(!Cloak.hasFileDescriptor(fd));",
GPOINTER_TO_SIZE (buffer)
);
#endif
EXPECT_SEND_MESSAGE_WITH ("true");
EXPECT_SEND_MESSAGE_WITH ("true");
EXPECT_SEND_MESSAGE_WITH ("true");
Expand Down

0 comments on commit ddc768b

Please sign in to comment.