JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	MSHookFunction((void*) &SimpleHouse::postProcess, (void*) &SimpleHouse$postProcess, (void**) &_SimpleHouse$postProcess);
	MSHookFunction((void*) &MineshaftCorridor::postProcess, (void*) &MineshaftCorridor$postProcess, (void**) &_MineshaftCorridor$postProcess);
	MSHookFunction((void*) &DesertPyramidPiece::postProcess, (void*) &DesertPyramidPiece$postProcess, (void**) &_DesertPyramidPiece$postProcess);

	return JNI_VERSION_1_2;
}
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	void* stopTicks = dlsym(RTLD_DEFAULT, "_ZN13CircuitSystem8evaluateEv");
	MSHookFunction(stopTicks, (void*) &_stopTicks, (void**) NULL);
	MSHookFunction((void*) &Block::initBlocks, (void*) &initBlockVtables, (void**) &_initBlocks);
	
	return JNI_VERSION_1_2;
}
示例#3
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	MSHookFunction((void*) &ItemInHandRenderer::render, (void*) &ItemInHandRenderer$render, (void**) &_ItemInHandRenderer$render);
	MSHookFunction((void*) &Item::initItems, (void*) &Item$initItems, (void**) &_Item$initItems);
	MSHookFunction((void*) &Item::useOn, (void*) &Item$useOn, (void**) &_Item$useOn);
	//MSHookFunction((void*) &Gui::renderSlot, (void*) &Gui$renderSlot, (void**) &_Gui$renderSlot);
	return JNI_VERSION_1_2;
}
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	void* I18n_get = dlsym(RTLD_DEFAULT, "_ZN4I18n3getERKSsRKSt6vectorISsSaISsEE");
    MSHookFunction((void*) &Tile::initTiles, (void*) &Tile$initTiles, (void**) &_Tile$initTiles);
	MSHookFunction((void*) &Item::initCreativeItems, (void*) &Item$initCreativeItems, (void**) &_Item$initCreativeItems);
	MSHookFunction(I18n_get, (void*) &I18n$get, (void**) &_I18n$get);
	
	return JNI_VERSION_1_2;
}
示例#5
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {

    MSHookFunction((void*) &Item::initItems, (void*) &Item$initItems, (void**) &_Item$initItems); //hooking
    MSHookFunction((void*) &Item::initCreativeItems, (void*) &Item$initCreativeItems, (void**) &_Item$initCreativeItems); //more hooking
    MSHookFunction((void*) &I18n::get, (void*) &I18n$get, (void**) &_I18n$get); //even MOAR hooking

	return JNI_VERSION_1_2;
}
示例#6
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	MSHookFunction((void*) &Item::initItems, (void*) &Item_initItems_hook, (void**) &Item_initItems_real);
	MSHookFunction((void*) &Tile::initTiles, (void*) &Tile_initTiles_hook, (void**) &Tile_initTiles_real);
	MSHookFunction((void*) &MinecraftClient::init, (void*) &MinecraftClient_init_hook, (void**) &MinecraftClient_init_real);
	MSHookFunction((void*) &TileTessellator::tessellateInWorld, (void*) &TileTessellator_tessellateInWorld_hook, (void**) &TileTessellator_tessellateInWorld_real);
	MSHookFunction((void*) &TileEntity::initTileEntities, (void*) &TileEntity_initTileEntities_hook, (void**) &TileEntity_initTileEntities_real);
	
	return JNI_VERSION_1_2;
}
示例#7
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	MSHookFunction((void*) &Item::initItems, (void*) &initItems, (void**) &_initItems);
	MSHookFunction((void*) &Item::initCreativeItems, (void*) &initCreativeItems, (void**) &_initCreativeItems);
	
	/* Supaya enderman ngeluarin enderpearls pas mati */
	void** EnderMan_vtable = (void**) ((uintptr_t) dlsym(RTLD_DEFAULT, "_ZTV8EnderMan") + 8);
	EnderMan_vtable[193] = (void*) &getEnderManDrop;

	return JNI_VERSION_1_2; // Langsung return JNI-nya
}
示例#8
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	MSHookFunction((void*) &Item::initItems, (void*) &initItems, (void**) &_initItems);
	MSHookFunction((void*) &Item::initCreativeItems, (void*) &initCreativeItems, (void**) &_initCreativeItems);
	
	/* Make EnderMan drop pearls */
	void** EnderMan_vtable = (void**) ((uintptr_t) dlsym(RTLD_DEFAULT, "_ZTV8EnderMan") + 8);
	EnderMan_vtable[193] = (void*) &getEnderManDrop;

	return JNI_VERSION_1_2;
}
示例#9
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
    void* handle = dlopen("libminecraftpe.so", RTLD_LAZY);

	gSplashes = (char**) dlsym(handle, "gSplashes");
	
	MSHookFunction((void*) &Touch::StartMenuScreen::chooseRandomSplash, (void*) &Touch$StartMenuScreen$chooseRandomSplash_hook, (void**) &Touch$StartMenuScreen$chooseRandomSplash_real);
	
	srand(time(0));

void* getGameVersionString = dlsym(RTLD_DEFAULT, "_ZN6Common20getGameVersionStringEv");

	MSHookFunction(getGameVersionString, (void*)&getGameVersionString_hook, (void**)&getGameVersionString_real);
	return JNI_VERSION_1_2;
}
示例#10
0
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
	void *handle = dlopen("libminecraftpe.so", RTLD_LAZY);
	
	void* Font$$Font = dlsym(handle, "_ZN4FontC1EP7OptionsRKSsP8Textures");
	void* Gui$$Gui = dlsym(handle, "_ZN3GuiC2ER15MinecraftClient");
	MSHookFunction(Font$$Font, (void*) &Font$Font_hook, (void**) &Font$Font_real);
	MSHookFunction(Gui$$Gui, (void*) &Gui$Gui_hook, (void**) &Gui$Gui_real);
	MSHookFunction((void*) &mouseDown, (void*) &mouseDown_hook, (void**) &mouseDown_real);
	MSHookFunction((void*) &Gui::render, (void*) &Gui$render_hook, (void**) &Gui$render_real);
	MSHookFunction((void*) &Level::onSourceCreated, (void*) &Level$onSourceCreated_hook, (void**) &Level$onSourceCreated_real);
	//MSHookFunction((void*) CreativeInventoryScreen::populateItem, (void*) &CreativeInventoryScreen$populateItem_hook, (void**) &CreativeInventoryScreen$populateItem_real);
	
	return JNI_VERSION_1_2;
}
示例#11
0
void init(void) {
	void *handle = dlopen(NULL, RTLD_NOW | RTLD_GLOBAL);
	printf("hooker handle = %p\n", handle);
	void *fact = dlsym(handle, "fact");
	printf("hooker fact = %p\n", fact);
	MSHookFunction(fact, (void *)my_fact, (void **)&orig_fact);
}
示例#12
0
JNIEXPORT void JNICALL Java_com_byteandahalf_genericlauncher_NativeHandler_nativeSetupHooks
  (JNIEnv *env, jclass clazz) {
	__android_log_print(ANDROID_LOG_INFO,"GenericLauncher","SetupHook");
  	// Let's not call every hook 3.000.000 times, OK?
  	if(HEY_FUNCTIONS_HOOKED_ALREADY_BRO == true) return;

  	void *handle;
  	handle = dlopen("libminecraftpe.so", RTLD_LAZY);
  	soinfo2* weakhandle = (soinfo2*) dlopen("libminecraftpe.so", RTLD_LAZY);


  	/*void* hk_Minecraft_setLevel = dlsym(handle, "_ZN9Minecraft8setLevelEP5LevelRKSsP11LocalPlayer");
  	MSHookFunction(hk_Minecraft_setLevel, (void*) &hk_Minecraft_setLevel_hook, (void**) &hk_Minecraft_setLevel_real);

  	void* hk_Minecraft_leaveGame = dlsym(handle, "_ZN9Minecraft9leaveGameEbb");
  	MSHookFunction(hk_Minecraft_leaveGame, (void*) &hk_Minecraft_leaveGame_hook, (void**) &hk_Minecraft_leaveGame_real);*/

//    	void* hk_Common_getGameVersionString = dlsym(handle, "_ZN6Common20getGameVersionStringEv");
//    	MSHookFunction(hk_Common_getGameVersionString, (void*) &hk_Common_getGameVersionString_hook, (void**) &hk_Common_getGameVersionString_real);

	void* hk_MinecraftClient_init = dlsym(handle,"_ZN15MinecraftClient4initEv");
	MSHookFunction(hk_MinecraftClient_init,(void*) &hk_MinecraftClient_init_hook,(void**) &hk_MinecraftClient_init_real);

  	dlerror();

  	jclass clz = env->FindClass("com/byteandahalf/genericlauncher/NativeHandler");
  	nativehandler_class = (jclass) env->NewGlobalRef(clz); // No idea why I have to cast to a jclass
  	
  	HEY_FUNCTIONS_HOOKED_ALREADY_BRO = true;

  	const char* myerror = dlerror();
	if (myerror != NULL) {
		__android_log_print(ANDROID_LOG_ERROR, "HALP", "Hooking errors: %s\n", myerror);
	}
}
示例#13
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	// use Substrate to hook the ItemInHandRenderer method.
	// MSHookFunction will modify ItemInHandRenderer::render so that
	// whenever someone tries to call the render method,
	// it will go to our hook method, above, instead.
	MSHookFunction((void*) &ItemInHandRenderer::render, (void*) &ItemInHandRenderer_render_hook, (void**)&ItemInHandRenderer_render_real);
	return JNI_VERSION_1_2;
}
示例#14
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	LOGI("We will make the coolest mod ever! :-)!");

	void* useItemOn = dlsym(RTLD_DEFAULT, "_ZN8GameMode9useItemOnER6PlayerP12ItemInstanceRK7TilePosaRK4Vec3");	
	MSHookFunction(useItemOn, (void*) &GameMode$useItemOn_hook, (void**) &GameMode$useItemOn_real);	

	return JNI_VERSION_1_2;
}
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	  
  	void *handle;
  	handle = dlopen("libminecraftpe.so", RTLD_LAZY);
  	soinfo2* weakhandle = (soinfo2*) dlopen("libminecraftpe.so", RTLD_LAZY);

	void* hook_Gui_tick = dlsym(handle, "_ZN3Gui4tickEv");
	MSHookFunction(hook_Gui_tick, (void*) &hook_Gui_tick_mod, (void**) &hook_Gui_tick_orig);
	
  	return JNI_VERSION_1_2;
}
示例#16
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	void* I18n_get = dlsym(RTLD_DEFAULT, "_ZN4I18n3getERKSsRKSt6vectorISsSaISsEE");
	MSHookFunction((void*) &Gui::render, (void*) &Gui_render_hook, (void**) &Gui_render_real);
    MSHookFunction((void*) &Minecraft::selectLevel, (void*) &Minecraft_selectLevel_hook, (void**) &Minecraft_selectLevel_real);
	MSHookFunction((void*) &Item::initItems, (void*) &Item_initItems_hook, (void**) &Item_initItems_real);
    MSHookFunction((void*) &Tile::initTiles, (void*) &Tile_initTiles_hook, (void**) &Tile_initTiles_real);
	MSHookFunction((void*) &Item::initCreativeItems, (void*) &Item_initCreativeItems_hook, (void**) &Item_initCreativeItems_real);
	MSHookFunction((void*) &TileTessellator::tessellateInWorld, (void*) &TileTessellator_tessellateInWorld_hook, (void**) &TileTessellator_tessellateInWorld_real);
	MSHookFunction(I18n_get, (void*) &I18n_get_hook, (void**) &I18n_get_real);
    return JNI_VERSION_1_2;
}
示例#17
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) 
{

	MSHookFunction((void*) &SurvivalInventoryScreen::_updateCraftableItems, (void*) &SurvivalInventoryScreen$_updateCraftableItems, (void**)&_SurvivalInventoryScreen$_updateCraftableItems);
	MSHookFunction((void*) &MinecraftClient::init, (void*) &MinecraftClient$init, (void**) &_MinecraftClient$init);
	MSHookFunction((void*) &Block::initBlocks, (void*) &Block$initBlocks, (void**) &_Block$initBlocks);
	MSHookFunction((void*) &BlockEntity::initBlockEntities, (void*) &BlockEntity$initBlockEntities, (void**) &_BlockEntity$initBlockEntities);
	MSHookFunction((void*) &Item::initItems, (void*) &Item$initItems, (void**) &_Item$initItems);
	MSHookFunction((void*) &Item::initCreativeItems, (void*) &Item$initCreativeItems, (void**) &_Item$initCreativeItems);
	//MSHookFunction((void*) &Recipies::initRecipies, (void*) &Recipies$initRecipies, (void**) &_Recipies$initRecipies);
	
	MSHookFunction((void*) &I18n::get, (void*) &I18n$get, (void**) &_I18n$get);

	MSHookFunction((void*) &BlockEntityFactory::createBlockEntity, (void*) &BlockEntityFactory$createBlockEntity, (void**) &_BlockEntityFactory$createBlockEntity);


	return JNI_VERSION_1_2;
}
示例#18
0
JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved)
{
	soinfo2 *handle = (soinfo2 *) dlopen("libminecraftpe.so", RTLD_LAZY);

	void *initOptionObservers = dlsym(handle, "_ZN15MinecraftClient19initOptionObserversEv");
	void *generateOptionScreens = dlsym(handle, "_ZN13OptionsScreen21generateOptionScreensEv");
	void *setIntOption = dlsym(handle, "_ZN7Options3setEPKNS_6OptionEi");

	//MSHookFunction((void *) &Gui::renderToolBar, (void *) &Gui$renderToolBar_hook, (void **) &Gui$renderToolBar_real);
	MSHookFunction((void *) &MinecraftClient::setSize, (void *) &MinecraftClient$setSize_hook, (void **) &MinecraftClient$setSize_real);
	MSHookFunction(initOptionObservers, (void *) &MinecraftClient$initOptionObservers_hook, (void **) &MinecraftClient$initOptionObservers_real);
	MSHookFunction(generateOptionScreens, (void *) &OptionsScreen$_generateOptionScreens_hook, (void **) &OptionsScreen$_generateOptionScreens_real);
	MSHookFunction((void *) &Options::getValues, (void *) &Options$getValues_hook, (void **) &Options$getValues_real);
	MSHookFunction((void *) &Options::getIntValue, (void *) &Options$getIntValue_hook, (void **) &Options$getIntValue_real);
	MSHookFunction(setIntOption, (void *) &Options$setI_hook, (void **) &Options$setI_real);
	MSHookFunction((void *) &Options::save, (void *) &Options$save_hook, (void **) &Options$save_real);
	MSHookFunction((void *) &Options::_load, (void *) &Options$_load_hook, (void **) &Options$_load_real);

	return JNI_VERSION_1_2;
}
示例#19
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	MSHookFunction((void*) &Block::initBlocks, (void*) &Block$initBlocks, (void**) &_Block$initBlocks);
	MSHookFunction((void*) &Item::initCreativeItems, (void*) &Item$initCreativeItems, (void**) &_Item$initCreativeItems);
	
	return JNI_VERSION_1_2;
}
示例#20
0
JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved){
	MSHookFunction((void*)VillageFeature::isFeatureChunk,(void*)&hook,(void**) &_hook);
	return JNI_VERSION_1_2;
}
示例#21
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	MSHookFunction((void*) &Tile::initTiles, 					(void*) &Tile$initTiles, 						(void**) &_Tile$initTiles);
	MSHookFunction((void*) &TileTessellator::tessellateInWorld, (void*) &TileTessellator$tessellateInWorld, 	(void**) &_TileTessellator$tessellateInWorld);
	return JNI_VERSION_1_2;
}
示例#22
0
void CustomLevel::setupHooks()
{
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN5Level12removeEntityER6Entityb"), (void *)&removeEntity, (void **)&removeEntity_real);
}
void cigi_hook(void *orig_fcn, void* new_fcn, void **orig_fcn_ptr)
{
	MSHookFunction(orig_fcn, new_fcn, orig_fcn_ptr);
}
示例#24
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	MSHookFunction((void*) &MinecraftClient::init, (void*) &MinecraftClient_init_hook, (void**) &MinecraftClient_init_real);
	return JNI_VERSION_1_2;
}
示例#25
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	MSHookFunction((void*) &MinecraftClient::init, (void*) &MinecraftClient$init_hook, (void**) &MinecraftClient$init_real);
	//MSHookFunction((void*) &GameMode::attack, (void*) &GameMode$attack_hook, (void**) &GameMode$attack_real); // Used when an arrow attacks any mob/entity
	//MSHookFunction((void*) &GameMode::initPlayer, (void*) &GameMode$initPlayer_hook, (void**) &GameMode$initPlayer_real); // Used for stealing the player
	return JNI_VERSION_1_2;
}
示例#26
0
 JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
 {

  if(intifinit)
  {
    return JNI_VERSION_1_6;
  }
  intifinit = 1;
  MSImageRef image_time;
  image_time = MSGetImageByName("/system/lib/libc.so");

  int (*gettimeofday_org)(struct timeval*tv, struct timezone *tz);
  gettimeofday_org = (int (*)(struct timeval*tv, struct timezone *tz)) MSFindSymbol(image_time, "gettimeofday");

  int (*clock_gettime_org)(clockid_t clk_id,struct timespec *tp);
  clock_gettime_org = (int (*)(clockid_t clk_id,struct timespec *tp)) MSFindSymbol(image_time, "clock_gettime");
  
 
  //MSHookFunction((void *)gettimeofday_org, (void*)gettimeofday_hook, (void**)&gettimeofday_f);
  //MSHookFunction((void *)clock_gettime_org, (void*)clock_gettime_hook, (void**)&clock_gettime_f);


 	MSImageRef image;
 	image = MSGetImageByName("/data/data/com.babeltime.fknsango_gwphone/lib/libgame.so");
  LOGD("image is %d" , image) ;
 	void *(*lua_loadbuffer_org_sym)(void *,  char *s, long len,void *s2,void *s5);
 	lua_loadbuffer_org_sym = (void * (*)(void *,  char *s, long len,void *s2,void *s5)) MSFindSymbol(image, "luaL_loadbufferx");
	//lua_gettop =(int (*) (void*)) MSFindSymbol(image, "lua_gettop") ;
 	lua_pcall= (int (*) (void *L, int nargs, int nresults, int errfunc))MSFindSymbol(image, "lua_pcall") ; 
  lua_gettop= (int (*) (void *L))MSFindSymbol(image, "lua_gettop") ; 
  lua_type= (int (*)(void *L,int i))MSFindSymbol(image, "lua_type") ; 
  lua_typename= (char* (* )(void *L, int a2))MSFindSymbol(image, "lua_typename") ; 
  lua_tolstring= (char* (*)(void *L, signed int a2, int a3))MSFindSymbol(image, "lua_tolstring") ; 
  _Z17getPackageNameJNIv = (  char* (* )(std::string &s  ))  MSFindSymbol(image, "_Z17getPackageNameJNIv");
  
  ; 
  _ZN7cocos2d18CCFileUtilsAndroid15getWritablePathEv = (std::string (*)(int a1)) MSFindSymbol(image,"_ZN7cocos2d18CCFileUtilsAndroid15getWritablePathEv") ;
  MSHookFunction((void *)_ZN7cocos2d18CCFileUtilsAndroid15getWritablePathEv, (void*)my_ZN7cocos2d18CCFileUtilsAndroid15getWritablePathEv, (void**)&_ZN7cocos2d18CCFileUtilsAndroid15getWritablePathEv);



	//lua_getfield = ( void (*) (void *L, int index, const char *k)) MSFindSymbol(image, "lua_getfield") ; 
	//MSHookFunction( (void *)lua_getfield,(void*)mylua_getfield,(void**)&lua_getfield);
	if(lua_loadbuffer_org_sym != NULL)
 	 {
 	 	//LOGD("lua_pushlstring_org_sym is %p!!!!!!!!!!!!\n",lua_loadbuffer_org_sym);
 	 	MSHookFunction((void *)lua_loadbuffer_org_sym, (void*)lua_loadbuffer_hook, (void**)&lua_loadbuffer_f);
 	 }
 	 else
 	 {
 	 //	LOGD("lua_pushlstring_org no find!!!!!!!!!!!!!!!!!!\n");
 	 }
   
 




 	//以下为hook java的,为了显示按钮
  JNIEnv *env = GetEnv(vm);
  MSImageRef dvm_image = MSGetImageByName("/system/lib/libc.so");
  void *gp = dlopen("/data/data/com.youzu.snsgz.linyou.youmi/lib/libsubstrate-dvm.so",RTLD_LAZY);
  cydia_dvm_image = MSGetImageByName("/data/data/sh.lilith.dgame.lemon/lib/libsubstrate-dvm.so");
  LOGD("dlopen %d , dvm %d" , gp , cydia_dvm_image) ; 

  jclass gameutil = env->FindClass("com/youzu/sanguohero/GameUtils");
  jmethodID getBRAND = env->GetStaticMethodID( gameutil, "getBRAND","()Ljava/lang/String;");
  jstring jstr =  (jstring)env->CallStaticObjectMethod( gameutil,getBRAND);
  const char* str;  
  str = env->GetStringUTFChars(jstr, false);  
  LOGD("getBRAND %s" , str) ; 
  if( strstr(str,"Meizu") != NULL) {
      return JNI_VERSION_1_6 ;
  }

  find_method = (void (*)(JNIEnv *, jclass , jmethodID , void *, void **)) MSFindSymbol(cydia_dvm_image, "MSJavaHookMethod");
  const char *target_class = "android/app/Instrumentation";//对大部分app来说,这是一个父类
  jvm_org = vm;
  jclass clazzTarget = env->FindClass(target_class);
   
  const char *fun_show = "init",*fun_hid = "hidden";
  javaClientClass_org = env->FindClass("com/youzu/sanguohero/TestWM");
   
  inject_method_show = env->GetStaticMethodID(javaClientClass_org, fun_show, "(Landroid/app/Activity;)V");
  
  inject_method_hidden = env->GetStaticMethodID(javaClientClass_org, fun_hid, "(Landroid/app/Activity;)V");
   
  //显示按钮
  jmethodID method_resume = env->GetMethodID(clazzTarget,
                 "callActivityOnResume",
                 "(Landroid/app/Activity;)V"
             );

  //隐藏按钮
  jmethodID method_pause = env->GetMethodID(clazzTarget,
                   "callActivityOnPause",
                   "(Landroid/app/Activity;)V"
               );


  find_method(env, clazzTarget, method_resume, reinterpret_cast<void *>(&newCodejava_show),reinterpret_cast<void **>(&oldCode_java_show));
  find_method(env, clazzTarget, method_pause, reinterpret_cast<void *>(&newCodejava_hidden),reinterpret_cast<void **>(&oldCode_java_hidden));

  DetachCurrent(vm);
   
  return JNI_VERSION_1_6;
 }
void CustomServerNetworkHandler::setupHooks()
{
	void **ServerNetworkHandler_vtable = GetVtable("_ZTV20ServerNetworkHandler");
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler12onDisconnectERKN6RakNet10RakNetGUIDERKSs"), (void *)&onDisconnect, (void **)&onDisconnect_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler21allowIncomingPacketIdERKN6RakNet10RakNetGUIDEi"), (void *)&allowIncomingPacketId, (void **)&allowIncomingPacketId_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP11LoginPacket"), (void *)&handleLogin, (void **)&handleLogin_real);
	VirtualHook(ServerNetworkHandler_vtable, 11, (void *)&handleSetTime, (void **)&handleSetTime_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP10TextPacket"), (void *)&handleText, (void **)&handleText_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP16MoveEntityPacket"), (void *)&handleMoveEntity, (void **)&handleMoveEntity_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP16MovePlayerPacket"), (void *)&handleMovePlayer, (void **)&handleMovePlayer_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP17RemoveBlockPacket"), (void *)&handleRemoveBlock, (void **)&handleRemoveBlock_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP17EntityEventPacket"), (void *)&handleEntityEvent, (void **)&handleEntityEvent_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP18MobEquipmentPacket"), (void *)&handleMobEquipment, (void **)&handleMobEquipment_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP23MobArmorEquipmentPacket"), (void *)&handleMobArmorEquipment, (void **)&handleMobArmorEquipment_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP14InteractPacket"), (void *)&handleInteract, (void **)&handleInteract_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP13UseItemPacket"), (void *)&handleUseItem, (void **)&handleUseItem_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP18PlayerActionPacket"), (void *)&handlePlayerAction, (void **)&handlePlayerAction_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP14DropItemPacket"), (void *)&handleDropItem, (void **)&handleDropItem_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP20ContainerClosePacket"), (void *)&handleContainerClose, (void **)&handleContainerClose_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP22ContainerSetSlotPacket"), (void *)&handleContainerSetSlot, (void **)&handleContainerSetSlot_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP25ContainerSetContentPacket"), (void *)&handleContainerSetContent, (void **)&handleContainerSetContent_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP19CraftingEventPacket"), (void *)&handleCraftingEvent, (void **)&handleCraftingEvent_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP13AnimatePacket"), (void *)&handleAnimate, (void **)&handleAnimate_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP21BlockEntityDataPacket"), (void *)&handleBlockEntityData, (void **)&handleBlockEntityData_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP17PlayerInputPacket"), (void *)&handlePlayerInput, (void **)&handlePlayerInput_real);
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN20ServerNetworkHandler6handleERKN6RakNet10RakNetGUIDEP24SpawnExperienceOrbPacket"), (void *)&handleSpawnExperienceOrb, (void **)&handleSpawnExperienceOrb_real);
	MSHookFunction((void *)&ServerNetworkHandler::allowIncomingConnections, (void *)*allowIncomingConnections, (void **)&allowIncomingConnections_real);
	MSHookFunction((void *)&ServerNetworkHandler::disconnectClient, (void *)&disconnectClient, (void **)&disconnectClient_real);
}
示例#28
0
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
	void* Tile$initTiles = dlsym(RTLD_DEFAULT, "_ZN4Tile9initTiles");
	MSHookFunction((void*) &Tile$initTiles, (void*) &Tile$initTiles_hook, (void**) &Tile$initTiles_real);
	return JNI_VERSION_1_2;
}
示例#29
0
void CustomLocalPlayer::setupHooks()
{
	MSHookFunction(dlsym(RTLD_DEFAULT, "_ZN11LocalPlayerC2EP15MinecraftClientR5LevelRK4User8GameTypeRKN6RakNet10RakNetGUIDEN3mce4UUIDE"), (void *)&constructor, (void **)&constructor_real);
}
示例#30
0
文件: main.cpp 项目: kuukai/ex
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
    MSHookFunction((void*)&Particle::render,(void*)&hook1,(void**)&_hook1);
    MSHookFunction((void*)&BreakingItemParticle::render,(void*)&hook2,(void**)&_hook2);
    MSHookFunction((void*)&TerrainParticle::render,(void*)&hook3,(void**)&_hook3);
    return JNI_VERSION_1_2;
}