Hello everyone,
I am going to make a anti dll injection in order to protect my game client,
but whenever i tried to use this code, some of runtime game dll will not be loaded, and the game will be crashed.
void AntiInject () { HANDLE hProc = FindWindow(0,"Gunz"); while (TRUE) { BlockAPI(hProc, "NTDLL.DLL", "LdrLoadDll"); Sleep (100); } } BOOLEAN BlockAPI (HANDLE hProcess, CHAR *libName, CHAR *apiName) { CHAR pRet[]={0xC3}; HINSTANCE hLib = NULL; VOID *pAddr = NULL; BOOL bRet = FALSE; DWORD dwRet = 0; hLib = LoadLibrary (libName); if (hLib) { pAddr = (VOID*)GetProcAddress (hLib, apiName); if (pAddr) { if (WriteProcessMemory (hProcess, (LPVOID)pAddr, (LPVOID)pRet, sizeof (pRet), &dwRet )) { if (dwRet) { bRet = TRUE; } } } FreeLibrary (hLib); } return bRet; }
So, my idea is to add dlls exceptions, but im really no ideas on it :(
Does anyone know how to edit the code to be worked? Or maybe there are other ways to anti dlls?
Thanks in advance! (Also please give me a code sample of your method, since im newbie on anti hacking :d)