Hooking findmdl in ayyware

Забаненный
Статус
Оффлайн
Регистрация
30 Авг 2017
Сообщения
2
Реакции[?]
1
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
!!! I AM KNOTTSBRO ON UC !!!
I've noticed quite a few threads asking about how to properly hook FindMDL in ayyware. Since I'm bored (and have no use for this), Here's an easy tutorial on how to properly hook FindMDL in ayyware.
THIS IS PURE SPOONFEED.
(also, sorry this formatting is ass, this is my first time making a tutorial.)


Step 1) Getting the necessary class for FindMDL:

Пожалуйста, авторизуйтесь для просмотра ссылки.
- Get the entirety of this hastebin and put it in a new header file called IMDLCache.h, and then include that header file in your SDK.h


Step 2) Creating the actual interface:

What is most important here is that in your offsets, you create a new module called DataCache. You will want it to define it as the following in Offsets.cpp:
Code:
  1. Modules::DataCaches = Utilities::Memory::WaitOnModuleHandle("datacache.dll");
Next, you want to define the interface as following:
Code:
  1. IMDLCache* ModelCache;
In Interfaces.cpp, you will want to add
Code:
  1. CreateInterface_t DataCaching = NULL;
at the top, and when you initialize the interfaces, define DataCaching as the following:
Code:
  1. DataCaching = (CreateInterface_t)GetProcAddress((HMODULE)Offsets::Modules::DataCaches, "CreateInterface");
Below that, paste this:
Code:
  1. char* pDataCache = (char*)Utilities::Memory::FindTextPattern("datacache.dll", "MDLCache00");
and finally, set the interface you defined earlier (IMDLCache* ModelCache) to this:
Code:
  1. ModelCache = (IMDLCache*)DataCaching(pDataCache, NULL);

Step 3) Hooking it:

First you want to create a new VMTManager called VMTMDLCache.

Then at the top of Hooks.cpp, add these 3 lines:
Code:
  1. typedef MDLHandle_t(__thiscall* iFindMdl)(void*, char*);
  2. iFindMdl oFindMDL;
  3. MDLHandle_t __fastcall hkFindMDL(void*, void*, char*);
When you initialize your hooks, initialize VMTModelCache and define oFindMDL as the following:
Code:
  1. VMTModelCache.Initialise((DWORD*)Interfaces::ModelCache);
  2. oFindMDL = (iFindMdl)VMTModelCache.HookMethod((DWORD)&hkFindMDL, 10);
Lastly, create your actual findmdlhook. Here's an example:
Code:
  1. MDLHandle_t __fastcall hkFindMDL(void* ecx, void* edx, char* FilePath)
  2. {
  3. if (strstr(FilePath, "ak47.mdl"))
  4. return oFindMDL(ecx, "models/weapons/v_cod_ak117.mdl");
  5. if (strstr(FilePath, "awp.mdl"))
  6. return oFindMDL(ecx, "models/weapons/v_cod9_ballista.mdl");
  7. if (strstr(FilePath, "deagle.mdl"))
  8. return oFindMDL(ecx, "models/weapons/v_deagle_phoenix.mdl");
  9. if (strstr(FilePath, "knife_default_ct.mdl") || strstr(FilePath, "knife_default_t.mdl"))
  10. return oFindMDL(ecx, "models/weapons/v_cfaxerose.mdl");
  11. return oFindMDL(ecx, FilePath);
  12. }

have fun
 
Сверху Снизу