You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#include <iostream>
|
|
|
|
#include "shithook.hpp"
|
|
|
|
|
|
|
|
__attribute__((noinline))
|
|
|
|
FILE* hook_test(const char* filename, const char* open_type)
|
|
|
|
{
|
|
|
|
std::printf("> filename = %s\n", filename);
|
|
|
|
std::printf("> open type = %s\n", open_type);
|
|
|
|
std::getchar();
|
|
|
|
|
|
|
|
return hook::get_func(&fopen)(filename, open_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
hook::make_hook(&fopen, &hook_test);
|
|
|
|
auto result = fopen("/proc/self/maps", "r");
|
|
|
|
|
|
|
|
std::printf("> finished demo... handle = %p\n", result);
|
|
|
|
std::getchar();
|
|
|
|
}
|