Page 1 of 2 12 LastLast
Results 1 to 15 of 28
  1. #1
    The~Shadow~Coders's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    198
    Reputation
    10
    Thanks
    240
    My Mood
    Blah
    Open C++ 2010 / 2008

    Create Project Win32 Console

    C++ SynTax

    Code:
    #include <windows.h> 
    #include <tlhelp32.h> 
    #include <shlwapi.h> 
    #include <conio.h> 
    #include <stdio.h> 
    
    
    #define WIN32_LEAN_AND_MEAN 
    #define CREATE_THREAD_ACCESS (PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ) 
    
    BOOL Inject(DWORD pID, const char * DLL_NAME); 
    DWORD GetTargetThreadIDFromProcName(const char * ProcName); 
    
    int main(int argc, char * argv[]) 
    { 
       // Retrieve process ID 
       DWORD pID = GetTargetThreadIDFromProcName("notepad.exe"); 
        
       // Get the dll's full path name 
       char buf[MAX_PATH] = {0}; 
       GetFullPathName("Project1.dll", MAX_PATH, buf, NULL); 
       printf(buf); 
       printf("\n"); 
        
       // Inject our main dll 
       if(!Inject(pID, buf)) 
       { 
    
            printf("DLL Not Loaded!"); 
        }else{ 
            printf("DLL Loaded!"); 
        } 
    
        _getch(); 
       return 0; 
    } 
    
    BOOL Inject(DWORD pID, const char * DLL_NAME) 
    { 
       HANDLE Proc; 
       HMODULE hLib; 
       char buf[50] = {0}; 
       LPVOID RemoteString, LoadLibAddy; 
    
       if(!pID) 
          return false; 
    
       Proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pID); 
       if(!Proc) 
       { 
          sprintf(buf, "OpenProcess() failed: %d", GetLastError()); 
          //MessageBox(NULL, buf, "Loader", MB_OK); 
          printf(buf); 
          return false; 
       } 
        
       LoadLibAddy = (LPVOID)GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA"); 
    
       // Allocate space in the process for our DLL 
       RemoteString = (LPVOID)VirtualAllocEx(Proc, NULL, strlen(DLL_NAME), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); 
    
       // Write the string name of our DLL in the memory allocated 
       WriteProcessMemory(Proc, (LPVOID)RemoteString, DLL_NAME, strlen(DLL_NAME), NULL); 
    
       // Load our DLL 
       CreateRemoteThread(Proc, NULL, NULL, (LPTHREAD_START_ROUTINE)LoadLibAddy, (LPVOID)RemoteString, NULL, NULL); 
    
       CloseHandle(Proc); 
       return true; 
    } 
    
    DWORD GetTargetThreadIDFromProcName(const char * ProcName) 
    { 
       PROCESSENTRY32 pe; 
       HANDLE thSnapShot; 
       BOOL retval, ProcFound = false; 
    
       thSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); 
       if(thSnapShot == INVALID_HANDLE_VALUE) 
       { 
          //MessageBox(NULL, "Error: Unable <strong class="highlight">to</strong> create toolhelp snapshot!", "2MLoader", MB_OK); 
          printf("Error: Unable <strong class="highlight">to</strong> create toolhelp snapshot!"); 
          return false; 
       } 
    
       pe.dwSize = sizeof(PROCESSENTRY32); 
        
       retval = Process32First(thSnapShot, &pe); 
       while(retval) 
       { 
          if(StrStrI(pe.szExeFile, ProcName)) 
          { 
             return pe.th32ProcessID; 
          } 
          retval = Process32Next(thSnapShot, &pe); 
       } 
       return 0; 
    }
    Create a source file name DllMain.cpp

    DllMain.cpp:
    Code:
    /* Replace "dll.h" with the name of your header */
    #include "dll.h"
    #include <windows.h>
    #include <stdio.h>
    #include <stdlib.h>
    
    DLLIMPORT void Hello ()
    {
        MessageBox (0, "Hello from injected DLL!\n", "Hi", MB_ICONINFORMATION);
    }
    
    
    BOOL APIENTRY DllMain (HINSTANCE hInst     /* Library instance handle. */ ,
                           DWORD reason        /* Reason this function is being called. */ ,
                           LPVOID reserved     /* Not used. */ )
    {
    switch (reason)
        {
          case DLL_PROCESS_ATTACH:
               Hello();
            break;
    
          case DLL_PROCESS_DETACH:
               Hello();
            break;
    
          case DLL_THREAD_ATTACH:
               Hello();
            break;
    
          case DLL_THREAD_DETACH:
               Hello();
            break;
        }  
    
        /* Returns TRUE <strong class="highlight">on</strong> success, FALSE <strong class="highlight">on</strong> failure */
        return TRUE;
    }
    Now create a Header File name dll.h

    Code:
    #ifndef _DLL_H_
    #define _DLL_H_
    
    #if BUILDING_DLL
    # define DLLIMPORT __declspec (dllexport)
    #else /* Not BUILDING_DLL */
    # define DLLIMPORT __declspec (dllimport)
    #endif /* Not BUILDING_DLL */
    
    
    DLLIMPORT void Hello (void);
    
    
    #endif /* _DLL_H_ */
    Please Thanks Me :P

    <SLEEPY Guyz> No online member s Oh comeon replay

    ************************************************** ************************

    And here a good code ( IF U NOT GOOD ON C++ DON T USE IT BECAUSE YOU WILL NOT KNOW WHERE TO PUT IT )

    Code:
    #include <string>
    #include <windows.h>
    
    #define MAXWAIT 10000
    
    bool insertDll(DWORD procID, std::string dll)
    {
        //Find the address of the LoadLibrary api, luckily for us, it is loaded in the same address for every process
        HMODULE hLocKernel32 = GetModuleHandle("Kernel32");
        FARPROC hLocLoadLibrary = GetProcAddress(hLocKernel32, "LoadLibraryA");
        
        //Adjust token privileges to open system processes
        HANDLE hToken;
        TOKEN_PRIVILEGES tkp;
        if(OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
        {
            LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tkp.Privileges[0].Luid);
            tkp.PrivilegeCount = 1;
            tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
            AdjustTokenPrivileges(hToken, 0, &tkp, sizeof(tkp), NULL, NULL);
        }
    
        //Open the process with all access
        HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procID);
    
        //Allocate memory to hold the path to the Dll File in the process's memory
        dll += '\0';
        LPVOID hRemoteMem = VirtualAllocEx(hProc, NULL, dll.size(), MEM_COMMIT, PAGE_READWRITE);
    
        //Write the path to the Dll File in the location just created
        DWORD numBytesWritten;
        WriteProcessMemory(hProc, hRemoteMem, dll.c_str(), dll.size(), &numBytesWritten);
    
        //Create a remote thread that starts begins at the LoadLibrary function and is passed are memory pointer
        HANDLE hRemoteThread = CreateRemoteThread(hProc, NULL, 0, (LPTHREAD_START_ROUTINE)hLocLoadLibrary, hRemoteMem, 0, NULL);
    
        cout << hRemoteThread << endl;
    
        //Wait for the thread to finish
        bool res = false;
        if (hRemoteThread)
            res = (bool)WaitForSingleObject(hRemoteThread, MAXWAIT) != WAIT_TIMEOUT;
    
        //Free the memory created on the other process
        VirtualFreeEx(hProc, hRemoteMem, dll.size(), MEM_RELEASE);
    
        //Release the handle to the other process
        CloseHandle(hProc);
    
        return res;
    }
    Last edited by The~Shadow~Coders; 07-18-2011 at 01:58 PM.

  2. The Following 10 Users Say Thank You to The~Shadow~Coders For This Useful Post:

    3adla (08-22-2011),aegaeea (07-25-2011),DaRk (07-19-2011),ilovethankppl (07-23-2011),Krouzu (12-23-2016),Neechan' (07-18-2011),ninjastormns (07-12-2012),Sabrina_Ferraz (03-20-2016),THE MOB (10-20-2015),vivavova (07-20-2011)

  3. #2
    Codemunkie's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    England :D
    Posts
    219
    Reputation
    25
    Thanks
    755
    My Mood
    Bored
    Not much of a tutorial, it's just source code.
    [IMG]https://i789.photobucke*****m/albums/yy172/Codemunkie/sig-logo.png[/IMG]

  4. #3
    Neechan''s Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    HI !
    Posts
    5,722
    Reputation
    122
    Thanks
    1,318
    What for Features we should add?
    Button, Timer? ...

    And screens :'D

  5. #4
    The~Shadow~Coders's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    198
    Reputation
    10
    Thanks
    240
    My Mood
    Blah
    Quote Originally Posted by Stewie Griffin View Post
    What for Features we should add?
    Button, Timer? ...

    And screens :'D
    its c++ well if u want to make a project it'll be kinda a hard with this source

    Quote Originally Posted by Codemunkie View Post
    Not much of a tutorial, it's just source code.
    its source code + How to use / put it means it a Tut
    Last edited by The~Shadow~Coders; 07-18-2011 at 11:59 AM.

  6. The Following 2 Users Say Thank You to The~Shadow~Coders For This Useful Post:

    aegaeea (07-25-2011),ilovethankppl (07-23-2011)

  7. #5
    mike2y's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Posts
    94
    Reputation
    10
    Thanks
    2
    isnt this suppose to be in the crossfire tutorial section jst saying but if thats ok wit gm then ok

  8. #6
    The~Shadow~Coders's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    198
    Reputation
    10
    Thanks
    240
    My Mood
    Blah
    Quote Originally Posted by mike2y View Post
    isnt this suppose to be in the crossfire tutorial section jst saying but if thats ok wit gm then ok
    Well it must be here , because its a injector Guide

  9. The Following 2 Users Say Thank You to The~Shadow~Coders For This Useful Post:

    aegaeea (07-25-2011),ilovethankppl (07-23-2011)

  10. #7
    The~Shadow~Coders's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    198
    Reputation
    10
    Thanks
    240
    My Mood
    Blah
    No replay's ?

    @Ghost Could you Sticky it ?

  11. The Following 2 Users Say Thank You to The~Shadow~Coders For This Useful Post:

    aegaeea (07-25-2011),ilovethankppl (07-23-2011)

  12. #8
    Neechan''s Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    HI !
    Posts
    5,722
    Reputation
    122
    Thanks
    1,318
    Quote Originally Posted by The~Shadow~Coders View Post
    No replay's ?

    @Ghost Could you Sticky it ?
    No sticky, if you want one, then;

    - More Information
    - What Features we should add?
    - Add screenies...
    and and and .. like mine :'D

  13. #9
    dragonattak's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Location
    Italy,Rome.. Post:141732
    Posts
    704
    Reputation
    -19
    Thanks
    411
    My Mood
    Devilish
    C++ injector is stupid... just make visual basic...

  14. #10
    Neechan''s Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    HI !
    Posts
    5,722
    Reputation
    122
    Thanks
    1,318
    Quote Originally Posted by dragonattak View Post
    C++ injector is stupid... just make visual basic...
    Agree...

    Injector in C++ and VB = Same.

    C++; is tooooo hard.
    VB; Just copy + paste.

  15. #11
    The~Shadow~Coders's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    198
    Reputation
    10
    Thanks
    240
    My Mood
    Blah
    Quote Originally Posted by Stewie Griffin View Post
    Agree...

    Injector in C++ and VB = Same.

    C++; is tooooo hard.
    VB; Just copy + paste.
    C++ IS SO EASY

  16. The Following 3 Users Say Thank You to The~Shadow~Coders For This Useful Post:

    aegaeea (07-25-2011),GeneRaLHacKsS (01-01-2013),ilovethankppl (07-23-2011)

  17. #12
    [D]arkMan's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Akatsuki
    Posts
    1,026
    Reputation
    10
    Thanks
    1,224
    My Mood
    Asleep
    nice i gotta try it

  18. #13
    Neechan''s Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    HI !
    Posts
    5,722
    Reputation
    122
    Thanks
    1,318
    Quote Originally Posted by The~Shadow~Coders View Post
    C++ IS SO EASY
    Not for me xD

    I want a book

  19. #14
    The~Shadow~Coders's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    198
    Reputation
    10
    Thanks
    240
    My Mood
    Blah
    Quote Originally Posted by Stewie Griffin View Post
    Not for me xD

    I want a book
    No need it's soooo much easy

  20. The Following 2 Users Say Thank You to The~Shadow~Coders For This Useful Post:

    aegaeea (07-25-2011),ilovethankppl (07-23-2011)

  21. #15
    GS-HITMAN's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    East Coast (NAEST)
    Posts
    2,002
    Reputation
    16
    Thanks
    576
    I have seen this on the internet.... you didn't make this scoure code.

Page 1 of 2 12 LastLast

Similar Threads

  1. How To Make Dll With Source [EASY]
    By [Banned]mark0108 in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 89
    Last Post: 12-15-2010, 02:28 AM
  2. [HELP] How To Making DLL Hack
    By Rajalawak in forum C++/C Programming
    Replies: 30
    Last Post: 11-20-2010, 12:50 PM
  3. how to make. dll for warrock???
    By rgomez72 in forum WarRock Discussions
    Replies: 1
    Last Post: 07-28-2010, 12:46 PM
  4. how to make dll
    By warball8 in forum Combat Arms Help
    Replies: 4
    Last Post: 06-09-2010, 07:39 AM
  5. how to make dlls-tut (long)
    By cru0 in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 2
    Last Post: 01-05-2010, 11:50 AM