Aimbots.net - The N°1 Community For All Your Gaming Needs.
+ Reply to Thread + Post New Thread
Results 1 to 9 of 9

Thread: [C] DLL question, CoD4
  • Share This Thread!
    • Share on Facebook
    1. #1
      Junior Member norbix is on a distinguished road
      Join Date
      Jul 2009
      Posts
      27
      Thanks
      0
      Thanked 0 Times in 0 Posts

      Exclamation [C] DLL question, CoD4

      hi i have another question, today i have created my personal DLL Injector, and now i am trying to do something with call of duty 4, clearing recoil for example

      but.. there is a problem, if i leave the DLL running, the game crashes, i must terminate the process with another tool i have built

      this is the source code, the injector i have used is this http://aimbots.net/basehooks-sources...-test-dll.html

      also, the punkbuster kick me (0 minute kick) for corrupted memory, even if i am using VirtualProtect() and not WriteProcessMemory()

      norecoil.c (for call of duty 4 - modern warfare v1.7)
      Code:
      #include <windows.h>
      
      void norecoil_hack_core(void);
      void manipulate_memory(int address, BYTE *data, int length);
      int pressed(int v_key);
      
      BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID _Reserved)
      {
           if(dwReason == DLL_PROCESS_ATTACH) norecoil_hack_core();
           return TRUE;
      }
      
      void norecoil_hack_core(void)
      {
           BYTE norecoil_ON[2] = {0x75, 0x12};
           BYTE norecoil_OFF[2] = {0x74, 0x12};
           int norecoil = 0;
      
           while(1)
           {
                if(pressed(VK_NUMPAD0))
                {
                     if(norecoil == 0)
                     {
                          manipulate_memory(0x00457CCF, norecoil_ON, 2);
                          //HANDLE cod4mw = GetCurrentProcess();
                          //WriteProcessMemory(cod4mw, (void *)0x00457CCF, norecoil_ON, 2, 0);
                          norecoil = 1;
                     }
                     else
                     {
                          manipulate_memory(0x00457CCF, norecoil_OFF, 2);
                          //HANDLE cod4mw = GetCurrentProcess();
                          //WriteProcessMemory(cod4mw, (void *)0x00457CCF, norecoil_OFF, 2, 0);
                          norecoil = 0;
                     }
      
                     _beep(440, 10);
                     _sleep(500);
                }
      
                _sleep(1);
           }
      }
      
      void manipulate_memory(int address, BYTE *data, int length)
      {
           int protection;
           VirtualProtect((void *)address, length, PAGE_READWRITE, (PDWORD)&protection);
           memcpy((void *)address, (const void *)data, length);
           VirtualProtect((void *)address, length, protection, 0);
      }
      
      int pressed(int v_key) // returns 1 if true, 0 if false
      {
           /* SHORT GetAsyncKeyState(int vKey);
      
              Return Value
              If the function succeeds, the return value specifies whether the key was pressed since the last call to GetAsyncKeyState,
              and whether the key is currently up or down. If the most significant bit is set, the key is down, and if the least
              significant bit is set, the key was pressed after the previous call to GetAsyncKeyState. */
      
           if((GetAsyncKeyState(v_key) & 0x00000001) != 0) return 1;
           return 0;
      }
      

    2. #2
      VIP chaplex will become famous soon enough chaplex's Avatar
      Join Date
      Apr 2006
      Location
      Croatia / Hrvatska
      Posts
      732
      Thanks
      0
      Thanked 35 Times in 14 Posts

      Default Re: [C] DLL question, CoD4

      PB doesn't detect the functions you use, but what you do - you're modifying the game's memory.
      http://chaplja.net | http://twitter.com/chaplja
      The DJs took pills to stay awake and play for seven days

    3. #3
      Member back2hack is on a distinguished road
      Join Date
      Jul 2009
      Posts
      31
      Thanks
      0
      Thanked 0 Times in 0 Posts

      Default Re: [C] DLL question, CoD4

      You are patching bytes = detected.

    4. #4
      Junior Member norbix is on a distinguished road
      Join Date
      Jul 2009
      Posts
      27
      Thanks
      0
      Thanked 0 Times in 0 Posts

      Default Re: [C] DLL question, CoD4

      Quote Originally Posted by back2hack View Post
      You are patching bytes = detected.
      always?

      and about the problem of the crash? some idea?

    5. #5
      VIP FreckleS is on a distinguished road FreckleS's Avatar
      Join Date
      Jan 2007
      Location
      Australia
      Posts
      2,122
      Thanks
      28
      Thanked 18 Times in 13 Posts

      Default Re: [C] DLL question, CoD4

      If pb is on the server you will be kicked for it. Basically PB has the game's memory memorized and when you change the games memory (remove recoil) pb detects a change to what it knows..Kick.

    6. #6
      2600 hz Couch is on a distinguished road Couch's Avatar
      Join Date
      Apr 2006
      Location
      Canada
      Posts
      745
      Thanks
      6
      Thanked 12 Times in 11 Posts

      Default Re: [C] DLL question, CoD4

      Quote Originally Posted by norbix View Post
      always?

      and about the problem of the crash? some idea?
      Read up on IsBadReadPtr/IsBadWritePtr
      Code:
      <chaplja|> i'm taking over nixcoders
      <Smileman`> cool
      

    7. #7
      Junior Member norbix is on a distinguished road
      Join Date
      Jul 2009
      Posts
      27
      Thanks
      0
      Thanked 0 Times in 0 Posts

      Post Re: [C] DLL question, CoD4

      ok i have readed this but it was somewhat discouraging..

      "Important This function is obsolete and should not be used. Despite its name, it does not guarantee that the pointer is valid or that the memory pointed to is safe to use. For more information, see Remarks on this page."

      okay.. but i can try to use it in any case..

      but reading..

      "IsBadXxxPtr should really be called CrashProgramRandomly"

      O_o, nice function lol..

      so, even if i resolve the problem of the game crash, punkbuster detect my hack, there is a way to bypass PB and use the hack in this mode, or i must learn how to use detouring?

      i am going to read some old forum threads.. thanks for the answers

    8. #8
      51B4B3 King-Orgy is a glorious beacon of light King-Orgy is a glorious beacon of light King-Orgy is a glorious beacon of light King-Orgy is a glorious beacon of light King-Orgy is a glorious beacon of light King-Orgy is a glorious beacon of light King-Orgy's Avatar
      Join Date
      Jun 2007
      Posts
      3,210
      Thanks
      124
      Thanked 533 Times in 261 Posts

    9. #9
      Junior Member norbix is on a distinguished road
      Join Date
      Jul 2009
      Posts
      27
      Thanks
      0
      Thanked 0 Times in 0 Posts

      Exclamation Re: [C] DLL question, CoD4

      i have solved the main problem, reading other sources i have understand that a DLL must create a thread and exit from DllMain, otherwise the injection block the game

      this is the norecoil dll source code for cod4 v1.7, detected, now i search some PB countermeasures

      norecoil.c
      Code:
      // Call Of Duty 4 - Modern Warfare v1.7 NoRecoil by NorbiX (DETECTED)
      
      // Author: NorbiX
      // MSN:    bobcat01@hotmail.com
      // e-mail: xibron[at]gmail[dot]com
      
      #include <windows.h>
      
      void norecoil_hack_core(void);
      void manipulate_memory(int address, BYTE *data, int length);
      int pressed(int v_key);
      
      BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID pvReserved)
      {
           if(dwReason == DLL_PROCESS_ATTACH)
           {
                CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&norecoil_hack_core, NULL, 0, NULL);
           }
           return TRUE;
      }
      
      void norecoil_hack_core(void)
      {
           BYTE norecoil_ON[2] = {0x75, 0x12};
           BYTE norecoil_OFF[2] = {0x74, 0x12};
           int norecoil = 0;
      
           while(1)
           {
                if(pressed(VK_NUMPAD0))
                {
                     if(norecoil == 0)
                     {
                          manipulate_memory(0x00457CCF, norecoil_ON, 2);
                          //HANDLE cod4mw = GetCurrentProcess();
                          //WriteProcessMemory(cod4mw, (void *)0x00457CCF, norecoil_ON, 2, 0);
                          norecoil = 1;
                     }
                     else
                     {
                          manipulate_memory(0x00457CCF, norecoil_OFF, 2);
                          //HANDLE cod4mw = GetCurrentProcess();
                          //WriteProcessMemory(cod4mw, (void *)0x00457CCF, norecoil_OFF, 2, 0);
                          norecoil = 0;
                     }
      
                     _beep(440, 10);
                     _sleep(500);
                }
      
                _sleep(1);
           }
      }
      
      void manipulate_memory(int address, BYTE *data, int length)
      {
           int protection;
           VirtualProtect((void *)address, length, PAGE_READWRITE, (PDWORD)&protection);
           memcpy((void *)address, (const void *)data, length);
           VirtualProtect((void *)address, length, protection, 0);
      }
      
      int pressed(int v_key) // returns 1 if true, 0 if false
      {
           /* SHORT GetAsyncKeyState(int vKey);
      
              Return Value
              If the function succeeds, the return value specifies whether the key was pressed since the last call to GetAsyncKeyState,
              and whether the key is currently up or down. If the most significant bit is set, the key is down, and if the least
              significant bit is set, the key was pressed after the previous call to GetAsyncKeyState. */
      
           if((GetAsyncKeyState(v_key) & 0x00000001) != 0) return 1;
           return 0;
      }
      
      PS: i havent used the two functions IsBad..()

    Similar Threads

    1. Ollydbg cod4 no recoil [/Question]
      By IIVII4NI4Cx in forum Basics
      Replies: 23
      Last Post: July 14th, 2009, 20:48
    2. [Question] COD4 Cheat
      By SkilleDx in forum Call of Duty 4 Cheats
      Replies: 3
      Last Post: March 30th, 2008, 15:34
    3. Question
      By Meat in forum Enemy Territory Cheats
      Replies: 5
      Last Post: December 20th, 2007, 22:58
    4. Cfg Question
      By Maxxx29 in forum Vecs & Scripts
      Replies: 5
      Last Post: November 5th, 2007, 16:41
    5. Question ??
      By lolip in forum Granted & Closed
      Replies: 1
      Last Post: November 3rd, 2007, 10:13

    Bookmarks

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts