示例#1
0
int hot_patch( patch_entry *begin, patch_entry *end )
{
	patch_entry *i;
	for( i = begin; i != end; i++ )
	{
		HMODULE mod = GetModuleHandle( i->module );
		if( !mod )
			continue;

		void *old_proc = GetProcAddress( mod, i->name );
		if( !old_proc )
			continue;

		if( hot_patch_int( old_proc, i->new_proc, i->orig_proc ) != 0 )
			DEBUG_HOOK( "not hot-patchable (%s)\n", i->name );
	    else
	    {
	    	i->skip = 1;
	    }
	}

	return 0;
}
示例#2
0
文件: hot_patch.c 项目: anatol/tup
int hot_patch(struct patch_entry *begin, struct patch_entry *end)
{
	struct patch_entry *i;
	for(i = begin; i != end; i++) {
		wchar_t wmodule[PATH_MAX];
		MultiByteToWideChar(CP_UTF8, 0, i->module, -1, wmodule, PATH_MAX);
		HMODULE mod = GetModuleHandle(wmodule);
		if(!mod)
			continue;

		void *old_proc = GetProcAddress(mod, i->name);
		if(!old_proc)
			continue;

		if(hot_patch_int(old_proc, i->new_proc, i->orig_proc) != 0) {
			DEBUG_HOOK("not hot-patchable (%s)\n", i->name);
		} else {
			DEBUG_HOOK("hot-patched (%s)\n", i->name);
			i->skip = 1;
		}
	}

	return 0;
}