anti dll inject

Results 1 to 4 of 4
  1. #1
    Valued Member Marwan1 is offline
    MemberRank
    Jun 2011 Join Date
    127Posts

    anti dll inject

    Code:
    void AntiInject () 
    { 
       HANDLE hProc = GetCurrentProcess(); 
       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; 
    }
    how to add dll exception?


  2. #2
    Retired. Don't PM. SecretsOThePast is offline
    DeveloperRank
    Jan 2009 Join Date
    643Posts

    Re: anti dll inject

    Quote Originally Posted by Marwan1 View Post
    Code:
    void AntiInject () 
    { 
       HANDLE hProc = GetCurrentProcess(); 
       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; 
    }
    how to add dll exception?
    because blocking every DLL from entering your program is a great idea.

    hint: it's not. learn to code more creative ways of handling cheaters, this is not the way to approach anti-cheating.

  3. #3
    Valued Member Marwan1 is offline
    MemberRank
    Jun 2011 Join Date
    127Posts

    Re: anti dll inject

    dont tell me whats better to use and i have asked
    how to add exception dlls ...

  4. #4
    Retired. Don't PM. SecretsOThePast is offline
    DeveloperRank
    Jan 2009 Join Date
    643Posts

    Re: anti dll inject

    Quote Originally Posted by Marwan1 View Post
    dont tell me whats better to use and i have asked
    how to add exception dlls ...
    Exception DLLs how? This code literally does nothing but patch a return into where LdrLoadDll should be. You can't add exceptions like this... as it'll always return to the original function, and in fact, by doing so, this should break any DLL from ever loading in your program including the ones that are needed. There isn't an easy way to do what you are wanting to do, and denying dlls by name isn't the most safe way of stopping hacks... all someone has to do is edit your allowed DLLs list whether it be by getting the module and writing to it, or editing it in a binary file editor.

    You need to re-evaluate your anti-cheating methods anyways; there are far more effective ways of stopping cheating than this.



Advertisement