-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed companion NS and moved code to namespaces
- Loading branch information
Showing
10 changed files
with
159 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,31 @@ | ||
#pragma once | ||
#include <string> | ||
#include <errno.h> | ||
#include <functional> | ||
#include "logging.hpp" | ||
#include "zygisk.hpp" | ||
|
||
#define DCL_HOOK_FUNC(ret, func, ...) \ | ||
ret (*old_##func)(__VA_ARGS__) = nullptr; \ | ||
#define DCL_HOOK_FUNC(ret, func, ...) \ | ||
ret (*old_##func)(__VA_ARGS__) = nullptr; \ | ||
ret new_##func(__VA_ARGS__) | ||
|
||
#define ASSERT_LOG(tag, expr) if(!(expr)) { \ | ||
LOGE("%s:%d Assertion %s failed. %d:%s", tag, __LINE__, #expr, errno, std::strerror(errno)); } | ||
#define ASSERT_LOG(tag, expr) \ | ||
if (!(expr)) \ | ||
{ \ | ||
LOGE("%s:%d Assertion %s failed. %d:%s", #tag, __LINE__, #expr, errno, std::strerror(errno)); \ | ||
} | ||
|
||
#define ASSERT_EXIT(tag, expr, ret) if(!(expr)) { \ | ||
LOGE("%s:%d Assertion %s failed. %d:%s", tag, __LINE__, #expr, errno, std::strerror(errno)); \ | ||
ret; } | ||
#define ASSERT_DO(tag, expr, ret) \ | ||
if (!(expr)) \ | ||
{ \ | ||
LOGE("%s:%d Assertion %s failed. %d:%s", #tag, __LINE__, #expr, errno, std::strerror(errno)); \ | ||
ret; \ | ||
} | ||
|
||
bool switchMountNS(int pid); | ||
int isUserAppUID(int uid); | ||
bool hookPLTByName(zygisk::Api *api, const std::string &libName, const std::string &symbolName, void *hookFunc, void **origFunc); | ||
namespace Utils | ||
{ | ||
bool switchMountNS(int pid); | ||
int isUserAppUID(int uid); | ||
bool hookPLTByName(zygisk::Api *api, const std::string &libName, const std::string &symbolName, void *hookFunc, void **origFunc); | ||
int executeLambdaInFork(const std::function<void()> &lambda); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.