Results 1 to 2 of 2

Thread: Useful C code

  1. #1
    Dwar
    Dwar is offline
    Veteran Dwar's Avatar
    Join Date
    2010 Mar
    Posts
    2,222
    Thanks Thanks Given 
    211
    Thanks Thanks Received 
    2,230
    Thanked in
    292 Posts
    Rep Power
    10

    Useful C code

    [Snippet]

    Dll Template
    #include <Windows.h>

    DWORD WINAPI dwThread( LPVOID )
    {

    return 0;
    }

    BOOL WINAPI DllMain( HMODULE hModule, DWORD dwReason, LPVOID lvpReserved )
    {
    switch( dwReason )
    {
    case DLL_PROCESS_ATTACH:
    CreateThread( 0, 0, dwThread, 0, 0, 0 );
    break;

    case DLL_PROCESS_DETACH:

    break;
    }
    }

    Console Attach Dll
    #include <Windows.h>
    #include <stdio.h>

    DWORD WINAPI dwConsole( LPVOID )
    {
    //Windows Console
    AllocConsole();
    AttachConsole( GetCurrentProcessId() );
    freopen( "CON", "w", stdout );

    //Print Text on console
    printf( "CONSOLE ATTACHED!\n" );

    return 0;
    }

    BOOL WINAPI DllMain( HMODULE hModule, DWORD dwReason, LPVOID lvpReserved )
    {
    switch( dwReason )
    {
    case DLL_PROCESS_ATTACH:
    CreateThread( 0, 0, dwConsole, 0, 0, 0 );
    break;

    case DLL_PROCESS_DETACH:

    break;
    }
    }

    Using Classes
    class CClass;

    class CClass
    {
    public:
    char cName[16]; //0x0000
    DWORD dwHealth; //0x0010
    DWORD dwAmmo; //0x0014
    };
    CClass* cClass = (CClass*)0xFFFFFFF;


    [Class Name* randomname = (Class Name*)Address]

    void hack()
    {
    cClass->dwHealth = 999;
    }

    Print Text from Class
    class CClass;

    class CClass
    {
    public:
    char cName[16]; //0x0000
    DWORD dwHealth; //0x0010
    DWORD dwAmmo; //0x0014
    };
    CClass* cClass = (CClass*)0xFFFFFFF;

    char Name[256];
    sprintf( Name, "Name:%S [H:%X]", cClass->cName, cClass->dwHealth );
    PrintText( Name );

    Comes out as:
    Name:Code[V] [H: 100]


    by Code[V]
    Please, post your questions on forum, not by PM or mail

    I spend my time, so please pay a little bit of your time to keep world in equilibrium

  2. The Following 3 Users Say Thank You to Dwar For This Useful Post:


  3. #2
    SaptaAgunk
    SaptaAgunk is offline
    New member SaptaAgunk's Avatar
    Join Date
    2010 Dec
    Posts
    13
    Thanks Thanks Given 
    14
    Thanks Thanks Received 
    0
    Thanked in
    0 Posts
    Rep Power
    0
    Thanks for shared......

    how about using the message box, hotkey and the injection into the game?
    and have multiple functions, such as: blood + Ammo + and any more ??

Tags for this Thread

Posting Permissions

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